org.apache.camel.component.http
Class DefaultHttpBinding

java.lang.Object
  extended by org.apache.camel.component.http.DefaultHttpBinding
All Implemented Interfaces:
HttpBinding

public class DefaultHttpBinding
extends Object
implements HttpBinding

Binding between HttpMessage and HttpServletResponse.

Version:
$Revision: 793361 $

Constructor Summary
DefaultHttpBinding()
           
DefaultHttpBinding(HeaderFilterStrategy headerFilterStrategy)
           
 
Method Summary
protected  void doWriteDirectResponse(Message message, HttpServletResponse response, Exchange exchange)
           
 void doWriteExceptionResponse(Throwable exception, HttpServletResponse response)
          Strategy method that writes the response to the http response stream when an exception occuerd
 void doWriteFaultResponse(Message message, HttpServletResponse response, Exchange exchange)
          Strategy method that writes the response to the http response stream for a fault message
protected  void doWriteGZIPResponse(Message message, HttpServletResponse response, Exchange exchange)
           
 void doWriteResponse(Message message, HttpServletResponse response, Exchange exchange)
          Strategy method that writes the response to the http response stream for an OUT message
 HeaderFilterStrategy getHeaderFilterStrategy()
           
 boolean isUseReaderForPayload()
           
 Object parseBody(HttpMessage httpMessage)
          Parses the body from a HttpMessage
 void readRequest(HttpServletRequest request, HttpMessage message)
          Startegy to read the given request and bindings it to the given message.
 void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy)
          Sets the header filter stratety to use.
 void setUseReaderForPayload(boolean useReaderForPayload)
          Should the ServletRequest.getReader() be exposed as the payload of input messages in the Camel Message.getBody() or not.
 void writeResponse(Exchange exchange, HttpServletResponse response)
          Writes the exchange to the servlet response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHttpBinding

public DefaultHttpBinding()

DefaultHttpBinding

public DefaultHttpBinding(HeaderFilterStrategy headerFilterStrategy)
Method Detail

readRequest

public void readRequest(HttpServletRequest request,
                        HttpMessage message)
Description copied from interface: HttpBinding
Startegy to read the given request and bindings it to the given message.

Specified by:
readRequest in interface HttpBinding
Parameters:
request - the request
message - the message to populate with data from request

writeResponse

public void writeResponse(Exchange exchange,
                          HttpServletResponse response)
                   throws IOException
Description copied from interface: HttpBinding
Writes the exchange to the servlet response.

Default implementation will delegate to the following methods depending on the status of the exchange

Specified by:
writeResponse in interface HttpBinding
Parameters:
exchange - the exchange
response - the http response
Throws:
IOException - can be thrown from http response

doWriteExceptionResponse

public void doWriteExceptionResponse(Throwable exception,
                                     HttpServletResponse response)
                              throws IOException
Description copied from interface: HttpBinding
Strategy method that writes the response to the http response stream when an exception occuerd

Specified by:
doWriteExceptionResponse in interface HttpBinding
Parameters:
exception - the exception occured
response - the http response
Throws:
IOException - can be thrown from http response

doWriteFaultResponse

public void doWriteFaultResponse(Message message,
                                 HttpServletResponse response,
                                 Exchange exchange)
                          throws IOException
Description copied from interface: HttpBinding
Strategy method that writes the response to the http response stream for a fault message

Specified by:
doWriteFaultResponse in interface HttpBinding
Parameters:
message - the fault message
response - the http response
exchange - the exchange to provide context for header filtering
Throws:
IOException - can be thrown from http response

doWriteResponse

public void doWriteResponse(Message message,
                            HttpServletResponse response,
                            Exchange exchange)
                     throws IOException
Description copied from interface: HttpBinding
Strategy method that writes the response to the http response stream for an OUT message

Specified by:
doWriteResponse in interface HttpBinding
Parameters:
message - the OUT message
response - the http response
exchange - the exchange to provide context for header filtering
Throws:
IOException - can be thrown from http response

doWriteDirectResponse

protected void doWriteDirectResponse(Message message,
                                     HttpServletResponse response,
                                     Exchange exchange)
                              throws IOException
Throws:
IOException

doWriteGZIPResponse

protected void doWriteGZIPResponse(Message message,
                                   HttpServletResponse response,
                                   Exchange exchange)
                            throws IOException
Throws:
IOException

parseBody

public Object parseBody(HttpMessage httpMessage)
                 throws IOException
Description copied from interface: HttpBinding
Parses the body from a HttpMessage

Specified by:
parseBody in interface HttpBinding
Returns:
the parsed body returned as either a InputStream or a Reader depending on the HttpBinding.setUseReaderForPayload(boolean) property.
Throws:
IOException - can be thrown

isUseReaderForPayload

public boolean isUseReaderForPayload()
Specified by:
isUseReaderForPayload in interface HttpBinding

setUseReaderForPayload

public void setUseReaderForPayload(boolean useReaderForPayload)
Description copied from interface: HttpBinding
Should the ServletRequest.getReader() be exposed as the payload of input messages in the Camel Message.getBody() or not. If false then the ServletRequest.getInputStream() will be exposed.

Specified by:
setUseReaderForPayload in interface HttpBinding

getHeaderFilterStrategy

public HeaderFilterStrategy getHeaderFilterStrategy()
Specified by:
getHeaderFilterStrategy in interface HttpBinding

setHeaderFilterStrategy

public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy)
Description copied from interface: HttpBinding
Sets the header filter stratety to use.

Will default use HttpHeaderFilterStrategy

Specified by:
setHeaderFilterStrategy in interface HttpBinding


Apache CAMEL