W3C home > Mailing lists > Public > public-expath@w3.org > February 2015

Re: [servlex] install servlex in root context

From: Florent Georges <fgeorges@fgeorges.org>
Date: Mon, 23 Feb 2015 10:05:11 +0100
Message-ID: <CADyR_r0cccdOs57P4sHOdDEG6-ChCvJE4snGAZAKbzm8yGgT2Q@mail.gmail.com>
To: Paul Tyson <phtyson@sbcglobal.net>
Cc: EXPath CG <public-expath@w3.org>
  Hi Paul,

  Sorry, I misunderstood your email (the part using "/myapp" sounded
like you really wanted to install an... app there :-p).  So you really
want to have a root application in Servlex.

  This is not possible at the moment.  If you want to recompile,
changing the parser is not enough.  You need to change Servlex.service
as well.  Probably easy for a deciated behaviour (like always by-pass
the application context root), and a bit more complex to make it fit
properly in Servlex.

  I will try to see if I can add the feature...

  A few notes on having a root application though.  Till now, I always
avoided it myself.  The main reason is that I want to be able to
install something aside my webapp, like the webapp maa=nager (if you
have a root application, you cannot have the graphical webapp manager,
the one that lets you install webapps and libraries through a web
interface).  And anyway, I always put my Java EE Servlet containers
behind an Apache HTTP server (which proxies the request to the
specific Tomcat instance).

  For instance, all requests to http://cxan.org/foo/bar are redirected
to http://localhost:xxx/servlex/cxan/foo/bar on the server.

  Do not hesitate to ping me in a few days if I don't give any
advancement notes on this one ;-)


Florent Georges

On 22 February 2015 at 21:39, Paul Tyson <phtyson@sbcglobal.net> wrote:
> On Sun, 2015-02-22 at 19:47 +0100, Florent Georges wrote:
>> On 20 February 2015 at 20:06, Paul Tyson wrote:
>>   Hi,
>> > Is it possible to install servlex in the root context of tomcat?
>>   Yes.
>> > I have configured a tomcat context "/" to go to servlex.
>>   So it is the root webapp?  So it is in [tomcat]/webapps/ROOT/?
>> > My webapps.xml has a single <webapp> with @root="/". The servlex
>> > WebappsParser complains this is not valid.
>> > My goal is to make "servlex" disappear from the url, and only respond to
>> > urls defined by my webapp. That is, "http://myhost.com/myapp" instead of
>> > "http://myhost.com/servlex/myapp" (or any alias for "servlex").
>>   I think there is a bit of confusion here.  Servlex is a Java web
>> application, that you can deploy on Tomcat (for instance).  It is
>> itself a web container for the EXPath webapp spec.  Meaning that you
>> can deploy such EXPath webapps in Servlex.
>>   Since you have deployed Servlex at the root of your Tomcat instance,
>> Servlex itself is available at http://myhost.com/ (and everything
>> underneath...)  If you want the webapps you deploy in Servlex to be
>> available as http://myhost.com/myapp/, then ou can deploy them as
>> usual.  @root="/" is not what you want, rather root="myapp".
>>   There are 2 levels of context roots: those of Tomcat (one is
>> assigned to Servlex, here the special "root" one).  And those of
>> Servlex itself, one being assigned to your webapp (in this case, it
>> should be "myapp").
>>   Does that solve your problem?
> I didn't state my problem quite right.
> I am implementing something like a linked data platform, which will
> resolve all urls under a particular authority. So, for instance, I want
> servlex to handle all urls under http://myhost.com.
> Some urls in this space are distinguished by their initial path part.
> They need to be associated with a particular expath component.
> So I might have urls like these:
>   http://myhost.com/some/special/url
>   http://myhost.com/some-other/special/url
>   http://myhost.com/any/ordinary/url
> I could have dedicated expath webapps named "some" and "some-other".
> (I've done this for the time being, just to make progress.) Then within
> each of these webapps, there is a servlet association to the desired
> component, using a pattern match relative to the webapp root.
> But I still want to handle urls with initial path parts like "any",
> "any1", "any-other", etc. In other words, the rest of the url space
> under http://myhost.com, which, even if I could enumerate it today,
> might change tomorrow. These could all be handled by a default component
> (until perhaps a need arises to implement some special processing).
> It would be cleaner and more flexible in this case to have a single
> expath webapp rooted at "", and use servlets to dispatch "special" urls
> to specialized components, and let a default url pattern handle the rest
> with a generic component.
> I can make tomcat use servlex as its default servlet by adding a
> Host/Context element in server.xml like so:
>   <Context path="" docBase="servlex.war"/>
> and adjusting the Host attributes regarding auto-deployment and
> unpacking.
> But servlex doesn't like a webapp with @root="". It complains that it
> doesn't match the WebappsParser.ROOT_RE of "^[-a-zA-Z0-9]+$". I don't
> know if this is required by the spec, or if it is a servlex
> implementation detail. I can't find the schema definition for
> webapps/webapp/@root.
> It would be nice if servlex allowed @root="", with the same effect as
> tomcat's Context/@path="". Then I could have in .expath-web/webapps.xml:
>   <webapp root=""...>
> And then in the root application's expath-web.xml:
>   <servlet name="some-other-servlet">
>     <!-- associate to some-other component -->
>     <match url="/some-other/"/>
>   </servlet>
>   <servlet name="some-servlet">
>     <!-- associate to some component -->
>     <match url= "/some/"/>
>   </servlet>
>   <servlet name="default">
>     <!-- associate to a default component -->
>     <match url="/">
>   </servlet>
> I am going to try to compile and run servlex with a modified
> WebappsParser.ROOT_RE (to change "+" to "*") and see if it works. I
> haven't looked into the code far enough to see if it will cause any
> other problems. Worst case, maybe some urls with "//" to start the path
> part.
> Thanks for your attention to this.
> Regards,
> --Paul
>>   Regards,
Received on Monday, 23 February 2015 09:05:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:47:39 UTC