Hi guys -
Many thanks for your suggestion - I'll take a look at the source resolver
and see if it fits the bill.
Many thanks,
Anil.
Carsten Ziegeler wrote:
>
> Reinhard Poetz wrote:
>> anil wrote:
>>> Hi -
>>>
>>> Just to update this posting with my investigations - I've managed to
>>> extract
>>> the file contents within my spring bean.
>>>
>>> The basic problem was the way I was creating the file object - the path
>>> returned by the cocoon.context.getRealPath() method was a URI & when
>>> instantiating my File object I needed to create a URI object first.
>>>
>>> Therefore it was:
>>>
>>> URI fileURI = new URI("<output of cocoon.context.getRealPath>");
>>> File file = new File(fileURI);
>>>
>>> rather than just new File("<output of cocoon.context.getRealPath>");
>>>
>>> Sorry - I should have noticed this - I assumed that I should be able
>>> to pass
>>> the abstract path into File object directly - I blame it on the late
>>> nights!
>>>
>>> One thing I still don't really understand though is that I'm still
>>> unable to
>>> get a path to the resource that I want to access through my spring
>>> bean as
>>> cocoon.context.getRealPath("xqy/test.xqy") still returns null. In
>>> order to
>>> get round this I do:
>>>
>>> var fullPath = cocoon.context.getRealPath("/") + "xqy/test.xqy";
>>>
>>> If anyone could clear up that confusion I'd be very grateful.
>>
>> Just wondering: Why can't you use the source resolver?
>>
> getRealPath() on the context is mapped to the getRealPath of the servlet
> context. The method is described as follows:
> "Returns aString containing the real path for a given virtual path. For
> example, the path “/index.html” returns the absolute file path on the
> server’s file-system would be served by a request for
> “http://host/contextPath/index.html”,
> where contextPath is the context path of this ServletContext."
>
> Now I guess that you want to get the resource so if you would use the
> servlet context, the getResource() method would be the right choice.
> In Cocoon it's, as Reinhard suggested, the source resolver you should use.
>
> Carsten
>
>
> --
> Carsten Ziegeler
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/cocoon.context.getRealPath---cocoon-2.2-tp14818755p15023553.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]