Hi, I could not find a place to submit patches so I try this way:

I have been trying to include the outpout from an action with an XSLT
view in a jsp -page. At least on Jetty this does currently not work: the
XSLTServlet is invoked; but when it tries to get the xslt-file but
getServletPath() it instead receives the name of the original JSP page
it was included from. 

By checking if javax.servlet.include.servlet_path is available this is
possible to fix. Here is a new version of getTemplates() that fixes the
problem (i.e makes it possible to inlucde actions with xslt-views from
jsp):

   protected Templates getTemplates(HttpServletRequest request)
      throws TransformerException, java.io.IOException {
      String uri = (String)
         request.getAttribute("javax.servlet.include.servlet_path");
      if ( uri == null) {
         uri = request.getServletPath();
      } 
      
      String   path = getServletContext().getRealPath(uri);
      if (path == null) {
         throw new TransformerException("Stylesheet " + path + " not
found");
      }
      
      Templates templates = (Templates) templatesCache.get(path);
      if (templates == null) {
         synchronized (templatesCache) {
            // This may result in the template being put into the cache
multiple times
            // if concurrent requests are made, but that's ok.
            log.debug("Preparing new XSLT stylesheet: " + path);
            TransformerFactory factory =
TransformerFactory.newInstance();
            templates = factory.newTemplates(new StreamSource(new
File(path)));
            templatesCache.put(path, templates);
         }
      }
      return templates;
   }

//Peter
-- 
------------------------------------------------------------
Peter Antman    Chief Technology Officer, Development
Technology in Media, Box 34105 100 26 Stockholm
WWW: http://www.tim.se  WWW: http://www.backsource.org
Email: [EMAIL PROTECTED]        
Phone: +46-(0)8-506 381 11 Mobile: +46-(0)704 20 58 11
------------------------------------------------------------



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to