I'm using Pax-Web in Karaf 4.0.7.

I have two problems with aliases:

*Problem #1*

If I register resources for the context path "/" (i e the root) as follows:

    mWebService.registerResources("/", "/webroot", mHttpContext);

Then my application is reachable at:

http://localhost:8183//admin/login

but not at:

http://localhost:8183/admin/login

I want to get rid of the double slash. However if I try this instead:

    mWebService.registerResources("", "/webroot", mHttpContext);

Then I get:

Caused by: java.lang.IllegalArgumentException: Alias does not start with
slash (/)
        at
org.ops4j.pax.web.service.spi.model.ServletModel.validateAlias(ServletModel.java:169)
        at
org.ops4j.pax.web.service.spi.model.ServletModel.<init>(ServletModel.java:53)
        at
org.ops4j.pax.web.service.spi.model.ResourceModel.<init>(ResourceModel.java:29)
        at
org.ops4j.pax.web.service.internal.HttpServiceStarted.registerResources(HttpServiceStarted.java:262)
        at
org.ops4j.pax.web.service.internal.HttpServiceProxy.registerResources(HttpServiceProxy.java:71)
        at
org.ops4j.pax.web.service.WebContainer$$Proxy.registerResources(Unknown
Source)
        at se.digia.hp.web.HpWebService.__M_init(HpWebService.java:133)
        at se.digia.hp.web.HpWebService.init(HpWebService.java)
        at se.digia.hp.web.HpWebService.__M_starting(HpWebService.java:47)
        at se.digia.hp.web.HpWebService.starting(HpWebService.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.8.0_74]
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_74]
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_74]
        at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_74]
        at
org.apache.felix.ipojo.util.Callback.call(Callback.java:237)[50:org.apache.felix.ipojo:1.12.1]
        at
org.apache.felix.ipojo.util.Callback.call(Callback.java:193)[50:org.apache.felix.ipojo:1.12.1]
        at
org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)[50:org.apache.felix.ipojo:1.12.1]
        at
org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162)[50:org.apache.felix.i
pojo:1.12.1]

How can I get rid of the "double slash"?

*Problem #2*

Assume that my web application resides at the context url:

http://localhost:8183/hp

I also register a separate resource directory directly in jetty with the
following configuration (as I was helped by Achim on this forum):

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure_9_0.dtd";>

<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">/logo</Set>
          <Set name="handler">
            <New class="org.eclipse.jetty.server.handler.ResourceHandler">
              <Set name="resourceBase">../../common/etc/logo</Set>
              <Set name="directoriesListed">true</Set>
            </New>
          </Set>
        </New>
      </Arg>
    </Call>
  </Get>
</Configure>

This works fine. But when I try to move the application up to the root
(which has the double slash problem as described in Problem #1) to the
following url:

http://localhost:8183//

Then the separate resource via my jetty.xml does not work. It seems that it
cannot be a descendant of the context path I use for my web application.
But, since this is a public web application, with a predetermined url, it
must reside at the root. Then there is no context path that works for my
separate resource directory since all paths are descendants of root.

This seems a bit weird...

/Bengt

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to