Well I tracked it down... the problem is in
org.apache.cocoon.Utils.getBaseName() method (included in the end of
this post)...
The problem is that Cocoon get's the servlet name instead of XSP
filename.
As Cocoon uses ServletContext.getRealPath(path) for mapping requested
virtual URL to the filesystem, then possible workarounds are:
1. Give JetspeedServletRequest access to virtual URL of XSP file and
return this in response to request.getServletPath().
2. Emulate JServ or command line mode and return the physical path to
the XSP file from request.getPathTranslated().
3. Wrap ServletContext and return the physical path to the XSP file from
ServletContext.getRealPath().
Well, the cleanest would probably be the first solution, but this
would't allow us to cache the stylesheets.
Second one is a hack and I don't like it.
Third one is a smaller hack, but still.
So I don't have a clear idea how to solve this... Waiting for comments.
Neeme
public static final String getBasename(HttpServletRequest request,
Object context) {
String path;
try {
// detect if the engine supports at least Servlet API 2.2
request.getContextPath();
// we need to check this in case we've been included in a
servlet or jsp
path = (String)
request.getAttribute("javax.servlet.include.servlet_path");
// otherwise, we find it out ourselves
if (path == null) path = request.getServletPath();
// FIXME (SM): we should use getResource() instead when we
are
// able to handle remote resources.
String resource = ((ServletContext)
context).getRealPath(path);
if (resource != null) {
return resource.replace('\\', '/');
} else {
throw new RuntimeException("Cannot access non-file/war
resources");
}
} catch (NoSuchMethodError e) {
// if there is no such method we must be in Servlet API 2.1
if (request.getPathInfo() != null) {
// this must be Apache JServ
path = request.getPathTranslated();
} else {
// otherwise use the deprecated method on all other
servlet engines.
path = request.getRealPath(request.getRequestURI());
}
return (path == null) ? "" : path.replace('\\','/');
} catch (NullPointerException e) {
// if there is no context set, we must be called from the
command line
return request.getPathTranslated().replace('\\','/');
}
}
> -----Original Message-----
> From: Neeme Praks
> Sent: Saturday, June 10, 2000 10:25 PM
> To: JetSpeed (E-mail)
> Subject: major bug with XSP
>
>
>
> Every time a java class is generated from XSP file, it is stored in
> repository as _<jetspeed root>/_jetspeed.java (in my case
> repository\_D_\_Turbine\_webapps\_jetspeed\_jetspeed.java). This is
> definitely not correct, otherwise we could have only one XSP page per
> jetspeed installation ;-)
>
> I'll try to find where does this occur, but I think Kevin
> would probably
> find it faster ;-)
>
> Neeme
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
>
>
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]