org.apache.camel.component.http
Interface HttpBinding

All Known Implementing Classes:
DefaultHttpBinding

public interface HttpBinding

A plugable strategy for configuring the http binding so reading request and writing response can be customized using the Java Servlet API.

This is used by the camel-jetty.

Version:
$Revision: 787384 $

Method Summary
 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
 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.
 

Method Detail

readRequest

void readRequest(HttpServletRequest request,
                 HttpMessage message)
Startegy to read the given request and bindings it to the given message.

Parameters:
request - the request
message - the message to populate with data from request

parseBody

Object parseBody(HttpMessage httpMessage)
                 throws IOException
Parses the body from a HttpMessage

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

writeResponse

void writeResponse(Exchange exchange,
                   HttpServletResponse response)
                   throws IOException
Writes the exchange to the servlet response.

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

Parameters:
exchange - the exchange
response - the http response
Throws:
IOException - can be thrown from http response

doWriteExceptionResponse

void doWriteExceptionResponse(Throwable exception,
                              HttpServletResponse response)
                              throws IOException
Strategy method that writes the response to the http response stream when an exception occuerd

Parameters:
exception - the exception occured
response - the http response
Throws:
IOException - can be thrown from http response

doWriteFaultResponse

void doWriteFaultResponse(Message message,
                          HttpServletResponse response,
                          Exchange exchange)
                          throws IOException
Strategy method that writes the response to the http response stream for a fault message

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

void doWriteResponse(Message message,
                     HttpServletResponse response,
                     Exchange exchange)
                     throws IOException
Strategy method that writes the response to the http response stream for an OUT message

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

isUseReaderForPayload

boolean isUseReaderForPayload()

setUseReaderForPayload

void setUseReaderForPayload(boolean useReaderForPayload)
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.


getHeaderFilterStrategy

HeaderFilterStrategy getHeaderFilterStrategy()

setHeaderFilterStrategy

void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy)
Sets the header filter stratety to use.

Will default use HttpHeaderFilterStrategy



Apache CAMEL