views:

53

answers:

1

Hi,

I am new to Restlets. Trying to configure the web.xml (on JBoss). I have 2 entries, one for a servlet (got nothing to do with webservices) other for webservices, using Restlet. Here are the entries..

 <servlet>
  <servlet-name>AuthenticationServlet</servlet-name>
  <servlet-class>com.safeid.web.server.api.servlet.AuthenticationServlet</servlet-class>
  <load-on-startup>2</load-on-startup>
 </servlet>

 <servlet-mapping>
  <servlet-name>AuthenticationServlet</servlet-name>
  <url-pattern>/authenticate/*</url-pattern>
 </servlet-mapping>


<!--  Start of Entries for the REST Web Services. -->

  <context-param>
   <param-name>org.restlet.application</param-name>
   <param-value>com.safeid.web.server.SafeIDRouterApplication</param-value>
  </context-param>

 <servlet>
  <servlet-name>RestletServlet</servlet-name>
  <servlet-class>com.noelios.restlet.ext.servlet.ServerServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>


 <servlet-mapping>
  <servlet-name>RestletServlet</servlet-name>
  <url-pattern>/*</url-pattern>
 </servlet-mapping>
<!-- END of Entries for the REST Web Services.-->

Both don't work together. In the above setup the Restlet works. However when I change the

RestletServlet /*

to something like

<servlet-mapping>
  <servlet-name>RestletServlet</servlet-name>
  <url-pattern>/credential/*</url-pattern>
 </servlet-mapping>

the Restlet stop working and the AuthenticationServlet works fine. What am I missing here?

A: 

Looks like you're missing the init-params as in the example below.

<servlet>
    <servlet-name>MyApplication</servlet-name> 
    <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
    <init-param>
        <param-name>org.restlet.application</param-name>
        <param-value>my.class.that.extends.Application.MyApplication</param-value>
    </init-param> 
</servlet>

You need a class that extends org.restlet.Application (at least in Restlet 2.0 anyway).

Everett Toews
Oh.. I do have it. The above snippet of the web.xml is the one that is relevant to the problem I am facing. I am now thinking of separating the webservice from rest of the servlet/war code.
Win Man