public class GHttpBinding extends Object implements OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>, InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
HTTPRequest
/HTTPResponse
pair of the URL fetch
service to a Camel Exchange
.Constructor and Description |
---|
GHttpBinding() |
Modifier and Type | Method and Description |
---|---|
protected com.google.appengine.api.urlfetch.HTTPMethod |
getRequestMethod(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange) |
protected URL |
getRequestUrl(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange) |
protected String |
getResponseHeader(String name,
com.google.appengine.api.urlfetch.HTTPResponse response) |
org.apache.camel.Exchange |
readRequest(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
javax.servlet.http.HttpServletRequest request)
Populates an
Exchange from request data and endpoint configuration data. |
protected void |
readRequestHeaders(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
javax.servlet.http.HttpServletRequest request) |
org.apache.camel.Exchange |
readResponse(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPResponse response)
Reads data from
response and writes it to the out-message of
the exchange . |
protected void |
readResponseBody(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPResponse response) |
protected void |
readResponseHeaders(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPResponse response) |
com.google.appengine.api.urlfetch.HTTPRequest |
writeRequest(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPRequest request)
Reads data from
exchange and writes it to a newly created
HTTPRequest instance. |
protected void |
writeRequestBody(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPRequest request) |
protected void |
writeRequestHeaders(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
com.google.appengine.api.urlfetch.HTTPRequest request) |
javax.servlet.http.HttpServletResponse |
writeResponse(GHttpEndpoint endpoint,
org.apache.camel.Exchange exchange,
javax.servlet.http.HttpServletResponse response)
Creates or populates a response object from
Exchange and endpoint configuration data. |
public org.apache.camel.Exchange readResponse(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPResponse response) throws Exception
response
and writes it to the out-message of
the exchange
.readResponse
in interface OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>
endpoint
- endpoint providing binding-relevant information.exchange
- exchange to be populated or created (if null
) from response data.response
- response to read data from.exchange
instance populated with response data.GHttpException
- if the response code is >= 400 and
HttpEndpoint.isThrowExceptionOnFailure()
returns
true
.Exception
public com.google.appengine.api.urlfetch.HTTPRequest writeRequest(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPRequest request) throws Exception
exchange
and writes it to a newly created
HTTPRequest
instance. The request
parameter is
ignored.writeRequest
in interface OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>
endpoint
- endpoint providing binding-relevant information.exchange
- exchange to read data from.request
- request to be populated or created (if null
) from exchange data.HTTPRequest
instance containing data from
exchange
.Exception
public org.apache.camel.Exchange readRequest(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, javax.servlet.http.HttpServletRequest request)
InboundBinding
Exchange
from request data and endpoint configuration data.readRequest
in interface InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
endpoint
- endpoint providing binding-relevant information.exchange
- exchange to be populated or created (if null
) from request data.request
- request to read data from.public javax.servlet.http.HttpServletResponse writeResponse(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, javax.servlet.http.HttpServletResponse response)
InboundBinding
Exchange
and endpoint configuration data.writeResponse
in interface InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
endpoint
- endpoint providing binding-relevant information.exchange
- exchange to read data from.response
- to be populated or created (if null
) from exchange data.protected void readResponseHeaders(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPResponse response)
protected void readRequestHeaders(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, javax.servlet.http.HttpServletRequest request)
protected void writeRequestHeaders(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPRequest request)
protected void readResponseBody(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPResponse response) throws Exception
Exception
protected void writeRequestBody(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange, com.google.appengine.api.urlfetch.HTTPRequest request)
protected URL getRequestUrl(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange) throws Exception
Exception
protected com.google.appengine.api.urlfetch.HTTPMethod getRequestMethod(GHttpEndpoint endpoint, org.apache.camel.Exchange exchange)
Apache Camel