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_ORIGINS
static String
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
static String
HTTP_BIND_CORS_ALLOW_HEADERS_DEFAULT
static String
HTTP_BIND_CORS_ALLOW_METHODS_DEFAULT
static String
HTTP_BIND_CORS_ALLOW_ORIGIN
static String
HTTP_BIND_CORS_ALLOW_ORIGIN_DEFAULT
static String
HTTP_BIND_CORS_ENABLED
static boolean
HTTP_BIND_CORS_ENABLED_DEFAULT
static String
HTTP_BIND_CORS_MAX_AGE_DEFAULT
static String
HTTP_BIND_ENABLED
static boolean
HTTP_BIND_ENABLED_DEFAULT
static String
HTTP_BIND_PORT
static int
HTTP_BIND_PORT_DEFAULT
static String
HTTP_BIND_REQUEST_HEADER_SIZE
static int
HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT
static String
HTTP_BIND_SECURE_PORT
static int
HTTP_BIND_SECURE_PORT_DEFAULT
static String
HTTP_BIND_THREADS
static int
HTTP_BIND_THREADS_DEFAULT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected org.eclipse.jetty.server.Handler
createBoshHandler()
Creates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality.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
.protected org.eclipse.jetty.server.Handler
createStaticContentHandler()
Creates a Jetty context handler that can be used to expose static files.protected org.eclipse.jetty.server.Handler
createWebsocketHandler()
Creates a Jetty context handler that can be used to expose Websocket functionality.String
getCORSAllowOrigin()
String
getHttpBindSecureAddress()
int
getHttpBindSecurePort()
Returns the HTTP binding port which uses SSL.String
getHttpBindUnsecureAddress()
int
getHttpBindUnsecurePort()
Returns the HTTP binding port which does not use SSL.static HttpBindManager
getInstance()
String
getJavaScriptUrl()
HttpSessionManager
getSessionManager()
String
getXFFHeader()
String
getXFFHostHeader()
String
getXFFHostName()
String
getXFFServerHeader()
boolean
isAllOriginsAllowed()
boolean
isCORSEnabled()
boolean
isHttpBindActive()
Returns true if a listener on the HTTP binding port is running.boolean
isHttpBindEnabled()
Returns true if the HTTP binding server is currently enabled.boolean
isHttpsBindActive()
Returns true if a listener on the HTTPS binding port is running.boolean
isScriptSyntaxEnabled()
Returns true if script syntax is enabled.boolean
isThisOriginAllowed(String origin)
boolean
isXFFEnabled()
void
propertyDeleted(String property, Map<String,Object> params)
A property was deleted.void
propertySet(String property, Map<String,Object> params)
A property was set.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.void
setCORSAllowOrigin(String origins)
void
setCORSEnabled(Boolean value)
void
setHttpBindEnabled(boolean isEnabled)
void
setHttpBindPorts(int unsecurePort, int securePort)
Set the ports on which the HTTP binding service will be running.void
setScriptSyntaxEnabled(boolean isEnabled)
Enables or disables script syntax.void
setXFFEnabled(boolean enabled)
void
setXFFHeader(String header)
void
setXFFHostHeader(String header)
void
setXFFHostName(String name)
void
setXFFServerHeader(String header)
void
start()
void
stop()
void
storeContentChanged(CertificateStore store)
Event triggered when the content of a certificate store was changed.void
xmlPropertyDeleted(String property, Map<String,Object> params)
An XML property was deleted.void
xmlPropertySet(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 Exception
Set 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:PropertyEventListener
A property was set. The parameter mapparams
will contain the the value of the property under the keyvalue
.- Specified by:
propertySet
in 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:PropertyEventListener
A property was deleted.- Specified by:
propertyDeleted
in 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:PropertyEventListener
An XML property was set. The parameter mapparams
will contain the the value of the property under the keyvalue
.- Specified by:
xmlPropertySet
in 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:PropertyEventListener
An XML property was deleted.- Specified by:
xmlPropertyDeleted
in interfacePropertyEventListener
- Parameters:
property
- the name of the property.params
- event parameters.
-
storeContentChanged
public void storeContentChanged(CertificateStore store)
Description copied from interface:CertificateEventListener
Event triggered when the content of a certificate store was changed.- Specified by:
storeContentChanged
in interfaceCertificateEventListener
- Parameters:
store
- The store for which the content was changed.
-
-