Here's an alternate way to set it up.

My jetty-base ...

[demo-jersey-2]$ tree -F
demo-jersey-2/
├── resources/
│   └── jetty-logging.properties
├── start.d/
│   ├── deploy.ini
│   └── http.ini
└── webapps/
    └── jersey.war


This is pretty much all defaults on Jetty.
I have enabled the modules http,deploy only.
If I start this jetty-base and check a javascript, I see what you see.

$ curl --dump-header - -o /dev/null
http://localhost:8080/jersey/js/engine.js
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current
                                 Dload  Upload   Total   Spent    Left
 Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--
  0
HTTP/1.1 200 OK
Last-Modified: Sat, 19 Dec 2020 23:24:00 GMT
Content-Type: text/javascript
Accept-Ranges: bytes
Content-Length: 2669
Server: Jetty(10.0.16)

100  2669  100  2669    0     0  31086      0 --:--:-- --:--:-- --:--:--
31400


Now if I add a webapps/jetty.xml that has the following contents ...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
https://www.eclipse.org/jetty/configure_10_0.dtd";>
<Configure id="webapp" class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/jersey</Set>
  <Set name="war"><Property name="jetty.webapps" default="."
/>/jersey.war</Set>
  <Get name="mimeTypes">
    <Call name="addMimeMapping">
      <Arg>js</Arg>
      <Arg>text/javascript;charset=UTF-8</Arg>
    </Call>
  </Get>
</Configure>


Which makes the jetty-base look like this ...

[demo-jersey-2]$ tree -F
demo-jersey-2/
├── resources/
│   └── jetty-logging.properties
├── start.d/
│   ├── deploy.ini
│   └── http.ini
└── webapps/
    ├── jersey.war
    └── jersey.xml


Now when I start this jetty-base and access the same javascript, I see this
...

$ curl --dump-header - -o /dev/null
http://localhost:8080/jersey/js/engine.js
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current
                                 Dload  Upload   Total   Spent    Left
 Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--
  0
HTTP/1.1 200 OK
Last-Modified: Sat, 19 Dec 2020 23:24:00 GMT
Content-Type: text/javascript;charset=utf-8
Accept-Ranges: bytes
Content-Length: 2669
Server: Jetty(10.0.16)

100  2669  100  2669    0     0  30899      0 --:--:-- --:--:-- --:--:--
31034


Which includes the charset.

Joakim Erdfelt / joa...@webtide.com
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to