org.apache.servicemix.http.endpoints
Class HttpConsumerEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ConsumerEndpoint
              extended by org.apache.servicemix.http.endpoints.HttpConsumerEndpoint
All Implemented Interfaces:
org.apache.servicemix.common.Endpoint, HttpEndpointType, HttpProcessor
Direct Known Subclasses:
HttpSoapConsumerEndpoint

public class HttpConsumerEndpoint
extends org.apache.servicemix.common.endpoints.ConsumerEndpoint
implements HttpProcessor, HttpEndpointType

Plain HTTP consumer endpoint. This endpoint can be used to handle plain HTTP request (without SOAP) or to be able to process the request in a non standard way. For HTTP requests, a WSDL2 HTTP binding can be used.

Since:
3.2
Author:
gnodet

Field Summary
static String MAIN_WSDL
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
HttpConsumerEndpoint()
           
HttpConsumerEndpoint(org.apache.servicemix.common.DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
HttpConsumerEndpoint(org.apache.servicemix.common.ServiceUnit serviceUnit, QName service, String endpoint)
           
 
Method Summary
 void activate()
           
protected  void addResource(String path, Object resource)
           
 javax.jbi.messaging.MessageExchange createExchange(HttpServletRequest request)
           
 void deactivate()
           
 String getAuthMethod()
          Returns a string describing the authentication scheme being used by an endpoint.
 URI getDefaultMep()
          Returns a URI representing the default message exachange pattern(MEP) used by an endpoint.
 String getLocationURI()
          Returns the URI at which the endpoint listens for new requests.
 HttpConsumerMarshaler getMarshaler()
           
protected  Object getResource(String path)
           
protected  ContextManager getServerManager()
           
 SslParameters getSsl()
           
 long getTimeout()
          Returns the timeout value for an HTTP endpoint.
protected  boolean handleStaticResource(HttpServletRequest request, HttpServletResponse response)
          Handle static resources
protected  void loadStaticResources()
           
 void process(HttpServletRequest request, HttpServletResponse response)
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
 void sendAccepted(javax.jbi.messaging.MessageExchange exchange, HttpServletRequest request, HttpServletResponse response)
           
 void sendError(javax.jbi.messaging.MessageExchange exchange, Exception error, HttpServletRequest request, HttpServletResponse response)
           
 void sendFault(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.Fault fault, HttpServletRequest request, HttpServletResponse response)
           
 void sendOut(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage outMsg, HttpServletRequest request, HttpServletResponse response)
           
 void setAuthMethod(String authMethod)
          Specifies the authentication method used by a secure endpoint.
 void setDefaultMep(URI defaultMep)
          Sets the default message exchange pattern(MEP) for an endpoint.
 void setLocationURI(String locationURI)
          Sets the URI at which an endpoint listens for requests.
 void setMarshaler(HttpConsumerMarshaler marshaler)
          Sets the class used to marshal messages.
 void setSsl(SslParameters ssl)
          Sets the properties used to configure SSL for the endpoint.
 void setTimeout(long timeout)
          Specifies the timeout value for an HTTP consumer endpoint.
 void start()
           
 void stop()
           
 void validate()
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.ConsumerEndpoint
configureExchangeTarget, getRole, getTargetEndpoint, getTargetInterface, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAIN_WSDL

public static final String MAIN_WSDL
See Also:
Constant Field Values
Constructor Detail

HttpConsumerEndpoint

public HttpConsumerEndpoint()

HttpConsumerEndpoint

public HttpConsumerEndpoint(org.apache.servicemix.common.DefaultComponent component,
                            javax.jbi.servicedesc.ServiceEndpoint endpoint)

HttpConsumerEndpoint

public HttpConsumerEndpoint(org.apache.servicemix.common.ServiceUnit serviceUnit,
                            QName service,
                            String endpoint)
Method Detail

getLocationURI

public String getLocationURI()
Returns the URI at which the endpoint listens for new requests.

Overrides:
getLocationURI in class org.apache.servicemix.common.endpoints.ConsumerEndpoint
Returns:
a string representing the endpoint's URI

setLocationURI

public void setLocationURI(String locationURI)
Sets the URI at which an endpoint listens for requests.

Parameters:
locationURI - a string representing the URI

getTimeout

public long getTimeout()
Returns the timeout value for an HTTP endpoint.

Returns:
the timeout specified in milliseconds

setTimeout

public void setTimeout(long timeout)
Specifies the timeout value for an HTTP consumer endpoint. The timeout is specified in milliseconds. The default value is 0 which means that the endpoint will never timeout.

Parameters:
timeout - the length time, in milliseconds, to wait before timing out

getMarshaler

public HttpConsumerMarshaler getMarshaler()
Returns:
the marshaler

setMarshaler

public void setMarshaler(HttpConsumerMarshaler marshaler)
Sets the class used to marshal messages.

Parameters:
marshaler - the marshaler to set

getAuthMethod

public String getAuthMethod()
Returns a string describing the authentication scheme being used by an endpoint.

Specified by:
getAuthMethod in interface HttpProcessor
Returns:
a string representing the authentication method used by an endpoint

setAuthMethod

public void setAuthMethod(String authMethod)
Specifies the authentication method used by a secure endpoint. The authentication method is a string naming the scheme used for authenticating users.

Parameters:
authMethod - a string naming the authentication scheme a secure endpoint should use

getSsl

public SslParameters getSsl()
Specified by:
getSsl in interface HttpProcessor
Returns:
the sslParameters

setSsl

public void setSsl(SslParameters ssl)
Sets the properties used to configure SSL for the endpoint.

Parameters:
ssl - an SslParameters object containing the SSL properties

getDefaultMep

public URI getDefaultMep()
Returns a URI representing the default message exachange pattern(MEP) used by an endpoint.

Returns:
a URI representing an endpoint's default MEP

setDefaultMep

public void setDefaultMep(URI defaultMep)
Sets the default message exchange pattern(MEP) for an endpoint. The default MEP is specified as a URI and the default is JbiConstants.IN_OUT.

Parameters:
defaultMep - a URI representing the default MEP of the endpoint

activate

public void activate()
              throws Exception
Specified by:
activate in interface org.apache.servicemix.common.Endpoint
Overrides:
activate in class org.apache.servicemix.common.endpoints.ConsumerEndpoint
Throws:
Exception

deactivate

public void deactivate()
                throws Exception
Specified by:
deactivate in interface org.apache.servicemix.common.Endpoint
Overrides:
deactivate in class org.apache.servicemix.common.endpoints.ConsumerEndpoint
Throws:
Exception

start

public void start()
           throws Exception
Specified by:
start in interface org.apache.servicemix.common.Endpoint
Overrides:
start in class org.apache.servicemix.common.endpoints.SimpleEndpoint
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface org.apache.servicemix.common.Endpoint
Overrides:
stop in class org.apache.servicemix.common.endpoints.SimpleEndpoint
Throws:
Exception

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws Exception
Specified by:
process in interface org.apache.servicemix.common.Endpoint
Specified by:
process in class org.apache.servicemix.common.endpoints.AbstractEndpoint
Throws:
Exception

process

public void process(HttpServletRequest request,
                    HttpServletResponse response)
             throws Exception
Specified by:
process in interface HttpProcessor
Throws:
Exception

loadStaticResources

protected void loadStaticResources()

handleStaticResource

protected boolean handleStaticResource(HttpServletRequest request,
                                       HttpServletResponse response)
                                throws IOException,
                                       ServletException
Handle static resources

Parameters:
request - the http request
response - the http response
Returns:
true if the request has been handled
Throws:
IOException
ServletException

getResource

protected Object getResource(String path)

addResource

protected void addResource(String path,
                           Object resource)

getServerManager

protected ContextManager getServerManager()

createExchange

public javax.jbi.messaging.MessageExchange createExchange(HttpServletRequest request)
                                                   throws Exception
Throws:
Exception

sendAccepted

public void sendAccepted(javax.jbi.messaging.MessageExchange exchange,
                         HttpServletRequest request,
                         HttpServletResponse response)
                  throws Exception
Throws:
Exception

sendError

public void sendError(javax.jbi.messaging.MessageExchange exchange,
                      Exception error,
                      HttpServletRequest request,
                      HttpServletResponse response)
               throws Exception
Throws:
Exception

sendFault

public void sendFault(javax.jbi.messaging.MessageExchange exchange,
                      javax.jbi.messaging.Fault fault,
                      HttpServletRequest request,
                      HttpServletResponse response)
               throws Exception
Throws:
Exception

sendOut

public void sendOut(javax.jbi.messaging.MessageExchange exchange,
                    javax.jbi.messaging.NormalizedMessage outMsg,
                    HttpServletRequest request,
                    HttpServletResponse response)
             throws Exception
Throws:
Exception

validate

public void validate()
              throws javax.jbi.management.DeploymentException
Specified by:
validate in interface org.apache.servicemix.common.Endpoint
Overrides:
validate in class org.apache.servicemix.common.endpoints.ConsumerEndpoint
Throws:
javax.jbi.management.DeploymentException


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.