gwt-maven-plugin project configuration files

View: New views
3 Messages — Rating Filter:   Alert me  

gwt-maven-plugin project configuration files

by Ivan Martinez-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,
I have a project with its own configuration file "oid.properties",
which I want to read from the server. The problem is if I place the
file in "src\main\resources" and compile the project, the file goes to
"target\project\WED-INF\classes" and "war\WEB-INF\classes", but if I
run in hosted mode and try to read the file with:

ServletContext application = servletConfig.getServletContext();
String pathBase = application.getRealPath("");
if(!pathBase.endsWith(File.separator))
   pathBase = pathBase + File.separator;
new FileInputStream(pathBase + ficheroConfiguracionOID);

The actual path where it's looking for the file is
"tomcat\webapps\ROOT\oid.properties"

I know compilation is not related to hosted mode but I'm quite
confused with the behaviour in both cases. What is the right place for
the file and the right way to find it from the server, so it works
both in hosted mode and in the app server after compiling and
packaging the project?.

Thank you,
Iván Martínez

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: gwt-maven-plugin project configuration files

by nicolas de loof-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To access resources from classpath use ClassLoader.getResource()
never access resources as Files !

2009/10/16 Ivan Martinez <supertrasgu@...>
Hello all,
I have a project with its own configuration file "oid.properties",
which I want to read from the server. The problem is if I place the
file in "src\main\resources" and compile the project, the file goes to
"target\project\WED-INF\classes" and "war\WEB-INF\classes", but if I
run in hosted mode and try to read the file with:

ServletContext application = servletConfig.getServletContext();
String pathBase = application.getRealPath("");
if(!pathBase.endsWith(File.separator))
  pathBase = pathBase + File.separator;
new FileInputStream(pathBase + ficheroConfiguracionOID);

The actual path where it's looking for the file is
"tomcat\webapps\ROOT\oid.properties"

I know compilation is not related to hosted mode but I'm quite
confused with the behaviour in both cases. What is the right place for
the file and the right way to find it from the server, so it works
both in hosted mode and in the app server after compiling and
packaging the project?.

Thank you,
Iván Martínez

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: gwt-maven-plugin project configuration files

by Ivan Martinez-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Of course, thank you.
Ivan

On Fri, Oct 16, 2009 at 2:43 PM, nicolas de loof
<nicolas.deloof@...> wrote:

> To access resources from classpath use ClassLoader.getResource()
> never access resources as Files !
> 2009/10/16 Ivan Martinez <supertrasgu@...>
>>
>> Hello all,
>> I have a project with its own configuration file "oid.properties",
>> which I want to read from the server. The problem is if I place the
>> file in "src\main\resources" and compile the project, the file goes to
>> "target\project\WED-INF\classes" and "war\WEB-INF\classes", but if I
>> run in hosted mode and try to read the file with:
>>
>> ServletContext application = servletConfig.getServletContext();
>> String pathBase = application.getRealPath("");
>> if(!pathBase.endsWith(File.separator))
>>   pathBase = pathBase + File.separator;
>> new FileInputStream(pathBase + ficheroConfiguracionOID);
>>
>> The actual path where it's looking for the file is
>> "tomcat\webapps\ROOT\oid.properties"
>>
>> I know compilation is not related to hosted mode but I'm quite
>> confused with the behaviour in both cases. What is the right place for
>> the file and the right way to find it from the server, so it works
>> both in hosted mode and in the app server after compiling and
>> packaging the project?.
>>
>> Thank you,
>> Iván Martínez
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email