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

Thank you. I'll look into that,  it might be delayed a week as it's currently 'working'

-----Original Message-----
From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of jetty-users-request@xxxxxxxxxxx
Sent: Thursday, October 12, 2017 2:13 PM
To: jetty-users@xxxxxxxxxxx
Subject: jetty-users Digest, Vol 101, Issue 16

Message: 1
Date: Thu, 12 Oct 2017 10:35:45 -0700
From: Joakim Erdfelt <joakim@xxxxxxxxxxx>
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] Unexpected behavior with
	ContextHandler/ResourceHandler ( with etags ) and WebAppContext and
	overlapping contexts
Message-ID:
	<CAK64EJZua+n2cOKvY4kML4W_wJDczys8sWDEQCBwAgqeb4sVRg@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

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
>
>
>
>
>


Back to the top