I have tried a lot to return a file from the controller function.
This is my function:
@RequestMapping(value = "/files", method = RequestMethod.GET)
@ResponseBody public FileSystemResource getFile() {
return new FileSystemResource(new File("try.txt"));
}
I got this error message:
Could not write JSON:
No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
(through reference chain:
org.springframework.core.io.FileSystemResource[\"outputStream\"]->java.io.FileOutputStream[\"fd\"]);
nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
(through reference chain: org.springframework.core.io.FileSystemResource[\"outputStream\"]->java.io.FileOutputStream[\"fd\"])
Does anyone have an idea how to solve it?
And, how should I send from the client (JavaScript, jQuery)?
HttpMessageConverterinstances have you registered?jQuery.get("http://localhost:8086/vos-api/StreamProcessingDiagrams/v1/setting/createFOO", function( data ) { jQuery( ".result" ).html( data ); });