Hi,
I just tested the WAR with Jetty-5.1.14 and Tomcat-5.5.26. It was broken
with Jetty-5.1.14 as the getContextPth() method is not available. On
Tomcat-5.5.26, the implementation class of ServletContext happens to have
the method and it's by luck working.
Thanks,
Raymond
----- Original Message -----
From: "Raymond Feng" <[EMAIL PROTECTED]>
To: <tuscany-dev@ws.apache.org>
Sent: Sunday, February 10, 2008 9:46 PM
Subject: Re: svn commit: r620376 -
/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
Hi,
I don't think this is a good fix. The ServletContext.getContextPath() is
introduced for Servlet Spec 2.5 or later. The major/minor version can tell
us if the current ServletContext has getContextPath() method. In Servlet
2.4, the getContextPath() is only available on HttpServletRequest.
With this change, we'll get IllegalStateException for Servlet version
before 2.5. Is the WebSphere Servlet at the level of 2.5 or later? If so,
the getContextPath() should return a valid value as required by the spec.
(See [1]). If it returns null, it should be a WebSphere bug :-).
BTW, I don't know why we check the init-parameter for the contextPath as a
fall-back. Is it a Tuscany specific thing or a Servlet spec statement (I
couldn't find it in Servlet spec 2.4)?
Thanks,
Raymond
[1]
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getContextPath()
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 10, 2008 6:06 PM
Subject: svn commit: r620376 -
/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
Author: lresende
Date: Sun Feb 10 18:06:37 2008
New Revision: 620376
URL: http://svn.apache.org/viewvc?rev=620376&view=rev
Log:
Comment code that was failing to retrieve contextPath in certain web
containers
Modified:
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
Modified:
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java?rev=620376&r1=620375&r2=620376&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
(original)
+++
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
Sun Feb 10 18:06:37 2008
@@ -240,7 +240,8 @@
public void initContextPath(ServletConfig config) {
ServletContext context = config.getServletContext();
int version = context.getMajorVersion() * 100 +
context.getMinorVersion();
- if (version >= 205) {
+ //FIXME Do we really need this ? Servlet 2.4 Spec does mention
getContextPath
+ //if (version >= 205) {
// The getContextPath() is introduced since Servlet 2.5
Method m;
try {
@@ -254,9 +255,9 @@
throw new IllegalStateException(
"'contextPath' init
parameter must be set for pre-2.5 servlet container");
}
- } else {
- contextPath = config.getInitParameter("contextPath");
- }
+ //} else {
+ // contextPath = config.getInitParameter("contextPath");
+ //}
logger.info("initContextPath: " + contextPath);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]