Further to this...

     <servlet>
         <servlet-name>abcservlet</servlet-name>
         <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-
class>
         <init-param>
             <param-name>org.restlet.application</param-name>
             <param-value>ca.mysite.MyABCApplication</param-value>
         </init-param>
     </servlet>

     <servlet>
         <servlet-name>xyzservlet</servlet-name>
         <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-
class>
         <init-param>
             <param-name>org.restlet.application</param-name>
             <param-value>ca.mysite.MyXYZApplication</param-value>
         </init-param>
     </servlet>

     <servlet-mapping>
         <servlet-name>abcservlet</servlet-name>
         <url-pattern>/abc/*</url-pattern>
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>xyzservlet</servlet-name>
         <url-pattern>/xyz/*</url-pattern>
     </servlet-mapping>

Given this setup, the Applications are never being created, which  
means the createRoot() method is never creating the Routers  
necessary.  I then tried to supply a Component instead:

     <servlet>
         <servlet-name>abcservlet</servlet-name>
         <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-
class>
         <init-param>
             <param-name>org.restlet.component</param-name>
             <param-value>ca.mysite.MyABCComponent</param-value>
         </init-param>
     </servlet>

     <servlet>
         <servlet-name>xyzservlet</servlet-name>
         <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-
class>
         <init-param>
             <param-name>org.restlet.component</param-name>
             <param-value>ca.mysite.MyXYZComponent</param-value>
         </init-param>
     </servlet>

And in each constructor, all they do is attach their respecitve  
Applications to their default hosts via the getDefaultHost().attach()  
method.  I was using the getContext().createChildContext() method to  
pass to the Application's constructor:

...
public MyXYZComponent()
{
     super();
     getDefaultHost().attach(new  
MyXYZApplication(getContext().createChildContext());
}

But none of the parameters from the context-params are being copied  
over.  Even the getContext() method doesn't contain them anymore.

I know this is still a Milestone for Restlet 2.0, but is there a but  
in here anywhere?  How do I correctly do this?

Many thanks!
Dustin



On 16-Sep-09, at 2:03 PM, Dustin Jenkins wrote:

> I'm using JDK 1.6, Restlet 2.0M4 on FC8 running Tomcat 6.
>
> My current web.xml maps two different URLs like so:
>
> <web-app>
>     <context-param>
>         <param-name>org.restlet.application</param-name>
>         <param-value>ca.mysite.MyApplication</param-value>
>     </context-param>
>
>     <servlet>
>         <servlet-name>server</servlet-name>
>         <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-
> class>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>server</servlet-name>
>         <url-pattern>/abc/*</url-pattern>
>     </servlet-mapping
>     <servlet-mapping>
>         <servlet-name>server</servlet-name>
>         <url-pattern>/xyz/*</url-pattern>
>     </servlet-mapping>
> </web-app>
>
> Which means that there is only one Application with one Router to
> serve these two URLs.  So if I want to route just the /abc/ and /xyz/
> Resources, the Router will need to attach the "/" to two different
> Resources; one for abc, and the other for xyz, which can't be done.
>
> I think the documentation's suggestion was to use a Virtual Host
> instead, and have it map to different Applications.  Is that the best
> solution in this case?  Would it even work?  Is there something
> simpler?  If I did go that way, would I instead create my own
> Component, and attach separate Virtual Hosts, or one Virtual Host with
> separate Applications?
>
> Many thanks,
> Dustin
>
>
> Dustin Jenkins
> [email protected]
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2395736

Dustin Jenkins
[email protected]

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2396082

Reply via email to