jfilter icon indicating copy to clipboard operation
jfilter copied to clipboard

response media type is being xml if it's not indicated

Open cumacam opened this issue 4 years ago • 1 comments

Describe the bug @DynamicFilter(ObjectIdFilter.class) @GetMapping(value = "/objects", produces = { MediaType.APPLICATION_JSON_VALUE}) public Page<Object> getObjecList();

this is fine but if I remove produces = { MediaType.APPLICATION_JSON_VALUE} response is being xml instead of json. What is the way of setting json defaul media type?

cumacam avatar Aug 24 '20 07:08 cumacam

In spring boot App In AppConfig set the required default content types. @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer .favorParameter(false) .ignoreAcceptHeader(true) .defaultContentType( MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.TEXT_XML, MediaType.TEXT_MARKDOWN, MediaType.MULTIPART_FORM_DATA, MediaType.MULTIPART_MIXED, MediaType.APPLICATION_RSS_XML, MediaType.APPLICATION_OCTET_STREAM); }

anil-manjappa avatar Sep 24 '20 07:09 anil-manjappa