Skip to content

Commit e5290cd

Browse files
Revert "Better fix for AXIS2-5971 AxisServlet.processURLRequest uses content-type header instead of accept"
This reverts commit d35bec0.
1 parent ea99a30 commit e5290cd

File tree

1 file changed

+4
-17
lines changed
  • modules/transport/http/src/main/java/org/apache/axis2/transport/http

1 file changed

+4
-17
lines changed

modules/transport/http/src/main/java/org/apache/axis2/transport/http/AxisServlet.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -904,26 +904,13 @@ public void processURLRequest() throws IOException, ServletException {
904904
try {
905905
// AXIS2-5971, content-type is not present on some
906906
// types of REST requests that have no body and in
907-
// those cases use the 'accept' header if defined.
908-
// On a null content-type it will default to application/x-www-form-urlencoded.
907+
// those cases use the 'accept' header if defined
909908
final String accept = request.getHeader(HttpHeaders.ACCEPT);
910909
final String contentType = request.getContentType();
911-
if (contentType != null) {
912-
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), contentType);
913-
} else if (accept != null && !accept.isEmpty()) {
914-
// TODO: not easy to parse without adding code or libs, and needs to match
915-
// a MessageFormatter we support. Curl by default sends */* . Example from FireFox:
916-
// text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
917-
if (accept.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) != -1) {
918-
log.debug("processURLRequest() will default to this content type found as one of the values in accept header: " + HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
919-
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
920-
} else {
921-
log.debug("AxisServlet.processURLRequest() found null contentType with an Accept header: "+accept+" , that we could not match a content-type, will use default contentType: application/x-www-form-urlencoded");
922-
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), null);
923-
}
910+
if (contentType == null && accept != null) {
911+
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), accept);
924912
} else {
925-
log.debug("AxisServlet.processURLRequest() found null contentType and null Accept header, will use default contentType: application/x-www-form-urlencoded");
926-
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), null);
913+
RESTUtil.processURLRequest(messageContext, response.getOutputStream(), contentType);
927914
}
928915
this.checkResponseWritten();
929916
} catch (AxisFault e) {

0 commit comments

Comments
 (0)