Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Bug 345729 new deployment binding

Wanted to call out a couple of changes I just committed as a heads up..

I have a situation where I want to modify the server and system
classes for _every_ webapp context that might be deployed.  To that
end I have added a WebappClasspathPatternBinding in the jetty-deploy
module and a couple tests around it.

In a nutshell it lets you do something like this (these are snippets
from the xmlconfiguration of the deployment manager):

  <Array id="serverClasses" type="java.lang.String">
    <Item>org.foo.test.</Item>
  </Array>

  <Array id="systemClasses" type="java.lang.String">
    <Item>com.foo.test.</Item>
  </Array>

        <Ref id="DeploymentManager">
          <Call name="addLifeCycleBinding">
            <Arg>
              <New
class="org.eclipse.jetty.deploy.bindings.WebappClasspathPatternBinding">
                <Set name="serverClasses"><Ref id="serverClasses"/></Set>
                <Set name="systemClasses"><Ref
id="systemClasses"/></Set>
              </New>
            </Arg>
          </Call>
       </Ref>

In this case you are able to add to the server and system
classes...once the ContextHandler has been created it will pass to
this binding which will be able to add these patterns to both the
server classes and the system classes.

The other option is a wholesale replacement.

  <Array id="serverClasses" type="java.lang.String">
    <Item>-org.eclipse.jetty.continuation.</Item>
    <Item>-org.eclipse.jetty.jndi.</Item>
    <Item>-org.eclipse.jetty.plus.jaas.</Item>
    <Item>-org.eclipse.jetty.websocket.</Item>
    <Item>-org.eclipse.jetty.servlet.DefaultServlet</Item>
    <Item>org.eclipse.jetty.</Item>
    <Item>org.eclipse.foo.</Item>
  </Array>

  <Array id="systemClasses" type="java.lang.String">
    <Item>java.</Item>
    <Item>javax.</Item>
    <Item>org.xml.</Item>
    <Item>org.w3c.</Item>
    <Item>org.apache.commons.logging</Item>
    <Item>org.eclipse.jetty.continuation</Item>
    <Item>org.eclipse.jetty.plus.jaas.</Item>
    <Item>org.eclipse.jetty.websocket</Item>
    <Item>org.eclipse.jetty.servlet.DefaultServlet</Item>
  </Array>

        <Ref id="DeploymentManager">
          <Call name="addLifeCycleBinding">
            <Arg>
              <New
class="org.eclipse.jetty.deploy.bindings.WebappClasspathPatternBinding">
                <Set name="override">true</Set>
                <Set name="serverClasses"><Ref id="serverClasses"/></Set>
                <Set name="systemClasses"><Ref
id="systemClasses"/></Set>
              </New>
            </Arg>
          </Call>
       </Ref>

In this case the override is set on the binding class which means that
regardless of whatever might have been set in something like a
context.xml file, it will be replaced with what is here.

Now...I could have added a bit more processing in there so it could
recognize that you added or subtracted a pattern with the - pattern
approach but I errored on the side of simple for now.

Does anyone see any issues with this approach?

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx


Back to the top