Package org.jivesoftware.openfire.http
Class HttpBindManager
java.lang.Object
org.jivesoftware.openfire.http.HttpBindManager
- All Implemented Interfaces:
CertificateEventListener
Responsible for making available BOSH (functionality to the outside world, using an embedded web server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Set<String>>The domain names that are accepted as values for the CORS 'Origin' header in the BOSH endpoint.static final SystemProperty<String>The TLS 'mutual authentication' policy that is applied to the BOSH endpoint.static final SystemProperty<Boolean>Enable / Disable adding a 'Content-Security-Policy' HTTP header to the response to requests made against the BOSH endpoint.static final SystemProperty<String>The header value when adding a 'Content-Security-Policy' HTTP header to the response to requests made against the BOSH endpoint.static final SystemProperty<Set<String>>The name of HTTP headers that are accepted in requests to the BOSH endpoint.static final SystemProperty<Set<String>>The HTTP methods that are accepted in the BOSH endpoint.static final StringThe Cross-Origin Resource Sharing (CORS) header value that represents the 'allow all orgins' state.static final SystemProperty<Boolean>Enable / Disable support for Cross-Origin Resource Sharing (CORS) headers in the BOSH endpoint.static final SystemProperty<Duration>How long the results of a preflight request (that is the information contained in the Access-Control-Allow-Methods and Access-Control-Allow-Headers headers) can be cached.static final SystemProperty<Boolean>Enable / disable BOSH (HTTP Binding) functionality.static final SystemProperty<Boolean>Enable / Disable parsing a 'X-Forwarded-For' style HTTP header of BOSH requests.static final SystemProperty<String>The HTTP header name for 'forwarded for'static final SystemProperty<String>The HTTP header name for 'forwarded' (per RFC 7239).static final SystemProperty<String>The HTTP header name for 'forwarded hosts'.static final SystemProperty<String>Sets a forced valued for the host header.static final SystemProperty<String>The HTTP header name for 'forwarded server'.static final SystemProperty<Set<String>>Defines the set of trusted reverse proxies.static final SystemProperty<Integer>TCP port on which the non-encrypted (HTTP) BOSH endpoint is exposed.static final SystemProperty<Integer>the maximum size in bytes of request headers in the BOSH endpoint.static final SystemProperty<Integer>TCP port on which the encrypted (HTTPS) BOSH endpoint is exposed.static final SystemProperty<Duration>Duration of the maximum duration of gracefully stopping the embedded webserver that is hosting the BOSH endpoint (among others).static final SystemProperty<Integer>Maximum amount of threads in the thread pool to perform the network IO related to BOSH traffic.static final SystemProperty<Integer>Minimum amount of threads in the thread pool to perform the network IO related to BOSH traffic.static final SystemProperty<Duration>Amount of time after which idle, surplus threads are removed from the thread pool to perform the network IO related to BOSH traffic.static final SystemProperty<Boolean>Enable / disable logging of BOSH requests and responses. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJettyHandler(org.eclipse.jetty.ee8.nested.ContextHandler handler) Adds a Jetty handler to be added to the embedded web server that is used to expose Openfire's public web-bindings (eg: BOSH / HTTP-bind and websocket).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.ee8.servlet.ServletContextHandlerCreates a Jetty context handler that can be used to expose BOSH (HTTP-Bind) functionality.protected org.eclipse.jetty.ee8.servlet.ServletContextHandlerCreates a Jetty context handler that can be used to expose static files.protected org.eclipse.jetty.ee8.servlet.ServletContextHandlerCreates a Jetty context handler that can be used to expose Websocket functionality.static HttpBindManagerbooleanbooleanReturns true if a listener on the HTTP binding port is running.booleanReturns true if the HTTP binding server is currently enabled.booleanReturns true if a listener on the HTTPS binding port is running.booleanReturns true if script syntax is enabled.booleanisThisOriginAllowed(String origin) voidremoveJettyHandler(org.eclipse.jetty.ee8.nested.ContextHandler handler) Removes a Jetty handler to be added to the embedded web server that is used to expose Openfire's public web-bindings (eg: BOSH / HTTP-bind and websocket).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.static voidStatic reference forrestartServer()that can be used as a listener of aSystemProperty.voidsetScriptSyntaxEnabled(boolean isEnabled) Enables or disables script syntax.voidsetStopTimeout(Duration stopTimeout) voidstart()voidstop()voidEvent triggered when the content of a certificate store was changed.static voidupdateStopTimeout(Duration stopTimeout) Static reference forsetStopTimeout(Duration)that can be used as a listener of aSystemProperty.
-
Field Details
-
LOG_HTTPBIND_ENABLED
Enable / disable logging of BOSH requests and responses. -
HTTP_BIND_ENABLED
Enable / disable BOSH (HTTP Binding) functionality. -
HTTP_BIND_PORT
TCP port on which the non-encrypted (HTTP) BOSH endpoint is exposed. -
HTTP_BIND_SECURE_PORT
TCP port on which the encrypted (HTTPS) BOSH endpoint is exposed. -
HTTP_BIND_STOP_TIMEOUT
Duration of the maximum duration of gracefully stopping the embedded webserver that is hosting the BOSH endpoint (among others). -
HTTP_BIND_THREADS_MIN
Minimum amount of threads in the thread pool to perform the network IO related to BOSH traffic. Note: Apart from the network-IO threads configured in this property, the server also uses a thread pool for processing the inbound data (as configured in (HttpSessionManager.MAX_POOL_SIZE). BOSH installations expecting heavy loads may want to allocate additional threads to this worker pool to ensure timely processing of data -
HTTP_BIND_THREADS
Maximum amount of threads in the thread pool to perform the network IO related to BOSH traffic. Note: Apart from the network-IO threads configured in this property, the server also uses a thread pool for processing the inbound data (as configured in (HttpSessionManager.MAX_POOL_SIZE). BOSH installations expecting heavy loads may want to allocate additional threads to this worker pool to ensure timely processing of data -
HTTP_BIND_THREADS_TIMEOUT
Amount of time after which idle, surplus threads are removed from the thread pool to perform the network IO related to BOSH traffic. Note: Apart from the network-IO threads configured in this property, the server also uses a thread pool for processing the inbound data (as configured in (HttpSessionManager.INACTIVITY_TIMEOUT). BOSH installations expecting heavy loads may want to allocate additional threads to this worker pool to ensure timely processing of data -
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
The TLS 'mutual authentication' policy that is applied to the BOSH endpoint. -
HTTP_BIND_FORWARDED
Enable / Disable parsing a 'X-Forwarded-For' style HTTP header of BOSH requests. -
HTTP_BIND_FORWARDED_HEADER
The HTTP header name for 'forwarded' (per RFC 7239). -
HTTP_BIND_FORWARDED_FOR
The HTTP header name for 'forwarded for' -
HTTP_BIND_FORWARDED_SERVER
The HTTP header name for 'forwarded server'. -
HTTP_BIND_FORWARDED_HOST
The HTTP header name for 'forwarded hosts'. -
HTTP_BIND_FORWARDED_HOST_NAME
Sets a forced valued for the host header. -
HTTP_BIND_FORWARDED_TRUSTED_PROXIES
Defines the set of trusted reverse proxies. When this property is configured (non-empty), 'Forwarded' and 'X-Forwarded-*' HTTP headers are only honored if the direct peer (the socket-level remote address) of the request matches one of the configured trusted proxies. If the peer is not trusted, these headers are ignored and the request's original remote address is used instead. This setting helps prevent spoofing of client IP addresses via forged forwarding headers and should be configured when Openfire is deployed behind one or more reverse proxies. Values can be individual IP addresses (IPv4 or IPv6) as well as IP ranges (for example, in CIDR notation). -
HTTP_BIND_CORS_ENABLED
Enable / Disable support for Cross-Origin Resource Sharing (CORS) headers in the BOSH endpoint. -
HTTP_BIND_CORS_ALLOW_ORIGIN_ALL
The Cross-Origin Resource Sharing (CORS) header value that represents the 'allow all orgins' state.- See Also:
-
HTTP_BIND_ALLOWED_ORIGINS
The domain names that are accepted as values for the CORS 'Origin' header in the BOSH endpoint. -
HTTP_BIND_CONTENT_SECURITY_POLICY_ENABLED
Enable / Disable adding a 'Content-Security-Policy' HTTP header to the response to requests made against the BOSH endpoint. -
HTTP_BIND_CONTENT_SECURITY_POLICY_RESPONSEVALUE
The header value when adding a 'Content-Security-Policy' HTTP header to the response to requests made against the BOSH endpoint. -
HTTP_BIND_CORS_ALLOW_METHODS
The HTTP methods that are accepted in the BOSH endpoint. -
HTTP_BIND_CORS_ALLOW_HEADERS
The name of HTTP headers that are accepted in requests to the BOSH endpoint. -
HTTP_BIND_CORS_MAX_AGE
How long the results of a preflight request (that is the information contained in the Access-Control-Allow-Methods and Access-Control-Allow-Headers headers) can be cached. -
HTTP_BIND_REQUEST_HEADER_SIZE
the maximum size in bytes of request headers in the BOSH endpoint. Larger headers will allow for more and/or larger cookies plus larger form content encoded in a URL. However, larger headers consume more memory and can make a server more vulnerable to denial of service attacks.
-
-
Method Details
-
getInstance
-
start
public void start() -
stop
public void stop() -
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.
-
getWebsocketUnsecureAddress
-
getWebsocketSecureAddress
-
getHttpBindUnsecureAddress
-
getHttpBindSecureAddress
-
isAllOriginsAllowed
public boolean isAllOriginsAllowed() -
isThisOriginAllowed
-
createBoshHandler
protected org.eclipse.jetty.ee8.servlet.ServletContextHandler 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.ee8.servlet.ServletContextHandler 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).
-
createStaticContentHandler
protected org.eclipse.jetty.ee8.servlet.ServletContextHandler 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(@Nonnull org.eclipse.jetty.ee8.nested.ContextHandler handler) Adds a Jetty handler to be added to the embedded web server that is used to expose Openfire's public web-bindings (eg: BOSH / HTTP-bind and websocket).- Parameters:
handler- The handler (cannot be null).
-
removeJettyHandler
public void removeJettyHandler(@Nonnull org.eclipse.jetty.ee8.nested.ContextHandler handler) Removes a Jetty handler to be added to the embedded web server that is used to expose Openfire's public web-bindings (eg: BOSH / HTTP-bind and websocket).- Parameters:
handler- The handler (should not be null).
-
addJettyHandler
public void addJettyHandler(@Nonnull 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(@Nonnull 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).
-
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:
-
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:
-
restart
Static reference forrestartServer()that can be used as a listener of aSystemProperty. The provided argument is ignored. -
storeContentChanged
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.
-
updateStopTimeout
Static reference forsetStopTimeout(Duration)that can be used as a listener of aSystemProperty. -
setStopTimeout
-