[ 
https://issues.apache.org/jira/browse/AXIS2-5971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2-5971.
------------------------------------
    Resolution: Fixed

I understand the problem though we have to be careful here since the Accept 
header isn't mandatory neither and Axis2 considers content-type as the 
definition of the MessageFormatter in a lot of places - in this case, on a null 
content-type it will default to application/x-www-form-urlencoded. 

What I propose, and committed for review though the 2.0.0 release is very near 
and i am marking the issue as fixed for now,  is using the Accept header if 
there is no content-type header defined and the Accept header is not null. 

I'm not 100% sure this fix will work as it lacks a test case and I don't use 
REST in my own projects. A PR by the OP in this case would be better. I'm 
pretty sure though this change will do no harm as it only gets applied for REST 
when content-type is null and accept is not null.  

See this commit. 

https://github.com/apache/axis-axis2-java-core/commit/8d62eb4119a1a06385f5e2a606156e30df2f5b75

> AxisServlet.processURLRequest use content-type header instead of accept
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-5971
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5971
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.7.8
>            Reporter: Marti Pamies Sola
>            Assignee: Robert Lazarski
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> Class org.apache.axis2.transport.http.AxisServlet has the following code
> {code:java}
> //         public void processURLRequest() throws IOException, 
> ServletException {
>             try {
>                 RESTUtil.processURLRequest(messageContext, 
> response.getOutputStream(),
>                         request.getContentType());
>                 this.checkResponseWritten();
>             } catch (AxisFault e) {
>                 setResponseState(messageContext, response);
>                 processFault(e);
>             }
>             closeStaxBuilder(messageContext);        }
> {code}
> As fas as I understand, this code is involed when diong REST and recieving an 
> URL request without body. 
> The problem is that this method looks for request.getContentType() instead of 
> request Accept Header to determine to messageFormater to use. This behaviour 
> make content type mandatory for URL client request which has no sense, as it 
> is a header to indicate server response content type.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to