Repository: camel Updated Branches: refs/heads/master 4cc3541be -> cd3f66e99
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cd3f66e9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cd3f66e9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cd3f66e9 Branch: refs/heads/master Commit: cd3f66e99927d5ec3301e949d4f85b3bc79486e2 Parents: 4cc3541 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon May 11 11:37:28 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 11 11:37:28 2015 +0200 ---------------------------------------------------------------------- .../component/restlet/RestletComponent.java | 67 +++++++++++++++++ .../component/restlet/RestletEndpoint.java | 76 ++++++++++++++++---- 2 files changed, 131 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/cd3f66e9/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java index aef1c24..3aefcc9 100644 --- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java +++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java @@ -451,6 +451,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return controllerDaemon; } + /** + * Indicates if the controller thread should be a daemon (not blocking JVM exit). + */ public void setControllerDaemon(Boolean controllerDaemon) { this.controllerDaemon = controllerDaemon; } @@ -459,6 +462,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return controllerSleepTimeMs; } + /** + * Time for the controller thread to sleep between each control. + */ public void setControllerSleepTimeMs(Integer controllerSleepTimeMs) { this.controllerSleepTimeMs = controllerSleepTimeMs; } @@ -467,6 +473,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return inboundBufferSize; } + /** + * The size of the buffer when reading messages. + */ public void setInboundBufferSize(Integer inboundBufferSize) { this.inboundBufferSize = inboundBufferSize; } @@ -475,6 +484,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return maxConnectionsPerHost; } + /** + * Maximum number of concurrent connections per host (IP address). + */ public void setMaxConnectionsPerHost(Integer maxConnectionsPerHost) { this.maxConnectionsPerHost = maxConnectionsPerHost; } @@ -483,6 +495,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return maxThreads; } + /** + * Maximum threads that will service requests. + */ public void setMaxThreads(Integer maxThreads) { this.maxThreads = maxThreads; } @@ -491,6 +506,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return lowThreads; } + /** + * Number of worker threads determining when the connector is considered overloaded. + */ public void setLowThreads(Integer lowThreads) { this.lowThreads = lowThreads; } @@ -499,6 +517,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return maxTotalConnections; } + /** + * Maximum number of concurrent connections in total. + */ public void setMaxTotalConnections(Integer maxTotalConnections) { this.maxTotalConnections = maxTotalConnections; } @@ -507,6 +528,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return minThreads; } + /** + * Minimum threads waiting to service requests. + */ public void setMinThreads(Integer minThreads) { this.minThreads = minThreads; } @@ -515,6 +539,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return outboundBufferSize; } + /** + * The size of the buffer when writing messages. + */ public void setOutboundBufferSize(Integer outboundBufferSize) { this.outboundBufferSize = outboundBufferSize; } @@ -523,6 +550,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return persistingConnections; } + /** + * Indicates if connections should be kept alive after a call. + */ public void setPersistingConnections(Boolean persistingConnections) { this.persistingConnections = persistingConnections; } @@ -531,6 +561,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return pipeliningConnections; } + /** + * Indicates if pipelining connections are supported. + */ public void setPipeliningConnections(Boolean pipeliningConnections) { this.pipeliningConnections = pipeliningConnections; } @@ -539,6 +572,9 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return threadMaxIdleTimeMs; } + /** + * Time for an idle thread to wait for an operation before being collected. + */ public void setThreadMaxIdleTimeMs(Integer threadMaxIdleTimeMs) { this.threadMaxIdleTimeMs = threadMaxIdleTimeMs; } @@ -547,6 +583,11 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return useForwardedForHeader; } + /** + * Lookup the "X-Forwarded-For" header supported by popular proxies and caches and uses it to populate the Request.getClientAddresses() + * method result. This information is only safe for intermediary components within your local network. + * Other addresses could easily be changed by setting a fake header and should not be trusted for serious security checks. + */ public void setUseForwardedForHeader(Boolean useForwardedForHeader) { this.useForwardedForHeader = useForwardedForHeader; } @@ -555,6 +596,10 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return reuseAddress; } + /** + * Enable/disable the SO_REUSEADDR socket option. + * See java.io.ServerSocket#reuseAddress property for additional details. + */ public void setReuseAddress(Boolean reuseAddress) { this.reuseAddress = reuseAddress; } @@ -563,6 +608,11 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return maxQueued; } + /** + * Maximum number of calls that can be queued if there aren't any worker thread available to service them. + * If the value is '0', then no queue is used and calls are rejected if no worker thread is immediately available. + * If the value is '-1', then an unbounded queue is used and calls are never rejected. + */ public void setMaxQueued(Integer maxQueued) { this.maxQueued = maxQueued; } @@ -571,6 +621,15 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return disableStreamCache; } + /** + * Determines whether or not the raw input stream from Restlet is cached or not + * (Camel will read the stream into a in memory/overflow to file, Stream caching) cache. + * By default Camel will cache the Restlet input stream to support reading it multiple times to ensure Camel + * can retrieve all data from the stream. However you can set this option to true when you for example need + * to access the raw stream, such as streaming it directly to a file or other persistent store. + * DefaultRestletBinding will copy the request input stream into a stream cache and put it into message body + * if this option is false to support reading the stream multiple times. + */ public void setDisableStreamCache(boolean disableStreamCache) { this.disableStreamCache = disableStreamCache; } @@ -579,6 +638,10 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return port; } + /** + * To configure the port number for the restlet consumer routes. + * This allows to configure this once to reuse the same port for these consumers. + */ public void setPort(int port) { this.port = port; } @@ -587,6 +650,10 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R return synchronous; } + /** + * Whether to use synchronous Restlet Client for the producer. Setting this option to true can yield faster performance + * as it seems the Restlet synchronous Client works better. + */ public void setSynchronous(Boolean synchronous) { this.synchronous = synchronous; } http://git-wip-us.apache.org/repos/asf/camel/blob/cd3f66e9/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java index 21a806d..896b3bc 100644 --- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java +++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java @@ -49,27 +49,23 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra private static final int DEFAULT_SOCKET_TIMEOUT = 30000; private static final int DEFAULT_CONNECT_TIMEOUT = 30000; - @UriPath(enums = "http") @Metadata(required = "true") + @UriPath(enums = "http,https") @Metadata(required = "true") private String protocol = DEFAULT_PROTOCOL; @UriPath @Metadata(required = "true") private String host = DEFAULT_HOST; - @UriPath(defaultValue = "80") + @UriPath(defaultValue = "80") @Metadata(required = "true") private int port = DEFAULT_PORT; @UriPath @Metadata(required = "true") private String uriPattern; - @UriParam(defaultValue = "" + DEFAULT_SOCKET_TIMEOUT) + @UriParam(label = "producer", defaultValue = "" + DEFAULT_SOCKET_TIMEOUT) private int socketTimeout = DEFAULT_SOCKET_TIMEOUT; - @UriParam(defaultValue = "" + DEFAULT_CONNECT_TIMEOUT) + @UriParam(label = "producer", defaultValue = "" + DEFAULT_CONNECT_TIMEOUT) private int connectTimeout = DEFAULT_CONNECT_TIMEOUT; @UriParam(defaultValue = "GET") private Method restletMethod = Method.GET; - // Optional and for consumer only. This allows a single route to service multiple methods. - // If it is non-null then restletMethod is ignored. - @UriParam + @UriParam(label = "consumer") private Method[] restletMethods; - // Optional and for consumer only. This allows a single route to service multiple URI patterns. - // The URI pattern defined in the endpoint will still be honored. - @UriParam + @UriParam(label = "consumer") private List<String> restletUriPatterns; @UriParam private Map<String, String> restletRealm; @@ -77,7 +73,7 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra private HeaderFilterStrategy headerFilterStrategy; @UriParam private RestletBinding restletBinding; - @UriParam(defaultValue = "true") + @UriParam(label = "producer", defaultValue = "true") private boolean throwExceptionOnFailure = true; @UriParam private boolean disableStreamCache; @@ -129,6 +125,10 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return restletMethod; } + /** + * On a producer endpoint, specifies the request method to use. + * On a consumer endpoint, specifies that the endpoint consumes only restletMethod requests. + */ public void setRestletMethod(Method restletMethod) { this.restletMethod = restletMethod; } @@ -137,6 +137,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return protocol; } + /** + * The protocol to use which is http or https + */ public void setProtocol(String protocol) { this.protocol = protocol; } @@ -145,6 +148,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return host; } + /** + * The hostname of the restlet service + */ public void setHost(String host) { this.host = host; } @@ -153,6 +159,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return port; } + /** + * The port number of the restlet service + */ public void setPort(int port) { this.port = port; } @@ -161,6 +170,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return socketTimeout; } + /** + * The Client socket receive timeout, 0 for unlimited wait. + */ public void setSocketTimeout(int socketTimeout) { this.socketTimeout = socketTimeout; } @@ -169,6 +181,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return connectTimeout; } + /** + * The Client will give up connection if the connection is timeout, 0 for unlimited wait. + */ public void setConnectTimeout(int connectTimeout) { this.connectTimeout = connectTimeout; } @@ -177,6 +192,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return uriPattern; } + /** + * The resource pattern such as /customer/{id} + */ public void setUriPattern(String uriPattern) { this.uriPattern = uriPattern; } @@ -185,10 +203,16 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return restletBinding; } + /** + * To use a custom RestletBinding to bind between Restlet and Camel message. + */ public void setRestletBinding(RestletBinding restletBinding) { this.restletBinding = restletBinding; } + /** + * To use a custom HeaderFilterStrategy to filter header to and from Camel message. + */ public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) { this.headerFilterStrategy = headerFilterStrategy; if (restletBinding instanceof HeaderFilterStrategyAware) { @@ -200,6 +224,9 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return headerFilterStrategy; } + /** + * To configure the security realms of restlet as a map. + */ public void setRestletRealm(Map<String, String> restletRealm) { this.restletRealm = restletRealm; } @@ -214,6 +241,10 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return ExchangePattern.InOut; } + /** + * Specify one or more methods separated by commas (e.g. restletMethods=post,put) to be serviced by a restlet consumer endpoint. + * If both restletMethod and restletMethods options are specified, the restletMethod setting is ignored. + */ public void setRestletMethods(Method[] restletMethods) { this.restletMethods = restletMethods; } @@ -222,6 +253,11 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return restletMethods; } + /** + * Specify one ore more URI templates to be serviced by a restlet consumer endpoint, using the # notation to + * reference a List<String> in the Camel Registry. + * If a URI pattern has been defined in the endpoint URI, both the URI pattern defined in the endpoint and the restletUriPatterns option will be honored. + */ public void setRestletUriPatterns(List<String> restletUriPatterns) { this.restletUriPatterns = restletUriPatterns; } @@ -234,6 +270,10 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return throwExceptionOnFailure; } + /** + * Whether to throw exception on a producer failure. If this option is false then the http status code is set as a message header which + * can be checked if it has an error value. + */ public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) { this.throwExceptionOnFailure = throwExceptionOnFailure; } @@ -242,6 +282,15 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra return disableStreamCache; } + /** + * Determines whether or not the raw input stream from Restlet is cached or not + * (Camel will read the stream into a in memory/overflow to file, Stream caching) cache. + * By default Camel will cache the Restlet input stream to support reading it multiple times to ensure Camel + * can retrieve all data from the stream. However you can set this option to true when you for example need + * to access the raw stream, such as streaming it directly to a file or other persistent store. + * DefaultRestletBinding will copy the request input stream into a stream cache and put it into message body + * if this option is false to support reading the stream multiple times. + */ public void setDisableStreamCache(boolean disableStreamCache) { this.disableStreamCache = disableStreamCache; } @@ -249,7 +298,10 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra public SSLContextParameters getSslContextParameters() { return sslContextParameters; } - + + /** + * To configure security using SSLContextParameters. + */ public void setSslContextParameters(SSLContextParameters scp) { this.sslContextParameters = scp; }