I have a Restlet application (2.0.10), I start with the following code:
public static void main(final String[] args) { try {
Now I need a root application (i.e. / myApp) inside the application, and I'm trying to get it according to Java by accessing the ServletContext from the Restlet resource :
Client serverDispatcher = context.getServerDispatcher(); ServletContext servletContext = (ServletContext)serverDispatcher.getContext().getAttributes() .get("org.restlet.ext.servlet.ServletContext"); String contextPath = servletContext.getContextPath();
This works great when deploying my application to Tomcat Server, but as soon as I start the server using the component as shown above, my context is always zero. Can someone please tell me how to get a correctly initialized context using the capabilities of the internal server of restals?
source share