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:
Endpoint, HttpEndpointType, HttpProcessor
Direct Known Subclasses:
HttpSoapConsumerEndpoint

public class HttpConsumerEndpoint
extends 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

Nested Class Summary
protected static class HttpConsumerEndpoint.LateResponseStrategy
          Determines how the HTTP consumer endpoint should handle a late response from the NMR
 
Field Summary
static java.lang.String MAIN_WSDL
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
logger
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, service, serviceUnit
 
Constructor Summary
HttpConsumerEndpoint()
           
HttpConsumerEndpoint(DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
HttpConsumerEndpoint(ServiceUnit serviceUnit, javax.xml.namespace.QName service, java.lang.String endpoint)
           
 
Method Summary
 void activate()
           
protected  void addResource(java.lang.String path, java.lang.Object resource)
           
 javax.jbi.messaging.MessageExchange createExchange(javax.servlet.http.HttpServletRequest request)
           
 void deactivate()
           
 java.lang.String getAuthMethod()
          Returns a string describing the authentication scheme being used by an endpoint.
 java.net.URI getDefaultMep()
          Returns a URI representing the default message exachange pattern(MEP) used by an endpoint.
 java.lang.String getLateResponseStrategy()
           
 java.lang.String getLocationURI()
          Returns the URI at which the endpoint listens for new requests.
 HttpConsumerMarshaler getMarshaler()
           
protected  java.lang.Object getResource(java.lang.String path)
           
protected  ContextManager getServerManager()
           
 SslParameters getSsl()
           
 long getTimeout()
          Returns the timeout value for an HTTP endpoint.
protected  boolean handleStaticResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle static resources
 boolean isRewriteSoapAddress()
           
protected  void loadStaticResources()
           
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
 void sendAccepted(javax.jbi.messaging.MessageExchange exchange, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void sendError(javax.jbi.messaging.MessageExchange exchange, java.lang.Exception error, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void sendFault(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.Fault fault, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void sendOut(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage outMsg, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void setAuthMethod(java.lang.String authMethod)
          Specifies the authentication method used by a secure endpoint.
 void setDefaultMep(java.net.URI defaultMep)
          Sets the default message exchange pattern(MEP) for an endpoint.
 void setLateResponseStrategy(java.lang.String value)
          Set the strategy to be used for handling a late response from the ESB (i.e.
 void setLocationURI(java.lang.String locationURI)
          Sets the URI at which an endpoint listens for requests.
 void setMarshaler(HttpConsumerMarshaler marshaler)
          Sets the class used to marshal messages.
 void setRewriteSoapAddress(boolean value)
          Toggles the rewriting of the soap address based on the request info.
 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()
           
protected  void updateSoapLocations(java.lang.String location, org.w3c.dom.NodeList addresses)
           
 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 java.lang.String MAIN_WSDL
See Also:
Constant Field Values
Constructor Detail

HttpConsumerEndpoint

public HttpConsumerEndpoint()

HttpConsumerEndpoint

public HttpConsumerEndpoint(DefaultComponent component,
                            javax.jbi.servicedesc.ServiceEndpoint endpoint)

HttpConsumerEndpoint

public HttpConsumerEndpoint(ServiceUnit serviceUnit,
                            javax.xml.namespace.QName service,
                            java.lang.String endpoint)
Method Detail

getLocationURI

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

Overrides:
getLocationURI in class ConsumerEndpoint
Returns:
a string representing the endpoint's URI

setLocationURI

public void setLocationURI(java.lang.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 java.lang.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(java.lang.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 java.net.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(java.net.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

getLateResponseStrategy

public java.lang.String getLateResponseStrategy()

setLateResponseStrategy

public void setLateResponseStrategy(java.lang.String value)
Set the strategy to be used for handling a late response from the ESB (i.e. a response that arrives after the HTTP request has timed out). Defaults to error

Parameters:
value -

isRewriteSoapAddress

public boolean isRewriteSoapAddress()

setRewriteSoapAddress

public void setRewriteSoapAddress(boolean value)
Toggles the rewriting of the soap address based on the request info.

When active, the soap address in the wsdl will be updated according to the protocol, host and port of the request. This is useful when listening on 0.0.0.0 or when behind a NAT (or reverse-proxy in some cases).
This function only works on the main wsdl, not in imported wsdl-parts. This means the service with its port must be declared in the main wsdl.

By default it is activated.

Parameters:
value -

activate

public void activate()
              throws java.lang.Exception
Specified by:
activate in interface Endpoint
Overrides:
activate in class ConsumerEndpoint
Throws:
java.lang.Exception

deactivate

public void deactivate()
                throws java.lang.Exception
Specified by:
deactivate in interface Endpoint
Overrides:
deactivate in class ConsumerEndpoint
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Endpoint
Overrides:
start in class SimpleEndpoint
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Endpoint
Overrides:
stop in class SimpleEndpoint
Throws:
java.lang.Exception

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws java.lang.Exception
Specified by:
process in interface Endpoint
Specified by:
process in class AbstractEndpoint
Throws:
java.lang.Exception

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.lang.Exception
Specified by:
process in interface HttpProcessor
Throws:
java.lang.Exception

loadStaticResources

protected void loadStaticResources()
                            throws java.lang.Exception
Throws:
java.lang.Exception

handleStaticResource

protected boolean handleStaticResource(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws java.io.IOException,
                                       javax.servlet.ServletException
Handle static resources

Parameters:
request - the http request
response - the http response
Returns:
true if the request has been handled
Throws:
java.io.IOException
javax.servlet.ServletException

getResource

protected java.lang.Object getResource(java.lang.String path)

addResource

protected void addResource(java.lang.String path,
                           java.lang.Object resource)

getServerManager

protected ContextManager getServerManager()

createExchange

public javax.jbi.messaging.MessageExchange createExchange(javax.servlet.http.HttpServletRequest request)
                                                   throws java.lang.Exception
Throws:
java.lang.Exception

sendAccepted

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

sendError

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

sendFault

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

sendOut

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

validate

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

updateSoapLocations

protected void updateSoapLocations(java.lang.String location,
                                   org.w3c.dom.NodeList addresses)


Copyright © 2005-2012 FuseSource. All Rights Reserved.