jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more

Home Page:https://eclipse.dev/jetty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

replacement for GlobalWebappConfigBinding

nbartels opened this issue · comments

Jetty Version
Jetty 12.0.9

Jetty Environment
ee8

Java Version
21

Question
I'm migrating an application from Jetty 9 to 12 and have some xml configurations here. The most seems to work, but I'm stuck on GlobalWebappConfigBinding. I see this is available until jetty 11 and no longer available in Jetty 12.

Can you give me a hint, how I have to replace it in Jetty 12?

here is the xml snippet I try to get to work again:

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Ref refid="DeploymentManager">
    <Call name="addLifeCycleBinding">
      <Arg>
        <New class="org.eclipse.jetty.deploy.bindings.GlobalWebappConfigBinding">
          <Set name="jettyXml"><Property name="jetty.base"/>/etc/another-web.xml</Set>
        </New>
      </Arg>
    </Call>
  </Ref>
</Configure>

@nbartels I think this type of functionality was accidentally omitted from jetty-12, let me have a look at putting something like it back in.

@nbartels can I see a (sanitized if ncessary) example of the another-web.xml that you want to apply?

@janbartel sure.

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.ee8.webapp.WebAppContext">
 
   <Set name="throwUnavailableOnStartupException">true</Set>
  
   <Call name="addEventListener">
     <Arg><New class="my.namespace.RequestContextScope"/></Arg>
   </Call>

  <Get id="protected" name="ProtectedTargets"/>
  <Set name="ProtectedTargets">
    <Call class="org.eclipse.jetty.util.ArrayUtil" name="addToArray">
      <Arg><Ref refid="protected"/></Arg>
      <Arg>/my.yaml</Arg>
      <Arg></Arg>
    </Call>
  </Set>

  <Set name="overrideDescriptor"><Property name="jetty.base"/>/etc/override-web.xml</Set>
 
</Configure>