[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] AbstractHttpConnection's NullPointerException
|
You are applying servlet concepts to the ResourceHandler, which is based on the Jetty internal Handler concepts, which are not a strict participant in the servlet infrastructure. They are more fundamental. In fact, the entire servlet layer is built on-top of the Handler layer in Jetty.
The ResourceHandler needs a pathInfo to know what resource you are requesting from the resourceBase.
If you want to use the ResourceHandler, don't use the WebAppContext, use the ContextHandler instead. Different behavior.
If you want to serve static content and servlets, here's 2 choices.
1) use the DefaultServlet in your webapp (war). It is built-into the servlet support of jetty.
See ${jetty.home}/etc/webdefault.xml to see its default configuration.
Note: the DefaultServlet itself uses the Resource framework to serve static content.
2) split the Jetty handling of your static content from the webapp handling your dynamic content.
This can be accomplished with 2 deployable apps. 1 using the ContextHandler for static content, and the other using WebAppContext for your webapp.
--
Developer advice, services and support
from the Jetty & CometD experts
On Fri, Jan 25, 2013 at 1:47 PM, Libor Jelinek
<ljelinek@xxxxxxxxxxx> wrote:
Hi Joakim!
I agree that more proper is just ContextHandler if I plan to serve just static files but how this could be invalid to use WebAppContext if WebAppContext is indirect child of ContextHandler?
You mention that this NPE is caused by not having set pathInfo correctly but it's absolutelly valid to have null pathInfo() [1]. Root context path (/) couldn't have pathInfo (/somePathInfo) by nature since otherwise it may collides with another servlet (with servlet deployed at somePathInfo context path to continue my example).
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users