Hello Grzegorz,

amazing answer and Thank you very much.
Indeed using pax-web/osgi-http/and whiteboard ist pretty confusing. This
fairly increased my understanding from 85 to 90% ;)

But I don't like the answer and have to think about something else... I
only needed the gogo shell. Maybe I will search for a web-based ssh
client which basically does the job too.

br,
Matthias

Am Di., 13. Dez. 2022 um 12:47 Uhr schrieb Grzegorz Grzybek <
[email protected]>:

> Hello
>
> As you can see (and I see you're using Karaf 4.4.+ with Pax Web 8),
> `org.apache.karaf.webconsole.console` bundle has registered two contexts
> (org.osgi.service.http.HttpContext instances):
>
>    - osgi.http.whiteboard.context.httpservice=default with
>    osgi.http.whiteboard.context.path=/, and
>    - osgi.http.whiteboard.context.httpservice=context:98909897 with
>    osgi.http.whiteboard.context.path=/
>
> the "context:98909897" is created when registering resource mapping and
> "default" is just default.
>
> What's important is that both use "/" context.
>
> Now remember these important things:
>
>    - OSGi HttpService specification doesn't cover ANY other context path
>    than "/"
>    - Pax Web extends OSGi HttpService, so it's possible to use a
>    HttpContext instance with different context path, but felix.webconsole
>    doesn't use Pax Web
>    - OSGi Whiteboard allows using non-"/" paths when registering
>    org.osgi.service.http.context.ServletContextHelper (use service
>    registration property "osgi.http.whiteboard.context.path")
>    - OSGi Web Applications specification allows using non-"/" paths when
>    your WAB/WAR has Web-ContextPath manifest header
>
> Pax Web indeed has an option (org.ops4j.pax.web.context.file) that can be
> used to point to a jetty-web.xml file that alters ALL THE CONTEXTS - but it
> can't be used to change the context path (it should be used to add new
> handlers, filters or for example max POST size configuration)
>
> So without hacks like wrapping felix.webconsole (to provide it with
> special wrapping HttpService instance) you simply can't adjust the context
> path used by felix.webconsole...
>
> kind regards
> Grzegorz Grzybek
>
> wt., 13 gru 2022 o 09:39 Matthias Leinweber <[email protected]>
> napisał(a):
>
>> 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
>>
>>
>>

Reply via email to