Hello JB,
maybe i misunderstood the comments and that i have somehow to add a
configuration entry in jetty-web esp. for the web console servlets? ...
karaf 4.4.1.
my org.ops4j.pax.web.cfg looks like this: (thought jetty.xml isn't needed,
b/c of org.ops4j.pax.web.context.file (even if deprecated))
---------------
org.osgi.service.http.enabled = true
org.osgi.service.http.port = 8181
org.osgi.service.http.secure.enabled = false
javax.servlet.context.tempdir = ${karaf.data}/pax-web/tmp
# external Jetty configuration file where Jetty-specific beans may be
declared
#org.ops4j.pax.web.config.file = ${karaf.etc}/jetty.xml
# optional Jetty context configuration file applied to all web contexts
# see
https://www.eclipse.org/jetty/documentation/jetty-9/index.html#using-basic-descriptor-files
org.ops4j.pax.web.context.file = ${karaf.etc}/jetty-web.xml
---------------
jetty-web.xml:
---------------
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure_9_3.dtd">
<!--
The only working way to configure a context in pax-web-jetty is to:
- put WEB-INF/jetty-web.xml or WEB-INF/web-jetty.xml into the WAB/WAR, or
- put it into know location and configure org.ops4j.pax.web.context.file
option
- use root element <Configure> with id="Context", as that's the ID under
which we can find an instance
of org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler
-->
<Configure id="Context">
<Set name="contextPath">/bar</Set>
</Configure>
---------------
Seeing this in my log: Found global Jetty context configuration file:
/rahla/etc/jetty-web.xml
Here is also my context-list output:
Bundle ID │ Symbolic Name │ Context Path │
Context Name │ Rank │ Service ID │ Type │ Scope │
Registration Properties
──────────┼───────────────────────────────────────────────┼──────────────┼─────────────────────┼─────────────┼─────
175 │ org.apache.karaf.webconsole.console │ / │
default │ MAX │ 0 │ HttpService │ static* │
httpContext.id=default
│
│ │ │ │ │
│ │ httpContext.path=/
│
│ │ │ │ │
│ │ osgi.http.whiteboard.context.httpservice=default
│
│ │ │ │ │
│ │ osgi.http.whiteboard.context.path=/
175 │ org.apache.karaf.webconsole.console │ / │
context:98909897 │ MAX │ 0 │ HttpService │ static* │
httpContext.id=context:98909897
│
│ │ │ │ │
│ │ httpContext.path=/
│
│ │ │ │ │
│ │
osgi.http.whiteboard.context.httpservice=context:98909897
│
│ │ │ │ │
│ │ osgi.http.whiteboard.context.path=/
205 │ org.jolokia.osgi │ /
│ context:987096141 │ MAX │ 0 │ HttpService │
static* │ httpContext.id=context:987096141
│
│ │ │ │ │
│ │ httpContext.path=/
│
| │ │ │
│ │ │
osgi.http.whiteboard.context.httpservice=context:987096141
│
│ │ │ │ │
│ │ osgi.http.whiteboard.context.path=/
214 │ org.ops4j.pax.web.pax-web-extender-whiteboard │ / │
default │ 0 │ 0 │ Whiteboard │ static* │
osgi.http.whiteboard.context.name=default
│
│ │ │ │ │
│ │ osgi.http.whiteboard.context.path=/
75 │ org.apache.aries.jax.rs.whiteboard │ /foobar
│ context.for.default │ -2147483648 │ 585 │ Whiteboard │
singleton │ osgi.http.whiteboard.context.name=context.for.default
│
│ │ │ │
│ │ │ osgi.http.whiteboard.context.path=/foobar
br,
Matthias
Am Di., 13. Dez. 2022 um 08:39 Uhr schrieb Jean-Baptiste Onofré <
[email protected]>:
>
> Hi Matthias,
>
> I guess you are using the default connector created by Pax Web right ?
> You have to set the contextPath in the corresponding section.
>
> Which Karaf version are you using ? Can you share your full jetty.xml
> + org.ops4j.pax.web.cfg files ?
>
> Thanks,
> Regards
> JB
>
> On Mon, Dec 12, 2022 at 5:58 PM Matthias Leinweber
> <[email protected]> wrote:
> >
> > Hello Karafers,
> >
> > I am convinced that I am not the first person who asks this. But I also
wasn't able to find the answer. I try to change the basepath of the default
jetty context so that /system/console is prefixed e.g. with bar _>
/bar/system/console
> >
> > I thought that i have to add
> > org.ops4j.pax.web.context.file = ${karaf.etc}/jetty-web.xml
> > to org.ops4j.pax.web.cfg and add
> > <Set name="contextPath">/bar</Set> to the <Configure> .. block..
> >
> > But that seems to be wrong.. any hints?
> >
> > br,
> > Matthias