Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Embedded Jetty 9.2.13 - Loading static resources with spaces in an uber jar

I used this test/example project - https://github.com/jetty-project/embedded-jetty-uber-jar

Just add some "problematic" resources to src/main/resources/webroot/ , start the server and test access to them.

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Sun, Sep 13, 2015 at 10:44 PM, Melissa Mifsud <melissa.anne.mifsud@xxxxxxxxx> wrote:

Thanks for the follow-up. I was investigating the problem with the same version (9.3.2.v20150730). I debugged it all the way through, so I am uncertain as to why we have different outcomes.

Is your embedded Jetty application in the uber jar as well? My application hosts an embedded Jetty server and is packaged and run from a single uber jar (which also contains all the resources).

I'm not really sure that would make a difference from what I could see whilst debugging.

I will re-test soon.

Melissa

On 11 Sep 2015 08:47, "Joakim Erdfelt" <joakim@xxxxxxxxxxx> wrote:
Unable to reproduce this with Jetty 9.3.2.v20150730 and all content in an uber-jar
Works fine with a Spaces and Encoded characters.


GET /deep/dir%20with%20space/%C3%9Cber.txt HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

HTTP/1.1 200 OK
Date: Thu, 10 Sep 2015 22:44:03 GMT
Last-Modified: Thu, 10 Sep 2015 22:39:43 GMT
Content-Type: text/plain;charset=utf-8
Accept-Ranges: bytes
Content-Length: 23
Server: Jetty(9.3.2.v20150730)

This is the Über file.



Joakim Erdfelt / joakim@xxxxxxxxxxx

On Mon, Sep 7, 2015 at 10:15 PM, Melissa Mifsud <melissa.anne.mifsud@xxxxxxxxx> wrote:
I've debugged the problem:

  • The path is encoded by URIUtil.encodePath() [space replaced by '%20']
  • When looking up the file within the jar in JarFileResource.exists(), the encoded path is being compared to JarEntry.name() which is not encoded.

That way the file is never found.

I will submit a bug, test case and a description of my investigation.

Melissa


On Mon, Sep 7, 2015 at 5:01 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Hi,

On Mon, Sep 7, 2015 at 7:29 AM, Melissa Mifsud
<melissa.anne.mifsud@xxxxxxxxx> wrote:
> I have migrated from Jetty 8 to 9 and everything seemed to be going well.
>
> I am running an embedded Jetty application from an uber jar. After the
> upgrade, I noticed that static resources (located in the jar) are resulting
> in 404 errors but only for resources with a space character in the file
> name!
>
> ex: http://{host}/js/widgets/shape/simple%20circle.svg
>
> This all worked fine under Jetty 8.

Can you put up a reproducible test case and attach it to an issue you
create at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Jetty ?

Thanks !

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
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



--


Melissa Anne Mifsud





_______________________________________________
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


_______________________________________________
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

_______________________________________________
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