Monday, November 7, 2011

Re: Relative path to a txt files repository

On 11/6/2011 11:23 PM, Sabbia wrote:
> Hi everyone!
>
> I've developed a GWT-SmartGWT application using Eclipse. In this
> application, a Java class from the server side must read some txt
> files in a directory called "Transcriptions". Working with Eclipse, I
> had no problem at all to access to this directory. I had located it
> under the WAR directory, so every time I needed to read a file I had
> only to write "File f = new File('Transcriptions');".
>
> But when I've deployed it into Tomcat, I can't access to my directory
> in this way anymore, because the default path of Tomcat is "webapps".
> So, I need to access to the transcriptions directory using a relative
> path. And here is my problem. I don't know where to locate this
> directory, and I don't know how to access it.
>
> I had thought of using the GWT.getModuleName() method, but because of
> I have to use it in the server side, I can't use any of the methods of
> GWT class.
>
> I've been trying to solve it in the last week, but I've not been able
> to do it.
>
> Can anyone help me, please? Thank you very, very much in advance
>
> Greetings!
>

I'd use a two string Resources, one for production and one for test.
Check the environment using GWT.isProdMode()
http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/core/client/GWT.html#isProdMode()

Bueno Suerte,
jec

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment