Class JettyHttpServerRegistry
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,HttpServerRegistry
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Method Summary
Modifier and TypeMethodDescriptioninitHttpServer(String schemeAndAuthority) Creates an HTTP server at given URI.registerContext(String schemeAndAuthority, String contextPath, String mediaType, CommunicationLog communicationLog, HttpHandler handler) Registers a handler for HTTP requests destined to the given scheme, authority and context path.registerContext(String schemeAndAuthority, String contextPath, String mediaType, HttpHandler handler) Registers a handler for HTTP requests destined to the given scheme, authority and context path.registerContext(String schemeAndAuthority, String contextPath, CommunicationLog communicationLog, HttpHandler handler) Registers a handler for SOAP messages for the given scheme, authority and context path.registerContext(String schemeAndAuthority, String contextPath, HttpHandler handler) Registers a handler for SOAP messages for the given scheme, authority and context path.protected voidshutDown()protected voidstartUp()voidunregisterContext(String schemeAndAuthority, String contextPath) Removes a handler for the given scheme, authority and context path.Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Method Details
-
startUp
- Specified by:
startUpin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
shutDown
- Specified by:
shutDownin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
initHttpServer
Description copied from interface:HttpServerRegistryCreates an HTTP server at given URI.If there was no running HTTP server found under the passed scheme and authority, this function starts a new one. If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.
- Specified by:
initHttpServerin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- the scheme and authority where to access the HTTP server. If port number is 0, then a random open port is selected and will be part of the returned URI.- Returns:
- the actual assigned URI of the HTTP server.
-
registerContext
Description copied from interface:HttpServerRegistryRegisters a handler for SOAP messages for the given scheme, authority and context path.SOAP messages use the HTTP media type
SoapConstants.MEDIA_TYPE_SOAPfor request and response messages. If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.- Specified by:
registerContextin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- scheme and authority used to start a new or re-use an existing HTTP server.contextPath- the context path where the given registry shall listen to.
Important note: the context path needs to start with a slash.handler- the handler callback that is invoked on a request to the given context path.- Returns:
- the actual full path of the HTTP server address the given handler listens to.
- See Also:
-
registerContext
public String registerContext(String schemeAndAuthority, String contextPath, @Nullable CommunicationLog communicationLog, HttpHandler handler) Description copied from interface:HttpServerRegistryRegisters a handler for SOAP messages for the given scheme, authority and context path.SOAP messages use the HTTP media type
SoapConstants.MEDIA_TYPE_SOAPfor request and response messages. If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.- Specified by:
registerContextin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- scheme and authority used to start a new or re-use an existing HTTP server.contextPath- the context path where the given registry shall listen to.
Important note: the context path needs to start with a slash.communicationLog- optional communication log to be used at incoming HTTP requests. Set to null to use a default communication log.handler- the handler callback that is invoked on a request to the given context path.- Returns:
- the actual full path of the HTTP server address the given handler listens to.
- See Also:
-
registerContext
public String registerContext(String schemeAndAuthority, String contextPath, String mediaType, HttpHandler handler) Description copied from interface:HttpServerRegistryRegisters a handler for HTTP requests destined to the given scheme, authority and context path.If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.
- Specified by:
registerContextin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- scheme and authority used to start a new or re-use an existing HTTP server.contextPath- the context path where the given registry shall listen to.
Important note: the context path needs to start with a slash.mediaType- the media type of the response the handler will produce.handler- the handler callback that is invoked on a request to the given context path.- Returns:
- the actual full path of the HTTP server address the given handler listens to.
- See Also:
-
registerContext
public String registerContext(String schemeAndAuthority, String contextPath, String mediaType, @Nullable CommunicationLog communicationLog, HttpHandler handler) Description copied from interface:HttpServerRegistryRegisters a handler for HTTP requests destined to the given scheme, authority and context path.If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.
- Specified by:
registerContextin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- scheme and authority used to start a new or re-use an existing HTTP server.contextPath- the context path where the given registry shall listen to.
Important note: the context path needs to start with a slash.mediaType- the media type of the response the handler will produce.communicationLog- optional communication log to be used at incoming HTTP requests. Set to null to use a default communication log.handler- the handler callback that is invoked on a request to the given context path.- Returns:
- the actual full path of the HTTP server address the given handler listens to.
- See Also:
-
unregisterContext
Description copied from interface:HttpServerRegistryRemoves a handler for the given scheme, authority and context path.HttpHandler.handle(InputStream, OutputStream, CommunicationContext)will not be called for any request destined to the corresponding handler. Requests to the corresponding are answered with an HTTP 404.- Specified by:
unregisterContextin interfaceHttpServerRegistry- Parameters:
schemeAndAuthority- scheme and authority where the context shall be removed.contextPath- the context path to remove. The context path needs to start with a slash.
-