I want to serve some static html pages along with my restlet services from the same app ( running in Tomcat )
Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>first steps servlet</display-name>
<!-- Application class name -->
<context-param>
<param-name>org.restlet.application</param-name>
<param-value>
firstSteps.FirstStepsApplication
</param-value>
</context-param>
<!-- Restlet adapter -->
<servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>
org.restlet.ext.servlet.ServerServlet
</servlet-class>
</servlet>
<!-- Catch all requests -->
<servlet-mapping>
<servlet-name>RestletServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Here is my Application router class
public class FirstStepsApplication extends Application
{
@Override
public synchronized Restlet createInboundRoot()
{
Router router = new Router(getContext());
// Defines only one route
router.attach("/hello", HelloWorldResource.class);
router.attach("/login", LoginResource.class);
router.attach("/", BasicResource.class);
return router;
}
}
I've gone back to the basic first steps example.
It works fine if the url pattern is <url-pattern>/*</url-pattern>
localhost/rest/login returns a string from my LoginResource, same too for /hello
However a static html page I have /Mypage.html does not get returned when I enter the URL /MyPage.html
However, if I then modify the url pattern to be
<url-pattern>/login</url-pattern>
and then enter the url /MyPage.html I will get the html page.
But ...... I get the error "The server has not found anything matching the request URI" when I enter the url /login which worked ok the first case.
What must I do in order for both Restlet & Static HTML resources to work together?
Thanks ... J