Bug 46958

Summary: manager XML interface hard-coded path in XSL transformation
Product: Tomcat 6 Reporter: photodeus
Component: Manager applicationAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.18   
Target Milestone: default   
Hardware: All   
OS: All   
Attachments: Patch to fix this bug.

Description photodeus 2009-04-02 16:55:36 UTC
The manager XML-interface cannot be used if it's installed under any other path than /manager, failing to find the xform.xsl file needed for XSL transformation.

Fails:
http://example.com/mymanager/status?XML=true

Works:
http://example.com/manager/status?XML=true

Reason for error, in Tomcat sources
org.apache.catalina.manager.Constants
XML_STYLE returns the constant value 
"<?xml-stylesheet type=\"text/xsl\" href=\"/manager/xform.xsl\" ?>";

The /manager part needs to be modified to match webapp path.

Caller:
org.apache.catalina.util.RequestUtil.StatusTransformer
public static void writeHeader(PrintWriter writer, final String contextPath, int mode) {
  //...
  // TODO needs current virtual webapp path as parameter
  writer.write(Constants.XML_STYLE);

}

On a sidenote, in org.apache.catalina.manager.host.Constants there is a similar hard-coded value, which might cause similar problems in the future. It seems to be unreferenced in the current sources right now (unused value).
Comment 1 Varun 2009-04-05 05:06:28 UTC
Created attachment 23442 [details]
Patch to fix this bug.
Comment 2 Mark Thomas 2009-04-08 04:41:17 UTC
Thanks for the report.

Since it is only used in the one place I took the simpler option of using a relative path rather than an absolute one. It also saves having to handle the unlikely case of the manager app being deployed as ROOT in which case request.getContextPath() would return ""

I also removed the unused constants from the host manager.

The fix has been applied to trunk and proposed for 6.0.x
Comment 3 Mark Thomas 2009-04-28 06:19:15 UTC
This has been fixed in 6.0.x and will be in 6.0.20 onwards.