Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Unexpected behavior with ContextHandler/ResourceHandler ( with etags ) and WebAppContext and overlapping contexts

Don't mix WebAppContext with ResourceHandlers on the same context path.

Since you have a WebAppContext at contextPath "/" that means it is 100% in control over all content in that context.

If you want to have static resources (like what your ResourceHandler configuration is doing) on a different location, use an extra DefaultServlet.

See https://stackoverflow.com/questions/20207477/serving-static-files-from-alternate-path-in-embedded-jetty

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Thu, Oct 12, 2017 at 10:28 AM, Beleznay, David (Relic) <David.Beleznay@xxxxxxxxx> wrote:

Hi there,

 

We have 2 contexts

A web app context handling /

A ContextHandler with ResourceHandler with etags turned on handling /html

 

When we try to access something from the /html directory, the first time it works.  ( it only goes to the ContextHandler )

When we try to access it a second time the Resource handler returns a 304 and does not set Committed to true ( approx. line 283 of Resource handler ) and so it falls back to the web app context.   Our WebAppContext doesn’t know how to handle it, and so errors.

When we try a 3rd time, it’s back to working.

 

 

This used to work for us on Jetty 9.3.9.v20160517  but when we upgraded to jetty 9.4.6.v20170531 it broke,  I’m not sure if this expected behavior or not.

 

For now we’ve made our webapp context ignore paths starting with /html, but this seems like the wrong approach.  Shouldn’t the resource handler be setting handled to true ?

 

Cheers,

 

David Beleznay

 

 


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top