You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/06/14 13:02:50 UTC
[5/5] camel git commit: Component docs
Component docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e20ae861
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e20ae861
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e20ae861
Branch: refs/heads/master
Commit: e20ae861b79af7c1a7245abbc67e591af846875f
Parents: a4e6997
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jun 14 13:05:27 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jun 14 13:08:08 2015 +0200
----------------------------------------------------------------------
.../component/websocket/WebsocketComponent.java | 32 +++++++-
.../component/websocket/WebsocketEndpoint.java | 80 ++++++++++++++++----
2 files changed, 95 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e20ae861/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
index 33afc99..379c730 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
@@ -650,8 +650,6 @@ public class WebsocketComponent extends UriEndpointComponent {
* <tt>classpath:WEB-INF/static</tt>
* <p/>
* If not configured (eg <tt>null</tt>) then no static resource is in use.
- *
- * @param staticResources the base path
*/
public void setStaticResources(String staticResources) {
this.staticResources = staticResources;
@@ -661,6 +659,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return host;
}
+ /**
+ * The hostname. The default value is <tt>0.0.0.0</tt>
+ */
public void setHost(String host) {
this.host = host;
}
@@ -669,6 +670,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return port;
}
+ /**
+ * The port number. The default value is <tt>9292</tt>
+ */
public void setPort(Integer port) {
this.port = port;
}
@@ -685,18 +689,30 @@ public class WebsocketComponent extends UriEndpointComponent {
return sslKeystore;
}
+ /**
+ * The password for the keystore when using SSL.
+ */
public void setSslKeyPassword(String sslKeyPassword) {
this.sslKeyPassword = sslKeyPassword;
}
+ /**
+ * The password when using SSL.
+ */
public void setSslPassword(String sslPassword) {
this.sslPassword = sslPassword;
}
+ /**
+ * The path to the keystore.
+ */
public void setSslKeystore(String sslKeystore) {
this.sslKeystore = sslKeystore;
}
+ /**
+ * If this option is true, Jetty JMX support will be enabled for this endpoint. See Jetty JMX support for more details.
+ */
public void setEnableJmx(boolean enableJmx) {
this.enableJmx = enableJmx;
}
@@ -709,6 +725,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return minThreads;
}
+ /**
+ * To set a value for minimum number of threads in server thread pool.
+ */
public void setMinThreads(Integer minThreads) {
this.minThreads = minThreads;
}
@@ -717,6 +736,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return maxThreads;
}
+ /**
+ * To set a value for maximum number of threads in server thread pool.
+ */
public void setMaxThreads(Integer maxThreads) {
this.maxThreads = maxThreads;
}
@@ -725,6 +747,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return threadPool;
}
+ /**
+ * To use a custom thread pool for the server.
+ */
public void setThreadPool(ThreadPool threadPool) {
this.threadPool = threadPool;
}
@@ -733,6 +758,9 @@ public class WebsocketComponent extends UriEndpointComponent {
return sslContextParameters;
}
+ /**
+ * To configure security using SSLContextParameters
+ */
public void setSslContextParameters(SSLContextParameters sslContextParameters) {
this.sslContextParameters = sslContextParameters;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/e20ae861/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
index ac5dc06b..ffafdaf 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
@@ -43,14 +43,14 @@ public class WebsocketEndpoint extends DefaultEndpoint {
private URI uri;
private List<Handler> handlers;
- @UriPath @Metadata(required = "true")
+ @UriPath(defaultValue = "0.0.0.0")
private String host;
- @UriPath @Metadata(required = "true")
+ @UriPath(defaultValue = "9292")
private Integer port;
@UriPath @Metadata(required = "true")
private String resourceUri;
- @UriParam
+ @UriParam(label = "producer")
private Boolean sendToAll;
@UriParam
private boolean enableJmx;
@@ -62,22 +62,19 @@ public class WebsocketEndpoint extends DefaultEndpoint {
private SSLContextParameters sslContextParameters;
@UriParam
private String allowedOrigins;
- // Used to filter CORS
@UriParam
private String filterPath;
- // Base Resource for the ServletContextHandler
@UriParam
private String staticResources;
- // Here are the configuration on the WebSocketComponentServlet
- @UriParam
+ @UriParam(defaultValue = "8192")
private Integer bufferSize;
- @UriParam
+ @UriParam(defaultValue = "300000")
private Integer maxIdleTime;
@UriParam
private Integer maxTextMessageSize;
- @UriParam
+ @UriParam(defaultValue = "-1")
private Integer maxBinaryMessageSize;
- @UriParam
+ @UriParam(defaultValue = "13")
private Integer minVersion;
public WebsocketEndpoint(WebsocketComponent component, String uri, String resourceUri, Map<String, Object> parameters) {
@@ -149,10 +146,18 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return host;
}
+ /**
+ * The hostname. The default value is <tt>0.0.0.0</tt>.
+ * Setting this option on the component will use the component configured value as default.
+ */
public void setHost(String host) {
this.host = host;
}
+ /**
+ * The port number. The default value is <tt>9292</tt>.
+ * Setting this option on the component will use the component configured value as default.
+ */
public void setPort(int port) {
this.port = port;
}
@@ -161,6 +166,17 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return staticResources;
}
+ /**
+ * Set a resource path for static resources (such as .html files etc).
+ * <p/>
+ * The resources can be loaded from classpath, if you prefix with <tt>classpath:</tt>,
+ * otherwise the resources is loaded from file system or from JAR files.
+ * <p/>
+ * For example to load from root classpath use <tt>classpath:.</tt>, or
+ * <tt>classpath:WEB-INF/static</tt>
+ * <p/>
+ * If not configured (eg <tt>null</tt>) then no static resource is in use.
+ */
public void setStaticResources(String staticResources) {
this.staticResources = staticResources;
}
@@ -169,6 +185,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return sendToAll;
}
+ /**
+ * To send to all websocket subscribers. Can be used to configure on endpoint level, instead of having to use the WebsocketConstants.SEND_TO_ALL header on the message.
+ */
public void setSendToAll(Boolean sendToAll) {
this.sendToAll = sendToAll;
}
@@ -181,6 +200,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return uri.getPath();
}
+ /**
+ * Whether to enable session support which enables HttpSession for each http request.
+ */
public void setSessionSupport(boolean support) {
sessionSupport = support;
}
@@ -193,6 +215,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return bufferSize;
}
+ /**
+ * Set the buffer size of the websocketServlet, which is also the max frame byte size (default 8192)
+ */
public void setBufferSize(Integer bufferSize) {
this.bufferSize = bufferSize;
}
@@ -201,6 +226,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return maxIdleTime;
}
+ /**
+ * Set the time in ms that the websocket created by the websocketServlet may be idle before closing. (default is 300000)
+ */
public void setMaxIdleTime(Integer maxIdleTime) {
this.maxIdleTime = maxIdleTime;
}
@@ -209,6 +237,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return maxTextMessageSize;
}
+ /**
+ * Can be used to set the size in characters that the websocket created by the websocketServlet may be accept before closing.
+ */
public void setMaxTextMessageSize(Integer maxTextMessageSize) {
this.maxTextMessageSize = maxTextMessageSize;
}
@@ -217,6 +248,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return maxBinaryMessageSize;
}
+ /**
+ * Can be used to set the size in bytes that the websocket created by the websocketServlet may be accept before closing. (Default is -1 - or unlimited)
+ */
public void setMaxBinaryMessageSize(Integer maxBinaryMessageSize) {
this.maxBinaryMessageSize = maxBinaryMessageSize;
}
@@ -225,6 +259,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return minVersion;
}
+ /**
+ * Can be used to set the minimum protocol version accepted for the websocketServlet. (Default 13 - the RFC6455 version)
+ */
public void setMinVersion(Integer minVersion) {
this.minVersion = minVersion;
}
@@ -237,11 +274,13 @@ public class WebsocketEndpoint extends DefaultEndpoint {
this.handlers = handlers;
}
-
public SSLContextParameters getSslContextParameters() {
return sslContextParameters;
}
+ /**
+ * To configure security using SSLContextParameters
+ */
public void setSslContextParameters(SSLContextParameters sslContextParameters) {
this.sslContextParameters = sslContextParameters;
}
@@ -250,6 +289,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return this.enableJmx;
}
+ /**
+ * If this option is true, Jetty JMX support will be enabled for this endpoint. See Jetty JMX support for more details.
+ */
public void setEnableJmx(boolean enableJmx) {
this.enableJmx = enableJmx;
}
@@ -258,6 +300,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return allowedOrigins;
}
+ /**
+ * The CORS allowed origins. Use * to allow all.
+ */
public void setAllowedOrigins(String allowedOrigins) {
this.allowedOrigins = allowedOrigins;
}
@@ -266,6 +311,9 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return crossOriginFilterOn;
}
+ /**
+ * Whether to enable CORS
+ */
public void setCrossOriginFilterOn(boolean crossOriginFilterOn) {
this.crossOriginFilterOn = crossOriginFilterOn;
}
@@ -274,18 +322,20 @@ public class WebsocketEndpoint extends DefaultEndpoint {
return filterPath;
}
+ /**
+ * Context path for filtering CORS
+ */
public void setFilterPath(String filterPath) {
this.filterPath = filterPath;
}
- public void setPort(Integer port) {
- this.port = port;
- }
-
public String getResourceUri() {
return resourceUri;
}
+ /**
+ * Name of the websocket channel to use
+ */
public void setResourceUri(String resourceUri) {
this.resourceUri = resourceUri;
}