/** * Whether the original request received by the synapse is REST * * @param originalInMsgCtx request message * @return <code>true</code> if the request was a REST request */ private static boolean isRequestRest(org.apache.axis2.context.MessageContext originalInMsgCtx) { boolean isRestRequest = originalInMsgCtx.getProperty(NhttpConstants.REST_REQUEST_CONTENT_TYPE) != null; if (!isRestRequest) { String httpMethod = (String) originalInMsgCtx.getProperty( Constants.Configuration.HTTP_METHOD); isRestRequest = Constants.Configuration.HTTP_METHOD_GET.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_DELETE.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_PUT.equals(httpMethod) || RESTConstants.METHOD_OPTIONS.equals(httpMethod); if (!isRestRequest) { isRestRequest = Constants.Configuration.HTTP_METHOD_POST.equals(httpMethod) && HTTPTransportUtils.isRESTRequest( String.valueOf(originalInMsgCtx.getProperty( Constants.Configuration.MESSAGE_TYPE))); } } return isRestRequest; }
public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { if (port == -1) { throw new AxisFault("Port number for transport " + scheme + " has not yet been detected"); } return HTTPTransportUtils.getEPRsForService(configurationContext, transportInDescription, serviceName, ip, port); }
public void processExplicitSchemaAndWSDL(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap<String, AxisService> services = configContext.getAxisConfiguration().getServices(); String filePart = req.getRequestURL().toString(); String schema = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length()); if ((services != null) && !services.isEmpty()) { Iterator<AxisService> i = services.values().iterator(); while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = HTTPTransportUtils.getMetaInfResourceAsStream(service, schema); if (stream != null) { OutputStream out = res.getOutputStream(); res.setContentType("text/xml"); IOUtils.copy(stream, out, true); return; } } } }
/** * */ private void processEntityEnclosingMethod() { try { Header contentType = request.getFirstHeader(HTTP.CONTENT_TYPE); String contentTypeStr = contentType != null ? contentType.getValue() : inferContentType(); String charSetEncoding = BuilderUtil.getCharSetEncoding(contentTypeStr); msgContext.setProperty( Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); if (HTTPTransportUtils.isRESTRequest(contentTypeStr) || isRest(contentTypeStr)) { RESTUtil.processPOSTRequest(msgContext, is, os, request.getRequestLine().getUri(), contentTypeStr, isRestDispatching); } else { Header soapAction = request.getFirstHeader(SOAPACTION); HTTPTransportUtils.processHTTPPostRequest( msgContext, is, os, contentTypeStr, (soapAction != null ? soapAction.getValue() : null), request.getRequestLine().getUri()); } } catch (Exception e) { handleException("Error processing POST request ", e); } }
while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = HTTPTransportUtils.getMetaInfResourceAsStream(service, file); if (stream != null) { OutputStream out = response.getOutputStream(); return; } else { InputStream instream = HTTPTransportUtils.getMetaInfResourceAsStream(service, schemaName); if (HTTPTransportUtils.isRESTRequest(contentType)) { pi = RESTUtil.processXMLRequest( msgContext, uri = ip + uri; pi = HTTPTransportUtils.processHTTPPostRequest( msgContext, request.getInputStream(),
int soapVersion = VERSION_UNKNOWN; try { soapVersion = initializeMessageContext(msgContext, soapActionHeader, requestURI, contentType); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); TransportUtils.createSOAPMessage( msgContext, handleGZip(msgContext, in), contentType)); return AxisEngine.receive(msgContext);
msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, contentType); if (contentTypeHeader == null || HTTPTransportUtils.isRESTRequest(contentTypeHeader) || isRest(contentTypeHeader)) { msgContext.setProperty(PassThroughConstants.REST_REQUEST_CONTENT_TYPE, contentType); msgContext.setDoingREST(true); initializeMessageContext(msgContext, soapAction, request.getUri(), contentTypeHeader); SOAPEnvelope envelope;
envelope = TransportUtils.createSOAPMessage( responseMsgCtx, HTTPTransportUtils.handleGZip(responseMsgCtx, in), contentType);
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); msgContext.setServerSide(true); SOAPEnvelope envelope = HTTPTransportUtils.createEnvelopeFromGetRequest(requestURI, requestParameters, configurationContext);
OutputStream out = response.getOutputStream(); String contentType = request.getContentType(); if (!HTTPTransportUtils.isRESTRequest(contentType)) { msgContext = createMessageContext(request, response); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType); processHTTPPostRequest(msgContext, new BufferedInputStream(request.getInputStream()), bufferedOut,
while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = HTTPTransportUtils.getMetaInfResourceAsStream(service, file); if (stream != null) { OutputStream out = response.getOutputStream(); return; } else { InputStream instream = HTTPTransportUtils.getMetaInfResourceAsStream(service, schemaName); if (HTTPTransportUtils.isRESTRequest(contentType)) { pi = RESTUtil.processXMLRequest( msgContext, uri = ip + uri; pi = HTTPTransportUtils.processHTTPPostRequest( msgContext, request.getInputStream(),
int soapVersion = VERSION_UNKNOWN; try { soapVersion = initializeMessageContext(msgContext, soapActionHeader, requestURI, contentType); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); TransportUtils.createSOAPMessage( msgContext, handleGZip(msgContext, in), contentType, builder)); return AxisEngine.receive(msgContext);
msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); dispatchAndVerify(msgContext); in = HTTPTransportUtils.handleGZip(msgContext, in); SOAPEnvelope soapEnvelope; if (msgContext.getAxisService() == null) {
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); msgContext.setServerSide(true); SOAPEnvelope envelope = HTTPTransportUtils.createEnvelopeFromGetRequest(requestURI, requestParameters, configurationContext);
OutputStream out = response.getOutputStream(); String contentType = request.getContentType(); if (!HTTPTransportUtils.isRESTRequest(contentType)) { msgContext = createMessageContext(request, response); msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType); processHTTPPostRequest(msgContext, new BufferedInputStream(request.getInputStream()), bufferedOut,
int soapVersion = VERSION_UNKNOWN; try { soapVersion = initializeMessageContext(msgContext, soapActionHeader, requestURI, contentType); msgContext.setProperty(MessageContext.TRANSPORT_OUT, out); TransportUtils.createSOAPMessage( msgContext, handleGZip(msgContext, in), contentType, builder)); return AxisEngine.receive(msgContext);
&& HTTPTransportUtils.isRESTRequest( String.valueOf(originalInMsgCtx.getProperty( Constants.Configuration.MESSAGE_TYPE)));
msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding); dispatchAndVerify(msgContext); in = HTTPTransportUtils.handleGZip(msgContext, in); SOAPEnvelope soapEnvelope; if (msgContext.getAxisService() == null) {
public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault { if (port == -1) { throw new AxisFault("Port number for transport " + scheme + " has not yet been detected"); } return HTTPTransportUtils.getEPRsForService(configurationContext, transportInDescription, serviceName, ip, port); }
public void processExplicitSchemaAndWSDL(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { HashMap<String, AxisService> services = configContext.getAxisConfiguration().getServices(); String filePart = req.getRequestURL().toString(); String schema = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length()); if ((services != null) && !services.isEmpty()) { Iterator<AxisService> i = services.values().iterator(); while (i.hasNext()) { AxisService service = (AxisService) i.next(); InputStream stream = HTTPTransportUtils.getMetaInfResourceAsStream(service, schema); if (stream != null) { OutputStream out = res.getOutputStream(); res.setContentType("text/xml"); IOUtils.copy(stream, out, true); return; } } } }