org.apache.synapse.transport.passthru

## Class ServerWorker

- java.lang.Object
- - org.apache.synapse.transport.passthru.ServerWorker

- All Implemented Interfaces:
    Runnable

      public class ServerWorker
      extends Object
      implements Runnable

  This is a worker thread for executing an incoming request in to the transport.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerWorker(SourceRequest request, SourceConfiguration sourceConfiguration, OutputStream os)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.axis2.context.MessageContext` | `createMessageContext(org.apache.axis2.context.MessageContext msgContext, SourceRequest request)` Create an Axis2 message context for the given http request.
    `protected org.apache.axis2.context.MessageContext` | `getRequestContext()`
    `SourceConfiguration` | `getSourceConfiguration()` Get the shared pass-through source configuration
    `SourceRequest` | `getSourceRequest()`
    `org.apache.axiom.soap.SOAPEnvelope` | `handleRESTUrlPost(String contentTypeHdr)` Method will setup the necessary parameters for the rest url post action
    `boolean` | `isRESTRequest(org.apache.axis2.context.MessageContext msgContext, String method)` Adding REST related properties to the message context if request is REST
    `void` | `processEntityEnclosingRequest(org.apache.axis2.context.MessageContext msgContext, boolean injectToAxis2Engine)`
    `void` | `processHttpRequestUri(org.apache.axis2.context.MessageContext msgContext, String method)` Get Uri of underlying SourceRequest and calculate service prefix and add to message context create response buffers for HTTP GET, DELETE, OPTION and HEAD methods
    `void` | `processNonEntityEnclosingRESTHandler(org.apache.axiom.soap.SOAPEnvelope soapEnvelope, org.apache.axis2.context.MessageContext msgContext, boolean injectToAxis2Engine)`
    `void` | `run()`
    `void` | `sendAck(org.apache.axis2.context.MessageContext msgContext)`
    `void` | `setSourceRequest(SourceRequest request)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServerWorker

          public ServerWorker(SourceRequest request,
                              SourceConfiguration sourceConfiguration,
                              OutputStream os)

  - ### Method Detail

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### handleRESTUrlPost

          public org.apache.axiom.soap.SOAPEnvelope handleRESTUrlPost(String contentTypeHdr)
                                                               throws FactoryConfigurationError

      Method will setup the necessary parameters for the rest url post action
      Parameters:
        -
      Returns:
      Throws:
        `FactoryConfigurationError`

    - #### sendAck

          public void sendAck(org.apache.axis2.context.MessageContext msgContext)

    - #### processNonEntityEnclosingRESTHandler

          public void processNonEntityEnclosingRESTHandler(org.apache.axiom.soap.SOAPEnvelope soapEnvelope,
                                                           org.apache.axis2.context.MessageContext msgContext,
                                                           boolean injectToAxis2Engine)

    - #### processEntityEnclosingRequest

          public void processEntityEnclosingRequest(org.apache.axis2.context.MessageContext msgContext,
                                                    boolean injectToAxis2Engine)

    - #### createMessageContext

          public org.apache.axis2.context.MessageContext createMessageContext(org.apache.axis2.context.MessageContext msgContext,
                                                                              SourceRequest request)

      Create an Axis2 message context for the given http request. The request may be in the process of being streamed
      Parameters:
        `request` - the http request to be used to create the corresponding Axis2 message context
      Returns:
        the Axis2 message context created

    - #### getRequestContext

          protected org.apache.axis2.context.MessageContext getRequestContext()

    - #### getSourceRequest

          public SourceRequest getSourceRequest()

      Returns:
        Get SourceRequest Processed by ServerWorker

    - #### setSourceRequest

          public void setSourceRequest(SourceRequest request)

      Parameters:
        `request` - Set SourceRequest to be processed by ServerWorker

    - #### isRESTRequest

          public boolean isRESTRequest(org.apache.axis2.context.MessageContext msgContext,
                                       String method)

      Adding REST related properties to the message context if request is REST
      Parameters:
        `msgContext` - Axis2MessageContext of the request
        `method` - HTTP Method of the request
      Returns:
        whether request is REST or SOAP

    - #### processHttpRequestUri

          public void processHttpRequestUri(org.apache.axis2.context.MessageContext msgContext,
                                            String method)

      Get Uri of underlying SourceRequest and calculate service prefix and add to message context create response buffers for HTTP GET, DELETE, OPTION and HEAD methods
      Parameters:
        `msgContext` - Axis2MessageContext of the request
        `method` - HTTP Method of the request

    - #### getSourceConfiguration

          public SourceConfiguration getSourceConfiguration()

      Get the shared pass-through source configuration
      Returns:
        source configuration

Copyright © 2005–2017 Apache Software Foundation. All rights reserved.