This is an automated email from the ASF dual-hosted git repository. robertlazarski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push: new 8d62eb4119 AXIS2-5971 AxisServlet.processURLRequest uses content-type header instead of accept 8d62eb4119 is described below commit 8d62eb4119a1a06385f5e2a606156e30df2f5b75 Author: Robert Lazarski <robertlazar...@gmail.com> AuthorDate: Wed Feb 12 07:32:14 2025 -1000 AXIS2-5971 AxisServlet.processURLRequest uses content-type header instead of accept --- .../java/org/apache/axis2/transport/http/AxisServlet.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java b/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java index 46cc407cc3..7158c1b49d 100644 --- a/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java +++ b/modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java @@ -62,6 +62,7 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.core.HttpHeaders; import javax.xml.namespace.QName; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -897,8 +898,16 @@ public class AxisServlet extends HttpServlet { public void processURLRequest() throws IOException, ServletException { try { - RESTUtil.processURLRequest(messageContext, response.getOutputStream(), - request.getContentType()); + // AXIS2-5971, content-type is not present on some + // types of REST requests that have no body and in + // those cases use the 'accept' header if defined + final String accept = request.getHeader(HttpHeaders.ACCEPT); + final String contentType = request.getContentType(); + if (contentType == null && accept != null) { + RESTUtil.processURLRequest(messageContext, response.getOutputStream(), accept); + } else { + RESTUtil.processURLRequest(messageContext, response.getOutputStream(), contentType); + } this.checkResponseWritten(); } catch (AxisFault e) { setResponseState(messageContext, response);