public class DefaultHttpBinding extends Object implements HttpBinding
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT
The data format used for storing java.util.Date instances as a String value.
|
static String |
DATE_LOCALE_CONVERSION
Whether Date/Locale should be converted to String types (enabled by default)
|
| Constructor and Description |
|---|
DefaultHttpBinding() |
DefaultHttpBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
Deprecated.
|
DefaultHttpBinding(HttpCommonEndpoint endpoint)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkChunked(org.apache.camel.Message message,
org.apache.camel.Exchange exchange) |
protected boolean |
convertDateAndLocaleLocally(org.apache.camel.Exchange exchange) |
protected String |
convertHeaderValueToString(org.apache.camel.Exchange exchange,
Object headerValue) |
protected int |
copyStream(InputStream is,
OutputStream os,
int bufferSize) |
protected void |
doWriteDirectResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange) |
void |
doWriteExceptionResponse(Throwable exception,
javax.servlet.http.HttpServletResponse response)
Strategy method that writes the response to the http response stream when an exception occurred
|
void |
doWriteFaultResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
Strategy method that writes the response to the http response stream for a fault message
|
protected void |
doWriteGZIPResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange) |
void |
doWriteResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
Strategy method that writes the response to the http response stream for an OUT message
|
org.apache.camel.spi.HeaderFilterStrategy |
getHeaderFilterStrategy()
Gets the header filter strategy
|
protected static SimpleDateFormat |
getHttpDateFormat() |
boolean |
isAllowJavaSerializedObject()
Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object
This is by default turned off.
|
boolean |
isEagerCheckContentAvailable()
Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present.
|
boolean |
isMapHttpMessageBody()
Whether to allow Exchange Body HTTP mapping
|
boolean |
isMapHttpMessageFormUrlEncodedBody()
Whether to allow Exchange Form URL Encoded Body HTTP mapping
|
boolean |
isMapHttpMessageHeaders()
Whether to allow Exchange Headers HTTP mapping
|
protected boolean |
isText(String contentType) |
boolean |
isTransferException()
If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back
serialized in the response as a application/x-java-serialized-object content type (for example using Jetty or
Servlet Camel components).
|
boolean |
isUseReaderForPayload()
Should reader by used instead of input stream.
|
Object |
parseBody(HttpMessage httpMessage)
Parses the body from a
HttpMessage |
protected void |
populateAttachments(javax.servlet.http.HttpServletRequest request,
HttpMessage message) |
protected void |
populateRequestParameters(javax.servlet.http.HttpServletRequest request,
HttpMessage message) |
protected void |
readBody(javax.servlet.http.HttpServletRequest request,
HttpMessage message) |
protected void |
readFormUrlEncodedBody(javax.servlet.http.HttpServletRequest request,
HttpMessage message) |
protected void |
readHeaders(javax.servlet.http.HttpServletRequest request,
HttpMessage message) |
void |
readRequest(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
Strategy to read the given request and bindings it to the given message.
|
void |
setAllowJavaSerializedObject(boolean allowJavaSerializedObject)
Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object
This is by default turned off.
|
void |
setEagerCheckContentAvailable(boolean eagerCheckContentAvailable)
Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present.
|
void |
setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
Sets the header filter strategy to use.
|
void |
setMapHttpMessageBody(boolean mapHttpMessageBody)
Whether to allow Exchange Body HTTP mapping
This is by default turned on.
|
void |
setMapHttpMessageFormUrlEncodedBody(boolean mapHttpMessageFormUrlEncodedBody)
Whether to allow Exchange Form URL Encoded Body HTTP mapping
This is by default turned on.
|
void |
setMapHttpMessageHeaders(boolean mapHttpMessageHeaders)
Whether to allow Exchange Headers HTTP mapping
This is by default turned on.
|
void |
setTransferException(boolean transferException)
If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back
serialized in the response as a application/x-java-serialized-object content type (for example using Jetty or
Servlet Camel components).
|
void |
setUseReaderForPayload(boolean useReaderForPayload)
Should the
ServletRequest.getReader() be exposed as the payload of input messages in the Camel
Message.getBody() or not. |
protected static String |
toHttpDate(Date date) |
protected static String |
toHttpLanguage(Locale locale) |
void |
writeResponse(org.apache.camel.Exchange exchange,
javax.servlet.http.HttpServletResponse response)
Writes the exchange to the servlet response.
|
public static final String DATE_LOCALE_CONVERSION
public static final String DATE_FORMAT
public DefaultHttpBinding()
@Deprecated public DefaultHttpBinding(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
@Deprecated public DefaultHttpBinding(HttpCommonEndpoint endpoint)
public void readRequest(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
HttpBindingreadRequest in interface HttpBindingrequest - the requestmessage - the message to populate with data from requestprotected void readHeaders(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
protected void readBody(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
protected void populateRequestParameters(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
throws Exception
Exceptionprotected void readFormUrlEncodedBody(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
throws UnsupportedEncodingException
UnsupportedEncodingExceptionprotected void populateAttachments(javax.servlet.http.HttpServletRequest request,
HttpMessage message)
public void writeResponse(org.apache.camel.Exchange exchange,
javax.servlet.http.HttpServletResponse response)
throws IOException
HttpBindingwriteResponse in interface HttpBindingexchange - the exchangeresponse - the http responseIOException - can be thrown from http responsepublic void doWriteExceptionResponse(Throwable exception, javax.servlet.http.HttpServletResponse response) throws IOException
HttpBindingdoWriteExceptionResponse in interface HttpBindingexception - the exception occurredresponse - the http responseIOException - can be thrown from http responsepublic void doWriteFaultResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
throws IOException
HttpBindingdoWriteFaultResponse in interface HttpBindingmessage - the fault messageresponse - the http responseexchange - the exchange to provide context for header filteringIOException - can be thrown from http responsepublic void doWriteResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
throws IOException
HttpBindingdoWriteResponse in interface HttpBindingmessage - the OUT messageresponse - the http responseexchange - the exchange to provide context for header filteringIOException - can be thrown from http responseprotected String convertHeaderValueToString(org.apache.camel.Exchange exchange, Object headerValue)
protected boolean convertDateAndLocaleLocally(org.apache.camel.Exchange exchange)
protected boolean isText(String contentType)
protected int copyStream(InputStream is, OutputStream os, int bufferSize) throws IOException
IOExceptionprotected void doWriteDirectResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
throws IOException
IOExceptionprotected boolean checkChunked(org.apache.camel.Message message,
org.apache.camel.Exchange exchange)
protected void doWriteGZIPResponse(org.apache.camel.Message message,
javax.servlet.http.HttpServletResponse response,
org.apache.camel.Exchange exchange)
throws IOException
IOExceptionpublic Object parseBody(HttpMessage httpMessage) throws IOException
HttpBindingHttpMessageparseBody in interface HttpBindinghttpMessage - the http messageInputStream or a Reader
depending on the HttpBinding.setUseReaderForPayload(boolean) property.IOException - can be thrownpublic boolean isUseReaderForPayload()
HttpBindingisUseReaderForPayload in interface HttpBindingfor more detailspublic void setUseReaderForPayload(boolean useReaderForPayload)
HttpBindingServletRequest.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.
Is default false.setUseReaderForPayload in interface HttpBindinguseReaderForPayload - whether to use reader or notpublic boolean isEagerCheckContentAvailable()
HttpBindingisEagerCheckContentAvailable in interface HttpBindingpublic void setEagerCheckContentAvailable(boolean eagerCheckContentAvailable)
HttpBindingsetEagerCheckContentAvailable in interface HttpBindingpublic boolean isTransferException()
HttpBindingisTransferException in interface HttpBindingpublic void setTransferException(boolean transferException)
HttpBindingsetTransferException in interface HttpBindingpublic boolean isAllowJavaSerializedObject()
HttpBindingisAllowJavaSerializedObject in interface HttpBindingpublic void setAllowJavaSerializedObject(boolean allowJavaSerializedObject)
HttpBindingsetAllowJavaSerializedObject in interface HttpBindingallowJavaSerializedObject - true to allow serializing java objectspublic org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
HttpBindinggetHeaderFilterStrategy in interface HttpBindingpublic void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy)
HttpBindingHttpHeaderFilterStrategysetHeaderFilterStrategy in interface HttpBindingheaderFilterStrategy - the custom strategypublic boolean isMapHttpMessageBody()
HttpBindingisMapHttpMessageBody in interface HttpBindingpublic void setMapHttpMessageBody(boolean mapHttpMessageBody)
HttpBindingsetMapHttpMessageBody in interface HttpBindingpublic boolean isMapHttpMessageHeaders()
HttpBindingisMapHttpMessageHeaders in interface HttpBindingpublic void setMapHttpMessageHeaders(boolean mapHttpMessageHeaders)
HttpBindingsetMapHttpMessageHeaders in interface HttpBindingpublic boolean isMapHttpMessageFormUrlEncodedBody()
HttpBindingisMapHttpMessageFormUrlEncodedBody in interface HttpBindingpublic void setMapHttpMessageFormUrlEncodedBody(boolean mapHttpMessageFormUrlEncodedBody)
HttpBindingsetMapHttpMessageFormUrlEncodedBody in interface HttpBindingprotected static SimpleDateFormat getHttpDateFormat()
Apache Camel