My pleasure ;) I'm glad it works for you!

regards
Grzegorz Grzybek

wt., 24 lut 2026 o 19:52 Steinar Bang <[email protected]> napisał(a):

> >>>>> Grzegorz Grzybek <[email protected]>:
>
> > So ChatGPT suggested you to _replace_ the Pax Web handler with your own -
> > that's how you broke the connection between Jetty and Pax Web.
>
> > Pax Web sets a "handler collection" hander as the Server's handler and
> you
> > can't replace it - you can _add_ another handler. You can do it
> > programmatically as I showed with JettyHandlerServceInterationTest.java,
> > but you can do it declaratively too with jetty.xml. Instead of <Set
> > name="handler"> do this:
>
> > <Get name="handler">
> >   <Call name="addHandler">
> >     <Arg>
> >       <New class="org.eclipse.jetty.server.handler.ContextHandler">
> >         <Set name="contextPath">/static-content</Set>
> >         <Set name="handler">
> >           <New class="org.eclipse.jetty.server.handler.ResourceHandler">
> >             <Set name="resourceBase">target/logs</Set>
> >             <Set name="directoriesListed">true</Set>
> >           </New>
> >         </Set>
> >       </New>
> >     </Arg>
> >   </Call>
> > </Get>
>
> Grzegorz, you're the best!
>
> This in etc/jetty.xml worked like a charm, I got pictures served from
> http://localhost:8181/pictures/ and OSGi web whiteboard webapps running
> from other context paths, like e.g. http://localhost:8181/oldalbum/
>
> <Configure id="Server" class="org.eclipse.jetty.server.Server">
>
>   <Get name="handler">
>     <Call name="addHandler">
>       <Arg>
>         <New class="org.eclipse.jetty.server.handler.ContextHandler">
>           <Set name="contextPath">/pictures</Set>
>           <Set name="handler">
>             <New class="org.eclipse.jetty.server.handler.ResourceHandler">
>               <Set name="resourceBase">/home/sb/Pictures</Set>
>               <Set name="directoriesListed">true</Set>
>             </New>
>           </Set>
>         </New>
>       </Arg>
>     </Call>
>   </Get>
>
> </Configure>
>
> Thanks a million! I will credit you in the HOWTO!
>
> (and ChatGPT will get nothing but shame)
>
>

Reply via email to