Author: keith Date: Sun Jun 22 22:33:05 2008 New Revision: 18540 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18540
Log: Fixing Mashup 864 Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServlet.java Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServlet.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServlet.java?rev=18540&r1=18539&r2=18540&view=diff ============================================================================== --- trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServlet.java (original) +++ trunk/mashup/java/modules/core/src/org/wso2/mashup/transport/MashupServlet.java Sun Jun 22 22:33:05 2008 @@ -16,9 +16,12 @@ package org.wso2.mashup.transport; import org.apache.axis2.Constants; +import org.apache.axis2.transport.http.HTTPTransportUtils; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.mashup.MashupConstants; import org.wso2.mashup.utils.MashupUtils; import org.wso2.wsas.ServerManager; @@ -32,6 +35,9 @@ public class MashupServlet extends WSASServlet { + private static final int BUFFER_SIZE = 1024 * 8; + private static final Log log = LogFactory.getLog(MashupServlet.class); + /** * Implementation of DELETE interface * @@ -45,17 +51,53 @@ throws ServletException, IOException { initContextRoot(request); // this method is also used to serve for the listServices request. - processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_DELETE); + processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_DELETE, true); + } + + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + response.setBufferSize(BUFFER_SIZE); + } catch (Throwable t){ + log.info("Old Servlet API :" + t); + } + + initContextRoot(request); + if (HTTPTransportUtils.isRESTRequest(request.getContentType())) { + processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_POST, false); + } else { + super.doPost(request, response); + } + } + + /** + * Implementation of PUT interface + * + * @param request + * @param response + * @throws ServletException + * @throws IOException + */ + protected void doPut(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + + initContextRoot(request); + // this method is also used to serve for the listServices request. + if (!disableREST) { + processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_PUT, false); + } else { + showRestDisabledErrorMessage(response); + } } protected void handleRestRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_GET); + processRestRequest(request, response, Constants.Configuration.HTTP_METHOD_GET, true); } private void processRestRequest(HttpServletRequest request, HttpServletResponse response, - String httpMethodString) + String httpMethodString, boolean url) throws IOException, ServletException { if (!disableREST) { MashupRestRequestProcessor mashupRestRequestProcessor = @@ -76,7 +118,11 @@ serviceName.replaceFirst(MashupConstants.SEPARATOR_CHAR, "/"), serviceName)); } - mashupRestRequestProcessor.processURLRequest(); + if (url) { + mashupRestRequestProcessor.processURLRequest(); + } else { + mashupRestRequestProcessor.processXMLRequest(); + } } else { showRestDisabledErrorMessage(response); } @@ -89,10 +135,6 @@ super(httpMethodString, request, response); } - public void processURLRequest() throws IOException, ServletException { - super.processURLRequest(); - } - public MessageContext getMessageContext() { return messageContext; } _______________________________________________ Mashup-dev mailing list [email protected] http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
