Opened 6 years ago

Closed 6 years ago

#1128 closed defect (fixed)

cacheControl init parameter in eepsite/contexts/base-context.xml

Reported by: eiluysef Owned by: zzz
Priority: minor Milestone: 0.9.9
Component: apps/jetty Version: 0.9.8.1
Keywords: Cc:
Parent Tickets:

Description

base-context.xml trying to set the cacheControl init parameter, but it cannot achieve any results. Here is how correct base-context.xml should look like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-JettyConfigureEN" "http://www.eclipse.org/jetty/configure.dtd">

<!--
Configure a custom context for the eepsite.

This context contains only a ServletContextHandler? with a default servlet
to serve static html files and images.
-->

<Configure class="org.eclipse.jetty.servlet.ServletContextHandler?">

<Set name="contextPath">/</Set>
<Set name="resourceBase">/home/user/.i2p/eepsite/docroot/</Set>
<Call name="addServlet">

<Arg>org.eclipse.jetty.servlet.DefaultServlet?</Arg>
<Arg>/</Arg>
<Call name="setInitParameter">

<Arg>cacheControl</Arg>
<Arg>max-age=3600,public</Arg>

</Call>

</Call>

</Configure>

<!-- Modified by I2P User dir migration script -->

Steps to reproduce:
"curl -v http://127.0.0.1:7658" shows no Cache-Control header with default base-context.xml

Subtickets

Change History (2)

comment:1 Changed 6 years ago by zzz

  • Owner set to zzz
  • Status changed from new to accepted

Confirmed.

According to the Jetty 7 DefaultServlet? javadocs, the init param can either be as you have shown above, or in the ServletContext? (aka ServletContextHandler?) init params with a "org.eclipse.jetty.servlet.Default." prefix. The base-context.xml file we had for Jetty 6 had the prefix, but for some reason in the port to Jetty 7 I removed the prefix instead of changing it.

In the console, I left the old (mortbay) prefix in place, so it isn't working either, although almost nothing falls through to DefaultServlet? in any webapp.

comment:2 Changed 6 years ago by zzz

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in 5171aea73b1720ac8d1faedb21f89abe95360120, to be 0.9.8.1-27.

Eepsite fix is for new installs only. Existing installs may manually edit ~/.i2p/eepsite/contexts/base-context.xml to change argument at about line 14 from:

    <Arg>cacheControl</Arg>

to:

    <Arg>org.eclipse.jetty.servlet.Default.cacheControl</Arg>

Alternatively, move the setInitParameter section from near the top to near the bottom, as shown in the OP.

Then stop and restart the eepsite on http://localhost:7657/configclients .

Note: See TracTickets for help on using tickets.