org.apache.camel.component.websocket
Class WebsocketComponent
java.lang.Object
org.apache.camel.support.ServiceSupport
org.apache.camel.impl.DefaultComponent
org.apache.camel.component.websocket.WebsocketComponent
- All Implemented Interfaces:
- org.apache.camel.CamelContextAware, org.apache.camel.Component, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
public class WebsocketComponent
- extends org.apache.camel.impl.DefaultComponent
Fields inherited from class org.apache.camel.support.ServiceSupport |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Method Summary |
protected WebsocketComponentServlet |
addServlet(NodeSynchronization sync,
WebsocketConsumer consumer,
String remaining)
|
protected WebsocketComponentServlet |
addServlet(NodeSynchronization sync,
WebsocketProducer producer,
String remaining)
|
void |
connect(WebsocketProducerConsumer prodcon)
Connects the URL specified on the endpoint to the specified processor. |
protected org.eclipse.jetty.servlet.ServletContextHandler |
createContext(org.eclipse.jetty.server.Server server,
org.eclipse.jetty.server.Connector connector,
List<org.eclipse.jetty.server.Handler> handlers)
|
protected org.apache.camel.Endpoint |
createEndpoint(String uri,
String remaining,
Map<String,Object> parameters)
|
protected org.eclipse.jetty.server.Server |
createServer()
|
protected WebsocketComponentServlet |
createServlet(NodeSynchronization sync,
String pathSpec,
Map<String,WebsocketComponentServlet> servlets,
org.eclipse.jetty.servlet.ServletContextHandler handler)
|
protected org.eclipse.jetty.server.Server |
createStaticResourcesServer(org.eclipse.jetty.server.Server server,
org.eclipse.jetty.servlet.ServletContextHandler context,
String home)
|
protected org.eclipse.jetty.server.Server |
createStaticResourcesServer(org.eclipse.jetty.servlet.ServletContextHandler context,
String host,
int port,
String home)
|
void |
disconnect(WebsocketProducerConsumer prodcon)
Disconnects the URL specified on the endpoint from the specified
processor. |
protected void |
doStart()
|
void |
doStop()
|
static HashMap<String,org.apache.camel.component.websocket.WebsocketComponent.ConnectorRef> |
getConnectors()
|
String |
getHost()
|
Integer |
getMaxThreads()
|
org.eclipse.jetty.jmx.MBeanContainer |
getMbContainer()
|
Integer |
getMinThreads()
|
Integer |
getPort()
|
org.apache.camel.util.jsse.SSLContextParameters |
getSslContextParameters()
|
String |
getSslKeyPassword()
|
String |
getSslKeystore()
|
String |
getSslPassword()
|
String |
getStaticResources()
|
org.eclipse.jetty.util.thread.ThreadPool |
getThreadPool()
|
boolean |
isEnableJmx()
|
void |
setEnableJmx(boolean enableJmx)
|
void |
setHost(String host)
|
void |
setMaxThreads(Integer maxThreads)
|
void |
setMinThreads(Integer minThreads)
|
void |
setPort(Integer port)
|
void |
setSslContextParameters(org.apache.camel.util.jsse.SSLContextParameters sslContextParameters)
|
void |
setSslKeyPassword(String sslKeyPassword)
|
void |
setSslKeystore(String sslKeystore)
|
void |
setSslPassword(String sslPassword)
|
void |
setStaticResources(String staticResources)
Set a resource path for static resources (such as .html files etc). |
void |
setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
|
protected void |
setWebSocketComponentServletInitialParameter(org.eclipse.jetty.servlet.ServletContextHandler context,
WebsocketEndpoint endpoint)
|
protected void |
startMbContainer()
Starts mbContainer and registers the container with itself as a managed bean
logging an error if there is a problem starting the container. |
Methods inherited from class org.apache.camel.impl.DefaultComponent |
afterConfiguration, createComponentConfiguration, createConfiguration, createEndpoint, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, ifStartsWithReturnRemainder, preProcessUri, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, setCamelContext, setProperties, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURI |
Methods inherited from class org.apache.camel.support.ServiceSupport |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
protected static final org.slf4j.Logger LOG
CONNECTORS
protected static final HashMap<String,org.apache.camel.component.websocket.WebsocketComponent.ConnectorRef> CONNECTORS
sslContextParameters
protected org.apache.camel.util.jsse.SSLContextParameters sslContextParameters
mbContainer
protected org.eclipse.jetty.jmx.MBeanContainer mbContainer
threadPool
protected org.eclipse.jetty.util.thread.ThreadPool threadPool
port
protected Integer port
minThreads
protected Integer minThreads
maxThreads
protected Integer maxThreads
enableJmx
protected boolean enableJmx
host
protected String host
staticResources
protected String staticResources
staticResourcesServer
protected org.eclipse.jetty.server.Server staticResourcesServer
sslKeyPassword
protected String sslKeyPassword
sslPassword
protected String sslPassword
sslKeystore
protected String sslKeystore
WebsocketComponent
public WebsocketComponent()
connect
public void connect(WebsocketProducerConsumer prodcon)
throws Exception
- Connects the URL specified on the endpoint to the specified processor.
- Throws:
Exception
disconnect
public void disconnect(WebsocketProducerConsumer prodcon)
throws Exception
- Disconnects the URL specified on the endpoint from the specified
processor.
- Throws:
Exception
getMbContainer
public org.eclipse.jetty.jmx.MBeanContainer getMbContainer()
createEndpoint
protected org.apache.camel.Endpoint createEndpoint(String uri,
String remaining,
Map<String,Object> parameters)
throws Exception
- Specified by:
createEndpoint
in class org.apache.camel.impl.DefaultComponent
- Throws:
Exception
setWebSocketComponentServletInitialParameter
protected void setWebSocketComponentServletInitialParameter(org.eclipse.jetty.servlet.ServletContextHandler context,
WebsocketEndpoint endpoint)
createServer
protected org.eclipse.jetty.server.Server createServer()
throws Exception
- Throws:
Exception
createStaticResourcesServer
protected org.eclipse.jetty.server.Server createStaticResourcesServer(org.eclipse.jetty.server.Server server,
org.eclipse.jetty.servlet.ServletContextHandler context,
String home)
throws Exception
- Throws:
Exception
createStaticResourcesServer
protected org.eclipse.jetty.server.Server createStaticResourcesServer(org.eclipse.jetty.servlet.ServletContextHandler context,
String host,
int port,
String home)
throws Exception
- Throws:
Exception
addServlet
protected WebsocketComponentServlet addServlet(NodeSynchronization sync,
WebsocketProducer producer,
String remaining)
throws Exception
- Throws:
Exception
addServlet
protected WebsocketComponentServlet addServlet(NodeSynchronization sync,
WebsocketConsumer consumer,
String remaining)
throws Exception
- Throws:
Exception
createServlet
protected WebsocketComponentServlet createServlet(NodeSynchronization sync,
String pathSpec,
Map<String,WebsocketComponentServlet> servlets,
org.eclipse.jetty.servlet.ServletContextHandler handler)
createContext
protected org.eclipse.jetty.servlet.ServletContextHandler createContext(org.eclipse.jetty.server.Server server,
org.eclipse.jetty.server.Connector connector,
List<org.eclipse.jetty.server.Handler> handlers)
throws Exception
- Throws:
Exception
startMbContainer
protected void startMbContainer()
- Starts
mbContainer
and registers the container with itself as a managed bean
logging an error if there is a problem starting the container.
Does nothing if mbContainer
is null
.
getStaticResources
public String getStaticResources()
setStaticResources
public void setStaticResources(String staticResources)
- Set a resource path for static resources (such as .html files etc).
The resources can be loaded from classpath, if you prefix with classpath:,
otherwise the resources is loaded from file system or from JAR files.
For example to load from root classpath use classpath:., or
classpath:WEB-INF/static
If not configured (eg null) then no static resource is in use.
- Parameters:
staticResources
- the base path
getHost
public String getHost()
setHost
public void setHost(String host)
getPort
public Integer getPort()
setPort
public void setPort(Integer port)
getSslKeyPassword
public String getSslKeyPassword()
getSslPassword
public String getSslPassword()
getSslKeystore
public String getSslKeystore()
setSslKeyPassword
public void setSslKeyPassword(String sslKeyPassword)
setSslPassword
public void setSslPassword(String sslPassword)
setSslKeystore
public void setSslKeystore(String sslKeystore)
setEnableJmx
public void setEnableJmx(boolean enableJmx)
isEnableJmx
public boolean isEnableJmx()
getMinThreads
public Integer getMinThreads()
setMinThreads
public void setMinThreads(Integer minThreads)
getMaxThreads
public Integer getMaxThreads()
setMaxThreads
public void setMaxThreads(Integer maxThreads)
getThreadPool
public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()
setThreadPool
public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool)
getSslContextParameters
public org.apache.camel.util.jsse.SSLContextParameters getSslContextParameters()
setSslContextParameters
public void setSslContextParameters(org.apache.camel.util.jsse.SSLContextParameters sslContextParameters)
getConnectors
public static HashMap<String,org.apache.camel.component.websocket.WebsocketComponent.ConnectorRef> getConnectors()
doStart
protected void doStart()
throws Exception
- Overrides:
doStart
in class org.apache.camel.impl.DefaultComponent
- Throws:
Exception
doStop
public void doStop()
throws Exception
- Overrides:
doStop
in class org.apache.camel.impl.DefaultComponent
- Throws:
Exception
Apache Camel