org.apache.camel.component.gae.http
Class GHttpBinding

java.lang.Object
  extended by org.apache.camel.component.gae.http.GHttpBinding
All Implemented Interfaces:
InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>, OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>

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>

Binds the HTTPRequest/HTTPResponse pair of the URL fetch service to a Camel Exchange.


Constructor Summary
GHttpBinding()
           
 
Method Summary
protected  com.google.appengine.api.urlfetch.HTTPMethod getRequestMethod(GHttpEndpoint endpoint, Exchange exchange)
           
protected  URL getRequestUrl(GHttpEndpoint endpoint, Exchange exchange)
           
protected  String getResponseHeader(String name, com.google.appengine.api.urlfetch.HTTPResponse response)
           
 Exchange readRequest(GHttpEndpoint endpoint, Exchange exchange, javax.servlet.http.HttpServletRequest request)
          Populates an Exchange from request data and endpoint configuration data.
protected  void readRequestHeaders(GHttpEndpoint endpoint, Exchange exchange, javax.servlet.http.HttpServletRequest request)
           
 Exchange readResponse(GHttpEndpoint endpoint, 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, Exchange exchange, com.google.appengine.api.urlfetch.HTTPResponse response)
           
protected  void readResponseHeaders(GHttpEndpoint endpoint, Exchange exchange, com.google.appengine.api.urlfetch.HTTPResponse response)
           
 com.google.appengine.api.urlfetch.HTTPRequest writeRequest(GHttpEndpoint endpoint, 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, Exchange exchange, com.google.appengine.api.urlfetch.HTTPRequest request)
           
protected  void writeRequestHeaders(GHttpEndpoint endpoint, Exchange exchange, com.google.appengine.api.urlfetch.HTTPRequest request)
           
 javax.servlet.http.HttpServletResponse writeResponse(GHttpEndpoint endpoint, Exchange exchange, javax.servlet.http.HttpServletResponse response)
          Creates or populates a response object from Exchange and endpoint configuration data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GHttpBinding

public GHttpBinding()
Method Detail

readResponse

public Exchange readResponse(GHttpEndpoint endpoint,
                             Exchange exchange,
                             com.google.appengine.api.urlfetch.HTTPResponse response)
                      throws Exception
Reads data from response and writes it to the out-message of the exchange.

Specified by:
readResponse in interface OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>
Parameters:
endpoint -
exchange -
response -
Returns:
the original exchange instance populated with response data.
Throws:
GHttpException - if the response code is >= 400 and HttpEndpoint.isThrowExceptionOnFailure() returns true.
Exception

writeRequest

public com.google.appengine.api.urlfetch.HTTPRequest writeRequest(GHttpEndpoint endpoint,
                                                                  Exchange exchange,
                                                                  com.google.appengine.api.urlfetch.HTTPRequest request)
                                                           throws Exception
Reads data from exchange and writes it to a newly created HTTPRequest instance. The request parameter is ignored.

Specified by:
writeRequest in interface OutboundBinding<GHttpEndpoint,com.google.appengine.api.urlfetch.HTTPRequest,com.google.appengine.api.urlfetch.HTTPResponse>
Parameters:
endpoint -
exchange -
request - ignored.
Returns:
a newly created HTTPRequest instance containing data from exchange.
Throws:
Exception

readRequest

public Exchange readRequest(GHttpEndpoint endpoint,
                            Exchange exchange,
                            javax.servlet.http.HttpServletRequest request)
Description copied from interface: InboundBinding
Populates an Exchange from request data and endpoint configuration data.

Specified by:
readRequest in interface InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to be populated or created (if null) from request data.
request - request to read data from.
Returns:
the populated exchange.

writeResponse

public javax.servlet.http.HttpServletResponse writeResponse(GHttpEndpoint endpoint,
                                                            Exchange exchange,
                                                            javax.servlet.http.HttpServletResponse response)
Description copied from interface: InboundBinding
Creates or populates a response object from Exchange and endpoint configuration data.

Specified by:
writeResponse in interface InboundBinding<GHttpEndpoint,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to read data from.
response - to be populated or created (if null) from exchange data.
Returns:
the populated response.

readResponseHeaders

protected void readResponseHeaders(GHttpEndpoint endpoint,
                                   Exchange exchange,
                                   com.google.appengine.api.urlfetch.HTTPResponse response)

readRequestHeaders

protected void readRequestHeaders(GHttpEndpoint endpoint,
                                  Exchange exchange,
                                  javax.servlet.http.HttpServletRequest request)

writeRequestHeaders

protected void writeRequestHeaders(GHttpEndpoint endpoint,
                                   Exchange exchange,
                                   com.google.appengine.api.urlfetch.HTTPRequest request)

readResponseBody

protected void readResponseBody(GHttpEndpoint endpoint,
                                Exchange exchange,
                                com.google.appengine.api.urlfetch.HTTPResponse response)
                         throws Exception
Throws:
Exception

writeRequestBody

protected void writeRequestBody(GHttpEndpoint endpoint,
                                Exchange exchange,
                                com.google.appengine.api.urlfetch.HTTPRequest request)

getRequestUrl

protected URL getRequestUrl(GHttpEndpoint endpoint,
                            Exchange exchange)
                     throws Exception
Throws:
Exception

getRequestMethod

protected com.google.appengine.api.urlfetch.HTTPMethod getRequestMethod(GHttpEndpoint endpoint,
                                                                        Exchange exchange)

getResponseHeader

protected String getResponseHeader(String name,
                                   com.google.appengine.api.urlfetch.HTTPResponse response)


Apache CAMEL