Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2031

Jetty Decorator use is wrong (documentation and code)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3.1.Final, 3.0.0.Alpha14
    • None
    • None
    • None

      In reference to ..
      https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_jetty

      That doesn't do what you think it does.
      Since you are calling Set on serverClasses with an array you are overwriting all of the previous serverClasses entries with your entry.
      And since your entry starts with a "-" (negation), you essentially wind up with no serverClasses entries.
      Which basically removes all of the WebApp ClassLoader isolation. (a bad thing)

      In Jetty 8, there were no options for "append" or "prepend" of the serverClasses, so you would essentially have to copy/paste the entries into a new list with your entry at the top.

      In Jetty 9.0 thru 9.2 you can prepend the list, however your single entry isn't enough.

      {{ <!-- relax the classloader to allow weld to see jetty server and servlet classes -->
      <Call name="prependServerClass">
      <Arg>-org.eclipse.jetty.server.</Arg>
      </Call>
      <Call name="prependServerClass">
      <Arg>-org.eclipse.jetty.servlet.</Arg>
      </Call>
      }}

      This would be the minimum feature set to support to access the ServletContextHandler$Decorator

      But even this is too much to expose, so Jetty 9.3 made the exposure even easier, but it will require code changes in Weld to support properly.

      First, the org.eclipse.jetty.servlet.ServletContextHandler$Decorator has been deprecated.

      It has been replaced with org.eclipse.jetty.util.Decorator

      To add/remove Decorators, you use the org.eclipse.jetty.util.DecoratedObjectFactory accessed via a ServletContext.getAttribute(DecoratedObjectFactory.ATTR)

              tremes1@redhat.com Tomas Remes
              joakim.erdfelt@gmail.com Joakim Erdfelt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: