java - spring controller returns 404 with post and file with get to generate responseentity -


i have controller annotated @restcontroller , mapping returns responseentity spring 4.3

the method recieves form data generate file, if request file method url generates file, if request file post method url, spring returns 404

@requestmapping("/request") @restcontroller  mycontroller {      @requestmapping("/notes.do")     responseentity<byte[]> notes(httpservletrequest request, httpservletresponse response, principal principal, notesform form) {         return createresponseentity(form);     } } 

i weblogic's access.log

127.0.0.1 - - [05/abr/2017:19:11:06 -0500] "get /app-web/request/notes.do?notetype=data&notecontent=hello http/1.1" 201 35602 127.0.0.1 - - [05/abr/2017:19:12:29 -0500] "post /app-web/request/notes.do http/1.1" 404 1322 

this request headers request

accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8,es;q=0.6 cache-control:no-cache connection:keep-alive cookie:theme=siirfe-pink;     siirfesess=xkdassgx6p_kr8oftrqyqa7ikg8nrixzr5lo1ns8lpwe1pfsqfwf!-2083194325!none host:wlcap1:9102 pragma:no-cache upgrade-insecure-requests:1 user-agent:mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/53. 

and request header post request

accept:application/json, text/plain, */* accept-encoding:gzip, deflate accept-language:en-us,en;q=0.8,es;q=0.6 cache-control:no-cache connection:keep-alive content-length:103 content-type:application/x-www-form-urlencoded;charset=utf-8 cookie:theme=siirfe-pink; siirfesess=xkdassgx6p_kr8oftrqyqa7ikg8nrixzr5lo1ns8lpwe1pfsqfwf!-2083194325!none host:wlcap1:9102 origin:http://wlcap1:9102 pragma:no-cache referer:http://wlcap1:9102/app-web/dictaminacion user-agent:mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/53.0.2785.143 safari/537.36 

this response request:

cache-control:no-cache, no-store, max-age=0, must-revalidate content-disposition:form-data; name="attachment"; filename="archivo.docx" content-length:35602 content-type:application/docx date:thu, 06 apr 2017 00:39:04 gmt expires:0 pragma:no-cache x-content-type-options:nosniff x-frame-options:deny x-oracle-dms-ecid:8ac7d542-7157-4b0a-8190-f8e69f03a454-00001af0 x-oracle-dms-rid:0 x-xss-protection:1; mode=block 

the response post request error page.

is there way can file post request or missing something?

according logs seems fine on both cases (the controller runs until return request in both cases)

content on responseentity when post request:

201 created,[b@1e6804c8,{content-type=[application/docx], content-disposition=[form-data; name="attachment"; filename="archivo.docx"]} 

content on responseentity when request:

201 created,[b@39cb5a1a,{content-type=[application/docx], content-disposition=[form-data; name="attachment"; filename="archivo.docx"]} 

i have not found error message.

changing accept header on post request fixed problem. not sure why problem since lists */ * (ignore space, don't know how comment display correctly) last option, removing application/json , text/plain solved issue


Comments