Package org.glassfish.jersey.jetty
Class JettyHttpContainer
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.glassfish.jersey.jetty.JettyHttpContainer
- All Implemented Interfaces:
org.eclipse.jetty.server.Handler,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.LifeCycle,Container
public final class JettyHttpContainer
extends org.eclipse.jetty.server.handler.AbstractHandler
implements Container
Jersey
Container implementation based on Jetty Handler.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classAn internal binder to enable Jetty HTTP container specific types injection.private static classReferencing factory for Jetty request.private static classReferencing factory for Jetty response.private static final classNested classes/interfaces inherited from class org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandler.ErrorDispatchHandlerNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ApplicationHandlerprivate booleanCached value of configuration propertyServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR.private static final intprivate static final ExtendedLoggerprivate static final Typeprivate static final TypeFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.glassfish.jersey.server.spi.Container
DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORTFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsConstructorDescriptionJettyHttpContainer(javax.ws.rs.core.Application application) Create a new Jetty HTTP container.JettyHttpContainer(javax.ws.rs.core.Application application, Object parentContext) Create a new Jetty HTTP container. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidThe method reads and caches value of configuration propertyServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERRORfor future purposes.protected voiddoStart()Inform this container that the server has been started.voiddoStop()Inform this container that the server is being stopped.Get the Jersey server-side application handler associated with the container.private StringgetBasePath(org.eclipse.jetty.server.Request request) private URIgetBaseUri(org.eclipse.jetty.server.Request request) Return an immutable representation of the currentconfiguration.private URIgetRequestUri(org.eclipse.jetty.server.Request request, URI baseUri) private javax.ws.rs.core.SecurityContextgetSecurityContext(org.eclipse.jetty.server.Request request) private StringgetServerAddress(URI baseUri) voidhandle(String target, org.eclipse.jetty.server.Request request, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) voidreload()Reload the hosted Jersey application using the currentconfiguration.voidreload(ResourceConfig configuration) Reload the hosted Jersey application using a newconfiguration.Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
destroy, doError, getServer, setServerMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Field Details
-
LOGGER
-
REQUEST_TYPE
-
RESPONSE_TYPE
-
INTERNAL_SERVER_ERROR
private static final int INTERNAL_SERVER_ERROR -
configSetStatusOverSendError
private boolean configSetStatusOverSendErrorCached value of configuration propertyServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR. IftruemethodHttpServletResponse.setStatus(int)is used overHttpServletResponse.sendError(int, java.lang.String). -
appHandler
-
-
Constructor Details
-
JettyHttpContainer
JettyHttpContainer(javax.ws.rs.core.Application application, Object parentContext) Create a new Jetty HTTP container.- Parameters:
application- JAX-RS / Jersey application to be deployed on Jetty HTTP container.parentContext- DI provider specific context with application's registered bindings.
-
JettyHttpContainer
JettyHttpContainer(javax.ws.rs.core.Application application) Create a new Jetty HTTP container.- Parameters:
application- JAX-RS / Jersey application to be deployed on Jetty HTTP container.
-
-
Method Details
-
handle
public void handle(String target, org.eclipse.jetty.server.Request request, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws IOException, javax.servlet.ServletException - Specified by:
handlein interfaceorg.eclipse.jetty.server.Handler- Specified by:
handlein classorg.eclipse.jetty.server.handler.AbstractHandler- Throws:
IOExceptionjavax.servlet.ServletException
-
getRequestUri
-
getServerAddress
-
getSecurityContext
private javax.ws.rs.core.SecurityContext getSecurityContext(org.eclipse.jetty.server.Request request) -
getBaseUri
-
getBasePath
-
getConfiguration
Description copied from interface:ContainerReturn an immutable representation of the currentconfiguration.- Specified by:
getConfigurationin interfaceContainer- Returns:
- current configuration of the hosted Jersey application.
-
reload
public void reload()Description copied from interface:ContainerReload the hosted Jersey application using the currentconfiguration. -
reload
Description copied from interface:ContainerReload the hosted Jersey application using a newconfiguration. -
getApplicationHandler
Description copied from interface:ContainerGet the Jersey server-side application handler associated with the container.- Specified by:
getApplicationHandlerin interfaceContainer- Returns:
- Jersey server-side application handler associated with the container.
-
doStart
Inform this container that the server has been started. This method must be implicitly called after the server containing this container is started.- Overrides:
doStartin classorg.eclipse.jetty.server.handler.AbstractHandler- Throws:
Exception- if a problem occurred during server startup.
-
doStop
Inform this container that the server is being stopped. This method must be implicitly called before the server containing this container is stopped.- Overrides:
doStopin classorg.eclipse.jetty.server.handler.AbstractHandler- Throws:
Exception- if a problem occurred during server shutdown.
-
cacheConfigSetStatusOverSendError
private void cacheConfigSetStatusOverSendError()The method reads and caches value of configuration propertyServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERRORfor future purposes.
-