source: installer/resources/eepsite/contexts/base-context.xml @ 8243b69

Last change on this file since 8243b69 was 8243b69, checked in by zzz <zzz@…>, 5 years ago

Jetty: Add gzip filter to eepsite Jetty (new installs only)

  • Property mode set to 100644
File size: 2.7 KB
Line 
1<?xml version="1.0"  encoding="ISO-8859-1"?>
2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
3
4<!--
5Configure a custom context for the eepsite.
6
7This context contains only a ServletContextHandler with a default servlet
8to serve static html files and images.
9-->
10
11<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
12  <Set name="contextPath">/</Set>
13  <Set name="resourceBase">./eepsite/docroot/</Set>
14  <Call name="setInitParameter">
15    <Arg>org.eclipse.jetty.servlet.Default.cacheControl</Arg>
16    <Arg>max-age=3600,public</Arg>
17  </Call>
18  <Call name="setMimeTypes">
19    <Arg>
20      <New class="org.eclipse.jetty.http.MimeTypes">
21        <Call name="addMimeMapping">
22          <Arg>sud</Arg>
23          <Arg>application/zip</Arg>
24        </Call>
25        <Call name="addMimeMapping">
26          <Arg>su2</Arg>
27          <Arg>application/zip</Arg>
28        </Call>
29        <Call name="addMimeMapping">
30          <Arg>xpi2p</Arg>
31          <Arg>application/zip</Arg>
32        </Call>
33      </New>
34    </Arg>
35  </Call>
36  <Call name="addServlet">
37    <Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
38    <Arg>/</Arg>
39  </Call>
40  <Call name="addServlet">
41    <Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
42    <Arg>/</Arg>
43  </Call>
44  <Call name="addFilter">
45    <!-- Add a filter to gzip on-the fly, since if we don't do it, I2P will.
46      -  This lowers the resource usage in the Java process on the client side,
47      -  by pushing the decompression out of Java and into the browser.
48      -  For all the reasons noted in the GzipFilter javadocs, this is normally
49      -  a bad idea for static content, but this is I2P.
50      -  See I2PTunnelHTTPServer for the I2P compressor.
51      -->
52    <Arg>
53      <New class="org.eclipse.jetty.servlet.FilterHolder" >
54        <Arg>
55          <New class="org.eclipse.jetty.servlets.GzipFilter" />
56        </Arg>
57        <Call name="setInitParameter">
58          <!-- minimum in Java is 1300 -->
59          <Arg>minGzipSize</Arg>
60          <Arg>512</Arg>
61        </Call>
62        <Call name="setInitParameter">
63          <!-- In Java we have a blacklist. This covers the most common cases. -->
64          <Arg>mimeTypes</Arg>
65          <Arg>application/pdf,application/x-javascript,application/xhtml+xml,application/xml,image/svg+xml,text/css,text/html,text/plain</Arg>
66        </Call>
67      </New>
68    </Arg>
69    <Arg>/*</Arg>
70    <Arg>
71      <!-- just guessing here -->
72      <Call class="java.util.EnumSet" name="of" >
73        <Arg>
74          <Call class="javax.servlet.DispatcherType" name="valueOf" >
75            <Arg>REQUEST</Arg>
76          </Call>
77        </Arg>
78      </Call>
79    </Arg>
80  </Call>
81</Configure>
82
Note: See TracBrowser for help on using the repository browser.