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(a)redhat.com> wrote:
----- Original Message -----
> From: "Ari King" <ari.brandeis.king(a)gmail.com>
> To: undertow-dev(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev