Author: indika
Date: Mon Apr 7 05:02:34 2008
New Revision: 15603
Log:
minor fix to issue that occurs due to override the init(servletconfig) method
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/ESBServlet.java
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/StartUpServlet.java
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/ESBServlet.java
==============================================================================
---
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/ESBServlet.java
(original)
+++
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/ESBServlet.java
Mon Apr 7 05:02:34 2008
@@ -20,6 +20,7 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.transport.http.AxisServlet;
+import org.apache.axis2.transport.http.ListingAgent;
import org.jaxen.SimpleNamespaceContext;
import org.jaxen.XPath;
import org.wso2.esb.ServiceBusConstants;
@@ -52,10 +53,11 @@
public void init(ServletConfig config) throws ServletException {
ServletContext servletContext = config.getServletContext();
- this.configContext =
ServiceBusManager.getInstance().getConfigurationContext();
- this.axisConfiguration = this.configContext.getAxisConfiguration();
+ configContext =
ServiceBusManager.getInstance().getConfigurationContext();
+ axisConfiguration = configContext.getAxisConfiguration();
servletContext.setAttribute(this.getClass().getName(), this);
- this.servletConfig = config;
+ servletConfig = config;
+ agent = new ListingAgent(configContext);
populateGetRequestProcessors();
initParams();
}
@@ -64,10 +66,19 @@
this.configContext.setContextRoot("/");
}
+ public ServletContext getServletContext() {
+ return getServletConfig().getServletContext();
+ }
+
+
+ public ServletConfig getServletConfig() {
+ return this.servletConfig;
+ }
+
protected MessageContext createMessageContext(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
MessageContext msgContext = super.createMessageContext(req, resp);
TransportInDescription adminTransIn = axisConfiguration.getTransportIn(
- ServiceBusConstants.ADMIN_TRANSPORT);
+ ServiceBusConstants.ADMIN_TRANSPORT);
if (adminTransIn != null) {
msgContext.setTransportIn(adminTransIn);
}
@@ -80,14 +91,14 @@
for (Iterator iter = requestProcessors.keySet().iterator();
iter.hasNext();) {
String item = (String) iter.next();
if (queryString.indexOf(item) == 0 &&
- (queryString.equals(item) ||
- queryString.indexOf("&") == item.length() ||
- queryString.indexOf("=") == item.length())) {
+ (queryString.equals(item) ||
+ queryString.indexOf("&") == item.length() ||
+ queryString.indexOf("=") == item.length())) {
try {
((HttpGetRequestProcessor)
requestProcessors.get(item)).process(
- httpServletRequest,
- httpServletResponse,
- configContext);
+ httpServletRequest,
+ httpServletResponse,
+ configContext);
} catch (Exception e) {
// todo
}
@@ -118,11 +129,11 @@
throw new ServletException("Required element, 'Class'
not found!");
} else {
processor =
- (HttpGetRequestProcessor)
-
Class.forName(classEle.getText().trim()).newInstance();
+ (HttpGetRequestProcessor)
+
Class.forName(classEle.getText().trim()).newInstance();
}
requestProcessors.put(itemEle.getText().trim(),
- processor);
+ processor);
}
}
} catch (Exception e) {
Modified:
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/StartUpServlet.java
==============================================================================
---
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/StartUpServlet.java
(original)
+++
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/transport/tomcat/StartUpServlet.java
Mon Apr 7 05:02:34 2008
@@ -129,8 +129,10 @@
// If esb.home has provided as init-param,the it will take as esb home
String esbHomeAsParam =
servletConfig.getInitParameter(ServiceBusConstants.ESB_HOME);
if (esbHomeAsParam != null) {
- if (esbHomeAsParam.endsWith("/")) {
- return esbHomeAsParam.substring(0,
esbHomeAsParam.lastIndexOf("/"));
+ if (esbHomeAsParam.endsWith(File.separator)) {
+ return esbHomeAsParam.substring(0,
esbHomeAsParam.lastIndexOf(File.separator));
+ } else {
+ return esbHomeAsParam;
}
}
//if esb.home has set as a system property , then use it
@@ -141,10 +143,11 @@
//if esb.home stil can not find ,then resolve it using real path
of the WEB-INF
String webinfPath = servletContext.getRealPath("WEB-INF");
if (webinfPath != null) {
- esbHome = webinfPath.substring(0,
webinfPath.lastIndexOf("webapp/WEB-INF"));
+ esbHome = webinfPath.substring(0,
webinfPath.lastIndexOf("webapp" +
+ File.separator + "WEB-INF"));
if (esbHome != null) {
- if (esbHome.endsWith("/")) {
- esbHome = esbHome.substring(0,
esbHome.lastIndexOf("/"));
+ if (esbHome.endsWith(File.separator)) {
+ esbHome = esbHome.substring(0,
esbHome.lastIndexOf(File.separator));
}
}
}
_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev