Hello,


you can use the WAR protocol scheme (used for serving files from a war application deployed inside a servlet container), or the CLAP one (looks for "files" from the classpath).
For example, if your "items" directory is located just under the "Web-Content" directory:
FileRepresentation rep=new FileRepresentation("war:///items/result.jsp",MediaType.TEXT_HTML);

I would like to precise the FileRepresentation simply gets the content of the targetted file.

 
Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


    I am trying to create a web application with restlet. how can i call a
file in the web application (using relative path).
I went through documentation of restlet, there creating html content in the
Resource class was explained as shown here.

getResponse().setStatus(Status.SUCCESS_CREATED);
String result="<h3>Item Created. </h3>";
result += " <p>use <br>http://localhost:8080/itemRestlet/itemapp/items<br>in
a new browser instance to see the data.</p>";
Representation rep = new StringRepresentation(result,MediaType.TEXT_HTML);

        The FileRepresentation class can take path of the file you want to
invoke and content type, but here the problem is trying to locate result.jsp
in the webserver installation directory rather than in webapp.

 FileRepresentation rep=new
FileRepresentation("items/result.jsp",MediaType.TEXT_HTML);

        Can any one please help me to invoke this result.jsp from a
resource?
I am trying to invoke a html/jsp page from web application from a
resource....help me please
  

Reply via email to