Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328885

Summary: web overrides do not override
Product: [RT] Jetty Reporter: AngerClown <angerclown>
Component: serverAssignee: Jan Bartel <janb>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: janb, jetty-inbox
Version: unspecified   
Target Milestone: 7.1.x   
Hardware: All   
OS: All   
Whiteboard:

Description AngerClown CLA 2010-10-27 16:20:12 EDT
Build Identifier: 7.2.0.v20101020

Using a web-override.xml file no longer overrides any properties that have already been set.

I am using web overrides to change some settings in both the default and jsp servlets. init-parameters that are not set by default do get set, but parameters that do have default values are ignored. Examples would be setting dirAllowed to false in the default servlet or reloading to false in the jsp servlet.

The issue appears to have been introduced in the fix for 320073 (SVN commit 2145). The org.eclipse.jetty.servlet.Holder.HolderRegistration.setInitParameter() function now contains this code:
if (Holder.this.getInitParameter(name)!=null)
 return false;

In other words, if an init parameter is already set, don't change it. This completely breaks the override mechanism.

setInitParameter() should either revert to the way it was, or there should be some way to enable overwrites to existing properties. (In the current code base, the boolean return value from org.eclipse.jetty.servlet.api.Registration.setInitParameter() is never used.)

If this code is the same in Jetty 8, it probably isn't working there either.

Reproducible: Always

Steps to Reproduce:
1. Create a web-overrides.xml file with:
    <servlet-name>default</servlet-name>
    <init-param>
      <param-name>dirAllowed</param-name>
      <param-value>false</param-value>
    </init-param>
</servlet>

2. Start a webapp and notice that dirAllowed is still set to the default value of true.
Comment 1 Jan Bartel CLA 2010-10-27 22:22:24 EDT
Thanks for pointing that out!

Fixed in jetty-7 r 2423.

I'll leave this open until this fix is ported to jetty-8.

Jan
Comment 2 Jan Bartel CLA 2010-10-28 02:15:34 EDT
Fixed also in jetty-8.