Name

GHTTP — provides connectivity to the GAE URL fetch service but can also be used to receive messages from servlets

Overview

The ghttp component provides connectivity to the GAE URL fetch service but can also be used to receive messages from servlets. This is achieved by extending the Servlet component. As a consequence, GHTTP URI formats and options sets differ on the consumer-side (from) and producer-side (to).

URI format

GHTTP endpoints can use the following URI formates:

FormatContextComment
ghttp:///path[?options] ConsumerSee also Servlet component
ghttp://hostname[:port][/path][?options] ProducerSee also HTTP
ghttps://hostname[:port][/path][?options] ProducerSee also HTTP

Dependencies

Maven users will need to add a dependency on camel-gae to their poms as shown in Example 6, “GHTTP dependency”.

Example 6. GHTTP dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-gae</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Options

Table 17, “GHTTP options” lists the options for a GHTTP endpoint.

Table 17. GHTTP options

NameDefaultContextDescription
bridgeEndpointtrueProducerSpecifies if the Exchange.HTTP_URI header is ignored.
throwExceptionOnFailuretrueProducerSpecifies if a org.apache.camel.component.gae.http is thrown when the response code is >= 400.
inboundBindingRef ConsumerSpecifies a reference to an InboundBinding<GHttpEndpoint, HttpServletRequest, HttpServletResponse> in the registry for customizing the binding of an exchange to the Servlet API. The referenced binding is used as post-processor to org.apache.camel.component.http.HttpBinding.
outboundBindingRef ProducerSpecifies a reference to an InboundBinding<GHttpEndpoint, HttpServletRequest, HttpServletResponse> in the registry for customizing the binding of an exchange to the URLFetchService.

On the consumer-side, all options of the Servlet endpoint are supported.

Message headers

On the producer side, the following headers of the HTTP endpoint are supported.

NameTypeDescription
Content-TypeStringSpecifies the HTTP content type. This header is populated on both the IN and OUT message to provide a content type.
Content-EncodingStringSpecifies the HTTP content encoding. This header is populated on both the IN and OUT message to provide a content encoding.
CamelHttpMethodStringSpecifies the HTTP method to execute. Can be one of GET, POST, PUT or DELETE. If not set, POST will be used if the message body is not null, GET otherwise.
CamelHttpQueryStringOverrides the query part of the endpoint URI or HTTP_URI. The query string must be in decoded form.
CamelHttpUriStringOverrides the default endpoint URI if the bridgeEndpoint option is set to false. The URI string must be in decoded form.
CamelHttpResponseCodeintSpecifies the HTTP response code from URL fetch service responses.

On the consumer-side all headers of the Servlet component headers are supported.

Message body

On the producer side the in message body is converted to a byte[]. The out message body is made available as InputStream. If the reponse size exceeds 1 megabyte a ResponseTooLargeException is thrown by the URL fetch service (see quotas and limits).

Related topics

HTTP
Servlet
GAE URL fetch service