[wsas-java-dev] svn commit r1132 - in
branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas:
security transport/util
svn at wso2.org
svn at wso2.org
Mon Mar 5 19:09:00 PST 2007
Author: azeez
Date: Mon Mar 5 19:08:46 2007
New Revision: 1132
Modified:
branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java
branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/util/HttpGetRequestProcessor.java
Log:
Fixing context path problems
Modified: branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/security/ServerCrypto.java Mon Mar 5 19:08:46 2007
@@ -622,8 +622,7 @@
}
try {
KeyStore tempStore;
- String provider = properties.getProperty(this
- .getKeyStoreProvider(ksId));
+ String provider = properties.getProperty(this.getKeyStoreProvider(ksId));
if (provider == null || provider.trim().length() == 0) {
tempStore = KeyStore.getInstance(properties.getProperty(this
.getKeyStoreLocation(ksId), KeyStore.getDefaultType()));
Modified: branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/util/HttpGetRequestProcessor.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/util/HttpGetRequestProcessor.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/util/HttpGetRequestProcessor.java Mon Mar 5 19:08:46 2007
@@ -143,9 +143,9 @@
response.setContentType("text/xml");
// Filter out the 'root' from serviceContextPath
- String serviceContextPath = configurationContext.getServiceContextPath();
+ String serviceContextPath = getServiceContextPath(configurationContext);
int indexOfServletPath =
- request.getContextPath().indexOf(configurationContext.getServiceContextPath());
+ request.getContextPath().indexOf(serviceContextPath);
String contextRoot;
if (indexOfServletPath == -1) {
contextRoot = request.getContextPath();
@@ -181,14 +181,14 @@
}
}
- public static void processPolicy(ConfigurationContext configurationContext,
+ public static void processPolicy(ConfigurationContext configCtx,
String requestURI,
HttpServletResponse response,
HttpServletRequest request) throws IOException {
- String serviceName = requestURI
- .substring(requestURI.lastIndexOf("/") + 1);
+
+ String serviceName = requestURI.substring(requestURI.lastIndexOf("/") + 1);
AxisService axisService =
- configurationContext.getAxisConfiguration().getServiceForActivation(serviceName);
+ configCtx.getAxisConfiguration().getServiceForActivation(serviceName);
OutputStream outputStream = response.getOutputStream();
if (axisService != null) {
@@ -211,7 +211,7 @@
if (policyElements == null) {
response.setContentType("text/html");
- outputStream.write("<h4>Policy elements are not found!</h4>".getBytes());
+ outputStream.write("<h4>Policy elements not found!</h4>".getBytes());
outputStream.flush();
return;
}
@@ -219,10 +219,10 @@
PolicyRegistry reg = policyInclude.getPolicyRegistry();
ExternalPolicySerializer serializer = new ExternalPolicySerializer();
- if (configurationContext.getAxisConfiguration()
+ if (configCtx.getAxisConfiguration()
.getLocalPolicyAssertions() != null) {
serializer.setAssertionsToFilter(
- configurationContext.getAxisConfiguration().getLocalPolicyAssertions());
+ configCtx.getAxisConfiguration().getLocalPolicyAssertions());
}
@@ -240,7 +240,7 @@
Policy p = reg.lookup(key);
if (p == null) {
response.setContentType("text/html");
- outputStream.write("<h4>Policy element is not found!</h4>".getBytes());
+ outputStream.write("<h4>Policy element not found!</h4>".getBytes());
} else {
serializer.serialize(p, outputStream);
}
@@ -264,43 +264,41 @@
if (p == null) {
response.setContentType("text/html");
outputStream
- .write("<h4>Policy element is not found!</h4>".getBytes());
+ .write("<h4>Policy element not found!</h4>".getBytes());
} else {
serializer.serialize(p, outputStream);
}
}
} else {
response.setContentType("text/html");
- outputStream.write("<h4>Policy is not found!</h4>".getBytes());
+ outputStream.write("<h4>Policy not found!</h4>".getBytes());
}
} else {
if (policyElements.size() == 0) {
response.setContentType("text/html");
- outputStream.write("<h4>Policy is not found!</h4>".getBytes());
+ outputStream.write("<h4>Policy not found!</h4>".getBytes());
} else {
String ipAddress = "http://" + NetworkUtils.getLocalHostname() + ":" +
ServerManager.httpPort;
+ ServerConfiguration serverCofig = ServerConfiguration.getInstance();
outputStream.write(("<html><head>" +
"<title>WSO2 Web Services Application Server v" +
- ServerConfiguration.getInstance()
- .getFirstProperty("Version") +
- " Management Console - " +
- axisService
- .getName() +
- " Service Policies</title>" +
- "</head>" +
- "<body>" +
- "<b>Policies for " +
- axisService
- .getName() +
- " service</b><br/><br/>").getBytes());
+ serverCofig.getFirstProperty("Version") +
+ " Management Console - " +
+ axisService.getName() +
+ " Service Policies</title>" +
+ "</head>" +
+ "<body>" +
+ "<b>Policies for " +
+ axisService.getName() +
+ " service</b><br/><br/>").getBytes());
if (policyElements.size() != 0) {
+ String serviceContextPath = getServiceContextPath(configCtx);
for (int i = 0; i < policyElements.size(); i++) {
String st = "<a href=\"" + ipAddress +
- configurationContext.getServiceContextPath() + "/" +
+ serviceContextPath + "/" +
axisService.getName() + "?policy&id=" + i +
- "\">Policy " +
- i +
+ "\">Policy " + i +
"</a><br/>";
outputStream.write(st.getBytes());
}
@@ -314,23 +312,20 @@
}
} else { // Service is null
response.setContentType("text/html");
- outputStream.write(("<h4>Service " +
- serviceName +
+ outputStream.write(("<h4>Service " + serviceName +
" not found. Cannot display policies.</h4>").getBytes());
outputStream.flush();
}
outputStream.flush();
-
}
- public static void processXsd(ConfigurationContext configurationContext,
+ public static void processXsd(ConfigurationContext configCtx,
String requestURI,
HttpServletResponse response,
HttpServletRequest request) throws IOException {
- String serviceName = requestURI
- .substring(requestURI.lastIndexOf("/") + 1);
+ String serviceName = requestURI.substring(requestURI.lastIndexOf("/") + 1);
AxisService axisService =
- configurationContext.getAxisConfiguration().getServiceForActivation(serviceName);
+ configCtx.getAxisConfiguration().getServiceForActivation(serviceName);
OutputStream outputStream = response.getOutputStream();
if (axisService != null) {
if (!axisService.isActive()) {
@@ -342,7 +337,7 @@
}
int indexOfServletPath =
- request.getContextPath().indexOf(configurationContext.getServiceContextPath());
+ request.getContextPath().indexOf(getServiceContextPath(configCtx));
String contextRoot;
if (indexOfServletPath == -1) {
contextRoot = request.getContextPath();
@@ -388,7 +383,7 @@
if (schemas.size() != 0) {
for (int i = 0; i < schemas.size(); i++) {
String st = "<a href=\"" + ipAddress +
- configurationContext.getServiceContextPath() + "/" +
+ getServiceContextPath(configCtx) + "/" +
axisService.getName() + "?xsd&id=" + i + "\">Schema " + i +
"</a><br/>";
outputStream.write(st.getBytes());
@@ -497,4 +492,13 @@
log.error(e);
}
}
+
+ private static String getServiceContextPath(ConfigurationContext configCtx) {
+ String serviceContextPath = configCtx.getServiceContextPath();
+ if (!configCtx.getContextRoot().equals("/")
+ && !serviceContextPath.startsWith("/")) {
+ serviceContextPath = "/" + serviceContextPath;
+ }
+ return serviceContextPath;
+ }
}
More information about the Wsas-java-dev
mailing list