How to return an InputStreamResource so it can readable from postman?
Stack Overflow » Java
by Lalisa Daniella
7m ago
So I have a method @GetMapping( value = "/download/{fileId}", produces = { MediaType.APPLICATION_OCTET_STREAM_VALUE } ) public ResponseEntity<InputStreamResource> download(@Valid @PathVariable(value = "fileId") String fileId) { InputStreamResource file = new InputStreamResource(service.download(fileId)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(new MediaType(MediaType.APPLICATION_OCTET_STREAM, Charset.forName("UTF-8"))); headers.setContentDispositionFormData("attachment", fileId+".doc"); head ..read more
Visit website
SpringBoot @OneToMany Trigger Error And Request Sending Error
Stack Overflow » Java
by fsk
7m ago
I have 2 entity classes. One employee should has one department. But one department can has many employees. When i send to postman request insert employee, i want to trigger Department table. @Table @Entity(name = "employee") @Data @Builder @AllArgsConstructor @NoArgsConstructor public class Employee extends Auditable<String> implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "employee_name", nullable = false) private String employeeName; @Column(name = "employee_surname", nullable = false) private ..read more
Visit website
How to update a variable from inside lambda
Stack Overflow » Java
by S.Dan
7m ago
I've got a function like the following where I need to update a variable from inside lambda (This is the minimal viable example I could think of without giving our private info so it might not make much sense, but the lambda and stage variables are there). But as expected, I can't update the variable since I get the error Variable used in lambda expression should be final or effectively final. What is the best way to update an external variable from within the lambda. The purpose of the variable is to know which stage the process failed in case something goes wrong, which means it can fail wit ..read more
Visit website
Bitshifting a Java IntVector
Stack Overflow » Java
by micycle
7m ago
How can I perform a bitwise shift operation (<< or >>) directly on an IntVector using the Java Vector API? I haven't been able to find anything obvious in the API to do this; the closest I've found is myIntVec.lanewise(VectorOperators.ASHR, shiftAmt) but this performs an additional AND operation on the shift amount ..read more
Visit website
Como posso criar um app em Java/Kotlin que corrija um gabarito [closed]
Stack Overflow » Java
by Igor Mods
7m ago
Bom, preciso de um sistema em Java ou Kotlin que identifiquei o gabarito e faça a correção Por enquanto não sei qual biblioteca usar, e se existe uma ..read more
Visit website
Tika Parser Upgrade 1.19 to 2.6, Performance and Memory Consumption Issue
Stack Overflow » Java
by Swaraj
7m ago
I just upgraded my Spring App Tike core and Parser from 1.19 to 2.6 (core & tika-parsers-standard-package), Started seeing the tons of memory consumption, high CPU consumption and non becomes non responsive. I have tried with 2.4 as well but the same reult. Piece of code - this is the only thing related to Tika Parser - Operation is based on the inputStream and outputStream, File can be of any type - pdf/xls/xlsx/doc/docx/txt/zip/csv this.context = new ParseContext(); this.parser = new AutoDetectParser(); this.context.set(Parser.class, this.parser); .... try { final S ..read more
Visit website
Use Java String.replaceFirst for replacing strings containing special regex characters
Stack Overflow » Java
by Johnny
7m ago
For splitting a string of HTML-sourcecode into it's parts, I have written a method that takes the next desired part of the string, copies it into a list of strings and removes the occurence in the string afterwards. For the removal, I am using text.replaceFirst(s, ""). Unfortunately, the provided HTML-Code contains regex meta chars like '|', resulting in only a partial removal of the characters I have already copied. I really don't want to try to prefix all possibly problematic symbols with a backslash for escaping as it is tedious work and prone to mistakes. Is there a possibility to replace ..read more
Visit website
Using a ListSelectionModel, how do I get the value of a specific cell when a row is selected?
Stack Overflow » Java
by Jakub Zak
7m ago
In my Java GUI, I have a table which displays various rows of data. I want the functionality of this to be so that the user clicks on a row and then clicks a button do delete the row (this part works) Behind the scenes, I need to get the Item ID cell for the selected row, so that I can update my database (using MySQL). I am still looking through the documentation found here: https://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html Here is the code I am using to create the table. You can select the rows, and the row index is printed out. I assume this index will be used to access the s ..read more
Visit website
JSON request isn't converting into my POJO
Stack Overflow » Java
by user21476047
7m ago
My JSON response for some reason isn't converting into my POJO only for the second JSON response below; it is able to convert for the first JSON but not the second. The first JSON format below returns back for a successful request while the other will return back a JSON response for when the user sends a duplicate file name. I keep getting JSON decoding error: Unexpected character ('8' (code 56)): was expecting comma to separate Object entries;. The JSON and POJOs look like this: { "result": { "documents": { "document": { "author": "Author", "description ..read more
Visit website
Android Group multiple number pickers together
Stack Overflow » Java
by LaCalienta
7m ago
I would like to group number pickers together so they would form a number with this I was able to make it look like this XML: <?xml version="1.0" encoding="utf-8"?> <androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/toolbar_layout" android:layout_width="match_parent" android:layout_height="match_parent" app:title="@string/app_name" app:subtitle="@string/app_descrip ..read more
Visit website

Follow Stack Overflow » Java on Feedspot

Continue with Google
Continue with Apple
OR