Add missing options in component docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f633475a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f633475a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f633475a Branch: refs/heads/master Commit: f633475adecf4679fd53f1bfdc0e415d523648e5 Parents: 5f02a65 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon Jan 4 15:23:06 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon Jan 4 15:24:18 2016 +0100 ---------------------------------------------------------------------- .../component/jetty/JettyHttpComponent.java | 37 +---------- .../component/jetty/JettyHttpEndpoint.java | 68 ++++++++++++++++++-- 2 files changed, 63 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f633475a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java index 4224e89..325a799 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java @@ -164,28 +164,20 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { // must extract well known parameters before we create the endpoint - List<Handler> handlerList = resolveAndRemoveReferenceListParameter(parameters, "handlers", Handler.class); HttpBinding binding = resolveAndRemoveReferenceParameter(parameters, "httpBindingRef", HttpBinding.class); JettyHttpBinding jettyBinding = resolveAndRemoveReferenceParameter(parameters, "jettyHttpBindingRef", JettyHttpBinding.class); - Boolean throwExceptionOnFailure = getAndRemoveParameter(parameters, "throwExceptionOnFailure", Boolean.class); - Boolean transferException = getAndRemoveParameter(parameters, "transferException", Boolean.class); - Boolean bridgeEndpoint = getAndRemoveParameter(parameters, "bridgeEndpoint", Boolean.class); - Boolean matchOnUriPrefix = getAndRemoveParameter(parameters, "matchOnUriPrefix", Boolean.class); Boolean enableJmx = getAndRemoveParameter(parameters, "enableJmx", Boolean.class); Boolean enableMultipartFilter = getAndRemoveParameter(parameters, "enableMultipartFilter", Boolean.class, true); Filter multipartFilter = resolveAndRemoveReferenceParameter(parameters, "multipartFilterRef", Filter.class); List<Filter> filters = resolveAndRemoveReferenceListParameter(parameters, "filtersRef", Filter.class); Boolean enableCors = getAndRemoveParameter(parameters, "enableCORS", Boolean.class, false); - Long continuationTimeout = getAndRemoveParameter(parameters, "continuationTimeout", Long.class); - Boolean useContinuation = getAndRemoveParameter(parameters, "useContinuation", Boolean.class); HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class); UrlRewrite urlRewrite = resolveAndRemoveReferenceParameter(parameters, "urlRewrite", UrlRewrite.class); SSLContextParameters sslContextParameters = resolveAndRemoveReferenceParameter(parameters, "sslContextParametersRef", SSLContextParameters.class); SSLContextParameters ssl = sslContextParameters != null ? sslContextParameters : this.sslContextParameters; String proxyHost = getAndRemoveParameter(parameters, "proxyHost", String.class, getProxyHost()); Integer proxyPort = getAndRemoveParameter(parameters, "proxyPort", Integer.class, getProxyPort()); - Integer responseBufferSize = getAndRemoveParameter(parameters, "responseBufferSize", Integer.class, getResponseBufferSize()); Integer httpClientMinThreads = getAndRemoveParameter(parameters, "httpClientMinThreads", Integer.class, this.httpClientMinThreads); Integer httpClientMaxThreads = getAndRemoveParameter(parameters, "httpClientMaxThreads", Integer.class, this.httpClientMaxThreads); @@ -228,9 +220,6 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements if (httpClientParameters != null && !httpClientParameters.isEmpty()) { endpoint.setHttpClientParameters(httpClientParameters); } - if (handlerList.size() > 0) { - endpoint.setHandlers(handlerList); - } // prefer to use endpoint configured over component configured if (binding == null) { // fallback to component configured @@ -247,33 +236,20 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements if (jettyBinding != null) { endpoint.setJettyBinding(jettyBinding); } - // should we use an exception for failed error codes? - if (throwExceptionOnFailure != null) { - endpoint.setThrowExceptionOnFailure(throwExceptionOnFailure); - } - // should we transfer exception as serialized object - if (transferException != null) { - endpoint.setTransferException(transferException); - } - if (bridgeEndpoint != null) { - endpoint.setBridgeEndpoint(bridgeEndpoint); - } - if (matchOnUriPrefix != null) { - endpoint.setMatchOnUriPrefix(matchOnUriPrefix); - } if (enableJmx != null) { endpoint.setEnableJmx(enableJmx); } else { // set this option based on setting of JettyHttpComponent endpoint.setEnableJmx(isEnableJmx()); } - + endpoint.setEnableMultipartFilter(enableMultipartFilter); if (multipartFilter != null) { endpoint.setMultipartFilter(multipartFilter); endpoint.setEnableMultipartFilter(true); } if (enableCors) { + endpoint.setEnableCORS(enableCors); if (filters == null) { filters = new ArrayList<Filter>(1); } @@ -283,21 +259,12 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements endpoint.setFilters(filters); } - if (continuationTimeout != null) { - endpoint.setContinuationTimeout(continuationTimeout); - } - if (useContinuation != null) { - endpoint.setUseContinuation(useContinuation); - } if (httpMethodRestrict != null) { endpoint.setHttpMethodRestrict(httpMethodRestrict); } if (ssl != null) { endpoint.setSslContextParameters(ssl); } - if (responseBufferSize != null) { - endpoint.setResponseBufferSize(responseBufferSize); - } if (httpClientMinThreads != null) { endpoint.setHttpClientMinThreads(httpClientMinThreads); } http://git-wip-us.apache.org/repos/asf/camel/blob/f633475a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java index bacaa7d..85793a2 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java @@ -41,14 +41,8 @@ import org.eclipse.jetty.server.Handler; */ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { - private List<Handler> handlers; private HttpClient client; - private Filter multipartFilter; - private List<Filter> filters; private SSLContextParameters sslContextParameters; - private Map<String, Object> httpClientParameters; - private JettyHttpBinding jettyBinding; - @UriParam(label = "consumer", description = "Specifies whether to enable the session manager on the server side of Jetty.") private boolean sessionSupport; @@ -84,6 +78,42 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { @UriParam(label = "consumer", description = "Whether or not to use Jetty continuations for the Jetty Server.") private Boolean useContinuation; + @UriParam(label = "consumer", + description = "If the option is true, Jetty server will setup the CrossOriginFilter which supports the CORS out of box.") + private boolean enableCORS; + @UriParam(label = "producer,advanced", prefix = "httpClient.", multiValue = true, + description = "Configuration of Jetty's HttpClient. For example, setting httpClient.idleTimeout=30000 sets the idle timeout to 30 seconds." + + " And httpClient.timeout=30000 sets the request timeout to 30 seconds, in case you want to timeout sooner if you have long running request/response calls.") + private Map<String, Object> httpClientParameters; + @UriParam(label = "consumer,advanced", javaType = "java.lang.String", + description = "Specifies a comma-delimited set of Handler instances to lookup in your Registry." + + " These handlers are added to the Jetty servlet context (for example, to add security)." + + " Important: You can not use different handlers with different Jetty endpoints using the same port number." + + " The handlers is associated to the port number. If you need different handlers, then use different port numbers.") + private List<Handler> handlers; + @UriParam(label = "consumer,advanced", javaType = "java.lang.String", name = "filtersRef", + description = "Allows using a custom filters which is putted into a list and can be find in the Registry." + + " Multiple values can be separated by comma.") + private List<Filter> filters; + @UriParam(label = "producer,advanced", + description = "To use a custom JettyHttpBinding which be used to customize how a response should be written for the producer.") + private JettyHttpBinding jettyBinding; + @UriParam(label = "producer,advanced", + description = "To use a custom JettyHttpBinding which be used to customize how a response should be written for the producer.") + @Deprecated + private String jettyBindingRef; + @UriParam(label = "consumer,advanced", + description = "Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server." + + " This allows you to get all responses regardless of the HTTP status code.") + @Deprecated + private String httpBindingRef; + @UriParam(label = "consumer,advanced", + description = "Allows using a custom multipart filter. Note: setting multipartFilterRef forces the value of enableMultipartFilter to true.") + private Filter multipartFilter; + @UriParam(label = "consumer,advanced", + description = "Allows using a custom multipart filter. Note: setting multipartFilterRef forces the value of enableMultipartFilter to true.") + @Deprecated + private String multipartFilterRef; public JettyHttpEndpoint(JettyHttpComponent component, String uri, URI httpURL) throws URISyntaxException { super(uri, component, httpURL); @@ -162,6 +192,12 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { return handlers; } + /** + * Specifies a comma-delimited set of org.mortbay.jetty.Handler instances in your Registry (such as your Spring ApplicationContext). + * These handlers are added to the Jetty servlet context (for example, to add security). + * Important: You can not use different handlers with different Jetty endpoints using the same port number. + * The handlers is associated to the port number. If you need different handlers, then use different port numbers. + */ public void setHandlers(List<Handler> handlers) { this.handlers = handlers; } @@ -200,6 +236,9 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { return jettyBinding; } + /** + * To use a custom JettyHttpBinding which be used to customize how a response should be written for the producer. + */ public void setJettyBinding(JettyHttpBinding jettyBinding) { this.jettyBinding = jettyBinding; } @@ -261,7 +300,11 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { public Filter getMultipartFilter() { return multipartFilter; } - + + /** + * Allows using a custom filters which is putted into a list and can be find in the Registry. + * Multiple values can be separated by comma. + */ public void setFilters(List<Filter> filterList) { this.filters = filterList; } @@ -344,6 +387,17 @@ public abstract class JettyHttpEndpoint extends HttpCommonEndpoint { this.httpClientParameters = httpClientParameters; } + public boolean isEnableCORS() { + return enableCORS; + } + + /** + * If the option is true, Jetty server will setup the CrossOriginFilter which supports the CORS out of box. + */ + public void setEnableCORS(boolean enableCORS) { + this.enableCORS = enableCORS; + } + public abstract JettyContentExchange createContentExchange(); }