|
62 | 62 | import jakarta.servlet.http.HttpServlet; |
63 | 63 | import jakarta.servlet.http.HttpServletRequest; |
64 | 64 | import jakarta.servlet.http.HttpServletResponse; |
| 65 | +import jakarta.ws.rs.core.HttpHeaders; |
65 | 66 | import javax.xml.namespace.QName; |
66 | 67 | import java.io.BufferedInputStream; |
67 | 68 | import java.io.BufferedOutputStream; |
@@ -897,8 +898,16 @@ public void processXMLRequest() throws IOException, ServletException { |
897 | 898 |
|
898 | 899 | public void processURLRequest() throws IOException, ServletException { |
899 | 900 | try { |
900 | | - RESTUtil.processURLRequest(messageContext, response.getOutputStream(), |
901 | | - request.getContentType()); |
| 901 | + // AXIS2-5971, content-type is not present on some |
| 902 | + // types of REST requests that have no body and in |
| 903 | + // those cases use the 'accept' header if defined |
| 904 | + final String accept = request.getHeader(HttpHeaders.ACCEPT); |
| 905 | + final String contentType = request.getContentType(); |
| 906 | + if (contentType == null && accept != null) { |
| 907 | + RESTUtil.processURLRequest(messageContext, response.getOutputStream(), accept); |
| 908 | + } else { |
| 909 | + RESTUtil.processURLRequest(messageContext, response.getOutputStream(), contentType); |
| 910 | + } |
902 | 911 | this.checkResponseWritten(); |
903 | 912 | } catch (AxisFault e) { |
904 | 913 | setResponseState(messageContext, response); |
|
0 commit comments