Package org.jivesoftware.openfire.http
Class HttpBindManager
- java.lang.Object
-
- org.jivesoftware.openfire.http.HttpBindManager
-
- All Implemented Interfaces:
CertificateEventListener,PropertyEventListener
public final class HttpBindManager extends Object implements CertificateEventListener, PropertyEventListener
Responsible for making available BOSH (functionality to the outside world, using an embedded web server.
-
-
Field Summary
Fields Modifier and Type Field Description static Map<String,Boolean>HTTP_BIND_ALLOWED_ORIGINSstatic StringHTTP_BIND_AUTH_PER_CLIENTCERT_POLICYstatic StringHTTP_BIND_CORS_ALLOW_HEADERS_DEFAULTstatic StringHTTP_BIND_CORS_ALLOW_METHODS_DEFAULTstatic StringHTTP_BIND_CORS_ALLOW_ORIGINstatic StringHTTP_BIND_CORS_ALLOW_ORIGIN_DEFAULTstatic StringHTTP_BIND_CORS_ENABLEDstatic booleanHTTP_BIND_CORS_ENABLED_DEFAULTstatic StringHTTP_BIND_CORS_MAX_AGE_DEFAULTstatic StringHTTP_BIND_ENABLEDstatic booleanHTTP_BIND_ENABLED_DEFAULTstatic StringHTTP_BIND_PORTstatic intHTTP_BIND_PORT_DEFAULTstatic StringHTTP_BIND_REQUEST_HEADER_SIZEstatic intHTTP_BIND_REQUEST_HEADER_SIZE_DEFAULTstatic StringHTTP_BIND_SECURE_PORTstatic intHTTP_BIND_SECURE_PORT_DEFAULTstatic StringHTTP_BIND_THREADSstatic intHTTP_BIND_THREADS_DEFAULT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJettyHandler(org.eclipse.jetty.server.Handler handler)Adds a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) functionality.protected org.eclipse.jetty.server.HandlercreateBoshHandler()Creates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality.protected org.eclipse.jetty.server.HandlercreateCrossDomainHandler()Creates a Jetty context handler that can be used to expose the cross-domain functionality as implemented byFlashCrossDomainServlet.protected org.eclipse.jetty.server.HandlercreateStaticContentHandler()Creates a Jetty context handler that can be used to expose static files.protected org.eclipse.jetty.server.HandlercreateWebsocketHandler()Creates a Jetty context handler that can be used to expose Websocket functionality.StringgetCORSAllowOrigin()StringgetHttpBindSecureAddress()intgetHttpBindSecurePort()Returns the HTTP binding port which uses SSL.StringgetHttpBindUnsecureAddress()intgetHttpBindUnsecurePort()Returns the HTTP binding port which does not use SSL.static HttpBindManagergetInstance()StringgetJavaScriptUrl()HttpSessionManagergetSessionManager()StringgetXFFHeader()StringgetXFFHostHeader()StringgetXFFHostName()StringgetXFFServerHeader()booleanisAllOriginsAllowed()booleanisCORSEnabled()booleanisHttpBindActive()Returns true if a listener on the HTTP binding port is running.booleanisHttpBindEnabled()Returns true if the HTTP binding server is currently enabled.booleanisHttpsBindActive()Returns true if a listener on the HTTPS binding port is running.booleanisScriptSyntaxEnabled()Returns true if script syntax is enabled.booleanisThisOriginAllowed(String origin)booleanisXFFEnabled()voidpropertyDeleted(String property, Map<String,Object> params)A property was deleted.voidpropertySet(String property, Map<String,Object> params)A property was set.voidremoveJettyHandler(org.eclipse.jetty.server.Handler handler)Removes a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) functionality.voidsetCORSAllowOrigin(String origins)voidsetCORSEnabled(Boolean value)voidsetHttpBindEnabled(boolean isEnabled)voidsetHttpBindPorts(int unsecurePort, int securePort)Set the ports on which the HTTP binding service will be running.voidsetScriptSyntaxEnabled(boolean isEnabled)Enables or disables script syntax.voidsetXFFEnabled(boolean enabled)voidsetXFFHeader(String header)voidsetXFFHostHeader(String header)voidsetXFFHostName(String name)voidsetXFFServerHeader(String header)voidstart()voidstop()voidstoreContentChanged(CertificateStore store)Event triggered when the content of a certificate store was changed.voidxmlPropertyDeleted(String property, Map<String,Object> params)An XML property was deleted.voidxmlPropertySet(String property, Map<String,Object> params)An XML property was set.
-
-
-
Field Detail
-
HTTP_BIND_ENABLED
public static final String HTTP_BIND_ENABLED
- See Also:
- Constant Field Values
-
HTTP_BIND_ENABLED_DEFAULT
public static final boolean HTTP_BIND_ENABLED_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_PORT
public static final String HTTP_BIND_PORT
- See Also:
- Constant Field Values
-
HTTP_BIND_PORT_DEFAULT
public static final int HTTP_BIND_PORT_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_SECURE_PORT
public static final String HTTP_BIND_SECURE_PORT
- See Also:
- Constant Field Values
-
HTTP_BIND_SECURE_PORT_DEFAULT
public static final int HTTP_BIND_SECURE_PORT_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_THREADS
public static final String HTTP_BIND_THREADS
- See Also:
- Constant Field Values
-
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
public static final String HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
- See Also:
- Constant Field Values
-
HTTP_BIND_THREADS_DEFAULT
public static final int HTTP_BIND_THREADS_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ENABLED
public static final String HTTP_BIND_CORS_ENABLED
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ENABLED_DEFAULT
public static final boolean HTTP_BIND_CORS_ENABLED_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ALLOW_ORIGIN
public static final String HTTP_BIND_CORS_ALLOW_ORIGIN
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ALLOW_ORIGIN_DEFAULT
public static final String HTTP_BIND_CORS_ALLOW_ORIGIN_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ALLOW_METHODS_DEFAULT
public static final String HTTP_BIND_CORS_ALLOW_METHODS_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_ALLOW_HEADERS_DEFAULT
public static final String HTTP_BIND_CORS_ALLOW_HEADERS_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_CORS_MAX_AGE_DEFAULT
public static final String HTTP_BIND_CORS_MAX_AGE_DEFAULT
- See Also:
- Constant Field Values
-
HTTP_BIND_REQUEST_HEADER_SIZE
public static final String HTTP_BIND_REQUEST_HEADER_SIZE
- See Also:
- Constant Field Values
-
HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT
public static final int HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static HttpBindManager getInstance()
-
start
public void start()
-
stop
public void stop()
-
getSessionManager
public HttpSessionManager getSessionManager()
-
isHttpBindEnabled
public boolean isHttpBindEnabled()
Returns true if the HTTP binding server is currently enabled.- Returns:
- true if the HTTP binding server is currently enabled.
-
isHttpBindActive
public boolean isHttpBindActive()
Returns true if a listener on the HTTP binding port is running.- Returns:
- true if a listener on the HTTP binding port is running.
-
isHttpsBindActive
public boolean isHttpsBindActive()
Returns true if a listener on the HTTPS binding port is running.- Returns:
- true if a listener on the HTTPS binding port is running.
-
getHttpBindUnsecureAddress
public String getHttpBindUnsecureAddress()
-
getHttpBindSecureAddress
public String getHttpBindSecureAddress()
-
getJavaScriptUrl
public String getJavaScriptUrl()
-
isCORSEnabled
public boolean isCORSEnabled()
-
setCORSEnabled
public void setCORSEnabled(Boolean value)
-
getCORSAllowOrigin
public String getCORSAllowOrigin()
-
setCORSAllowOrigin
public void setCORSAllowOrigin(String origins)
-
isAllOriginsAllowed
public boolean isAllOriginsAllowed()
-
isThisOriginAllowed
public boolean isThisOriginAllowed(String origin)
-
isXFFEnabled
public boolean isXFFEnabled()
-
setXFFEnabled
public void setXFFEnabled(boolean enabled)
-
getXFFHeader
public String getXFFHeader()
-
setXFFHeader
public void setXFFHeader(String header)
-
getXFFServerHeader
public String getXFFServerHeader()
-
setXFFServerHeader
public void setXFFServerHeader(String header)
-
getXFFHostHeader
public String getXFFHostHeader()
-
setXFFHostHeader
public void setXFFHostHeader(String header)
-
getXFFHostName
public String getXFFHostName()
-
setXFFHostName
public void setXFFHostName(String name)
-
setHttpBindEnabled
public void setHttpBindEnabled(boolean isEnabled)
-
setHttpBindPorts
public void setHttpBindPorts(int unsecurePort, int securePort) throws ExceptionSet the ports on which the HTTP binding service will be running.- Parameters:
unsecurePort- the unsecured connection port which clients can connect to.securePort- the secured connection port which clients can connect to.- Throws:
Exception- when there is an error configuring the HTTP binding ports.
-
createBoshHandler
protected org.eclipse.jetty.server.Handler createBoshHandler()
Creates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality. Note that an invocation of this method will not register the handler (and thus make the related functionality available to the end user). Instead, the created handler is returned by this method, and will need to be registered with the embedded Jetty webserver by the caller.- Returns:
- A Jetty context handler (never null).
-
createWebsocketHandler
protected org.eclipse.jetty.server.Handler createWebsocketHandler()
Creates a Jetty context handler that can be used to expose Websocket functionality. Note that an invocation of this method will not register the handler (and thus make the related functionality available to the end user). Instead, the created handler is returned by this method, and will need to be registered with the embedded Jetty webserver by the caller.- Returns:
- A Jetty context handler (never null).
-
createCrossDomainHandler
protected org.eclipse.jetty.server.Handler createCrossDomainHandler()
Creates a Jetty context handler that can be used to expose the cross-domain functionality as implemented byFlashCrossDomainServlet. Note that an invocation of this method will not register the handler (and thus make the related functionality available to the end user). Instead, the created handler is returned by this method, and will need to be registered with the embedded Jetty webserver by the caller.- Returns:
- A Jetty context handler (never null).
-
createStaticContentHandler
protected org.eclipse.jetty.server.Handler createStaticContentHandler()
Creates a Jetty context handler that can be used to expose static files. Note that an invocation of this method will not register the handler (and thus make the related functionality available to the end user). Instead, the created handler is returned by this method, and will need to be registered with the embedded Jetty webserver by the caller.- Returns:
- A Jetty context handler, or null when the static content could not be accessed.
-
addJettyHandler
public void addJettyHandler(org.eclipse.jetty.server.Handler handler)
Adds a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) functionality.- Parameters:
handler- The handler (cannot be null).
-
removeJettyHandler
public void removeJettyHandler(org.eclipse.jetty.server.Handler handler)
Removes a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) functionality. Removing a handler, even when null, or non-existing, might have side-effects as introduced by the Jetty implementation. At the time of writing, Jetty will re- Parameters:
handler- The handler (should not be null).
-
getHttpBindUnsecurePort
public int getHttpBindUnsecurePort()
Returns the HTTP binding port which does not use SSL.- Returns:
- the HTTP binding port which does not use SSL.
-
getHttpBindSecurePort
public int getHttpBindSecurePort()
Returns the HTTP binding port which uses SSL.- Returns:
- the HTTP binding port which uses SSL.
-
isScriptSyntaxEnabled
public boolean isScriptSyntaxEnabled()
Returns true if script syntax is enabled. Script syntax allows BOSH to be used in environments where clients may be restricted to using a particular server. Instead of using standard HTTP Post requests to transmit data, HTTP Get requests are used.- Returns:
- true if script syntax is enabled.
- See Also:
- BOSH: Alternative Script Syntax
-
setScriptSyntaxEnabled
public void setScriptSyntaxEnabled(boolean isEnabled)
Enables or disables script syntax.- Parameters:
isEnabled- true to enable script syntax and false to disable it.- See Also:
isScriptSyntaxEnabled(), BOSH: Alternative Script Syntax
-
propertySet
public void propertySet(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListenerA property was set. The parameter mapparamswill contain the the value of the property under the keyvalue.- Specified by:
propertySetin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
propertyDeleted
public void propertyDeleted(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListenerA property was deleted.- Specified by:
propertyDeletedin interfacePropertyEventListener- Parameters:
property- the name of the property deleted.params- event parameters.
-
xmlPropertySet
public void xmlPropertySet(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListenerAn XML property was set. The parameter mapparamswill contain the the value of the property under the keyvalue.- Specified by:
xmlPropertySetin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
xmlPropertyDeleted
public void xmlPropertyDeleted(String property, Map<String,Object> params)
Description copied from interface:PropertyEventListenerAn XML property was deleted.- Specified by:
xmlPropertyDeletedin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
storeContentChanged
public void storeContentChanged(CertificateStore store)
Description copied from interface:CertificateEventListenerEvent triggered when the content of a certificate store was changed.- Specified by:
storeContentChangedin interfaceCertificateEventListener- Parameters:
store- The store for which the content was changed.
-
-