Hi,

Thanks for all the help/suggestions! ;-)

I managed to eventually figure it out as follows:

  public Map act(Redirector redirector, SourceResolver resolver,
            Map objectModel, String source, Parameters params) 
            throws Exception {
        Context context = ObjectModelHelper.getContext(objectModel);
        String fileName = context.getRealPath("/myfile.xsd");

HTH someone else in the future...

Chris
-=-=-

-----Original Message-----
From: Shaw, Chris 
Sent: Friday 22 November 2002 11:38
To: '[EMAIL PROTECTED]'
Subject: how to getRealPath from action


Hi,

How would I get the real path of a file from within an action?

I have the following:

  public Map act(Redirector redirector, SourceResolver resolver,
            Map objectModel, String source, Parameters params) 
            throws Exception {
        Request request = (Request)
objectModel.get(Constants.REQUEST_OBJECT);  // this is deprecated???

And from in here I need to open the URL http://localhost:8080/myfile.xsd as
a file using java.io.File - so I need some way to get the conetxt and the
real path of the file.
                String fileName =
??????.getServletContext().getRealPath("/myfile.xsd");

I trawled the API but without success.

TIA for any ideas.

Chris
-=-=-=

Any e-mail message from the European Central Bank (ECB) is sent in good
faith but shall neither be binding nor construed as constituting a
commitment by the ECB except where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named above.
Any unauthorised disclosure, use or dissemination, either in whole or in
part, is prohibited.
If you have received this e-mail in error, please notify the sender
immediately via e-mail and delete this e-mail from your system.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Any e-mail message from the European Central Bank (ECB) is sent in good faith but 
shall neither be binding nor construed as constituting a commitment by the ECB except 
where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named above. Any 
unauthorised disclosure, use or dissemination, either in whole or in part, is 
prohibited.
If you have received this e-mail in error, please notify the sender immediately via 
e-mail and delete this e-mail from your system.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to