I'm deploying my Restlet application into a WAR in Tomcat, and everything seems to be working just fine. Normally, it'd be nicer to simply let Tomcat handle the CSS and Javascript files, but I want to map everything (/*) to the ServerServlet so I can keep the initial part of the resource ref (i.e. if I were to map /abc/* and /xyz/* I wouldn't be able to match those because it becomes the base ref and gets stripped off). Here's what I'm doing now for the CSSResource that the /css/{cssfile} is routed to:
   public Representation getRepresentation(final Variant variant)
   {
       final ServletWarClient warClient =
               new ServletWarClient(getContext(),
((ServletContextAdapter) getContext()).getServletContext());

       return warClient.get("war:///css/"
                            + getRequestAttribute("cssfile")).getEntity();
   }

Which isn't elegant at all as it's tuned specifically to being deployed as a WAR, and can no longer be run as a standalone, not to mention all the implementation specific stuff... Is there a better way? I know normal static stuff is served via the Directory resource, but it doesn't apply here because everything is inside the WAR.
Any suggestions?
Thank you for the fantastic framework!

Dustin

Reply via email to