Bug 46958 - manager XML interface hard-coded path in XSL transformation
Summary: manager XML interface hard-coded path in XSL transformation
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Manager application (show other bugs)
Version: 6.0.18
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-02 16:55 UTC by photodeus
Modified: 2009-04-28 06:19 UTC (History)
0 users



Attachments
Patch to fix this bug. (1.78 KB, patch)
2009-04-05 05:06 UTC, Varun
Details | Diff

Note You need to log in before you can comment on or make changes to 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.