Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to read a external file after deployment?
How to read a external file after deployment? [message #885626] Wed, 13 June 2012 06:52 Go to next message
Eclipse UserFriend
Dear community,
I have an application built on RAP. In my application, I have a list of Strings. I want to have content of these strings configurable from an external file (e.g xml file) when user enter website. My app will read content of that file and the website will display the respective content (it's kind of config file).
For example, the path to website is as following:
{TOMCAT_HOME}/webapps/{my_app}/WEB-INF
After deployment, I want to add a file .xml to category WEB_INF, then my website will read the content of that file.
My question is how I can know the path of my app in webserver after deployment, because eclipse wrap the whole project into bundle. Or is there any other way to solve my problem?
Thank you very much!


Re: How to read a external file after deployment? [message #885657 is a reply to message #885626] Wed, 13 June 2012 08:06 Go to previous messageGo to next message
Eclipse UserFriend
RWT.getRequest().getServletContext().getRealPath("/") will give you the absolute path of your installation. I guess this solves your issue. You just need make sure of one thing that you access RWT.getRequest with a http request.
Re: How to read a external file after deployment? [message #886149 is a reply to message #885657] Thu, 14 June 2012 06:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi Avrajit,
Thanks for your answer.
I followed your suggestion but I got the error as following:
Could not create the view: javax.servlet.http.HttpServletRequest.getServletContext()Ljavax/servlet/ServletContext;

The error line is in the area where I initiate layout of a view.
I got null here:
RWT.getRequest().getServletContext().getRealPath("/")


Re: How to read a external file after deployment? [message #886608 is a reply to message #886149] Fri, 15 June 2012 05:18 Go to previous message
Eclipse UserFriend
Currently, you can only access the context location using internal API:

RWTFactory.getConfiguration().getContextDirectory()

Feel free to open a feature request [1] for a public API and explain why
it is needed.

[1] http://eclipse.org/rap/bugs/

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Articles about "Create a WAR from RAP Application with Libra WAR Product"
Next Topic:Probably simple -- need to add links to page
Goto Forum:
  


Current Time: Tue Jun 24 15:14:24 EDT 2025

Powered by FUDForum. Page generated in 0.05575 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top