[undertow-dev] How to Access ServletContext?

Stuart Douglas sdouglas at redhat.com
Tue Aug 11 20:18:20 EDT 2015


Undertow does not do discovery or metadata/annotation parsing. This is expected to be handled by the embedding container (so the embedding container has complete control over what is deployed).

How are you setting up Resteasy?

Stuart

----- Original Message -----
> From: "Ari King" <ari.brandeis.king at gmail.com>
> To: "Stuart Douglas" <sdouglas at redhat.com>
> Cc: undertow-dev at lists.jboss.org
> Sent: Wednesday, 12 August, 2015 10:08:34 AM
> Subject: Re: [undertow-dev] How to Access ServletContext?
> 
> Hi Stuart,
> 
> Thanks for the clarification. As a follow-up, does undertow handle/expose
> servlets like conventional containers (tomcat, jetty, etc)? I ask, because
> injecting a HttpServletRequest via a context annotation in a resource
> method causes the following error:
> 
> org.jboss.resteasy.spi.LoggableFailure: Unable to find contextual data of
> type: javax.servlet.http.HttpServletRequest
> 
> -Ari
> 
> On Mon, Aug 10, 2015 at 7:06 AM, Stuart Douglas <sdouglas at redhat.com> wrote:
> 
> >
> >
> > ----- Original Message -----
> > > From: "Ari King" <ari.brandeis.king at gmail.com>
> > > To: undertow-dev at lists.jboss.org
> > > Sent: Saturday, 8 August, 2015 7:53:00 AM
> > > Subject: [undertow-dev] How to Access ServletContext?
> > >
> > > I've embedded Undertow into a Resteasy (JAX-RS) app. One of the
> > libraries I'm
> > > using requires a servlet context attribute to be set. How can/should I go
> > > about doing so?
> > >
> > > If I should use a ServletExtension, to clarify, I need to create a file
> > named
> > > " io.undertow.servlet.ServletExtension" and put it in the
> > > "META-INF/services/ " directory?
> > >
> > > Within the above mentioned file do I need to provide the fully qualified
> > name
> > > of the implementation class?
> >
> > Yes, although there are some other options:
> >
> > - You can use io.undertow.servlet.api.DeploymentInfo#addServletExtension
> > to create the extension yourself
> > - You can also use a ServletContainerInitializer or ServletContextListener
> > instead of a ServletExtension
> > - In your embedding code you can call
> > DeploymentManager.getDeployment().getServletContext()
> >
> > Stuart
> >
> >
> > >
> > > Thanks.
> > >
> > > Best,
> > > Ari
> > >
> > > _______________________________________________
> > > undertow-dev mailing list
> > > undertow-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/undertow-dev
> >
> 


More information about the undertow-dev mailing list