cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <stuart.roeb...@adolos.co.uk>
Subject Solution!! Re: [C2] [TC 4.0m4+] ClassCastException
Date Mon, 04 Dec 2000 14:46:18 GMT
For all those who have been frustratedly putting up with my posts about not getting Cocoon
2 working under the latest Tomcat release, I am hughly relieved to say that it now works.
 But I now lay the challenge of trying to work out why the following patch solves the problem!

Index: ./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
retrieving revision 1.1.2.21
diff -u -r1.1.2.21 WildcardURIMatcherFactory.java
--- ./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java	2000/11/30 21:41:49	1.1.2.21
+++ ./src/org/apache/cocoon/matching/WildcardURIMatcherFactory.java	2000/12/04 12:00:20
@@ -52,7 +52,7 @@
     public String generateMethodSource (NodeIterator conf)
     throws ConfigurationException {
         return "ArrayList list = new ArrayList();" +
-               "String uri = ((HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT)).getRequestURI();"
+
+               "String uri = ((org.apache.cocoon.environment.http.HttpRequest) objectModel.get(Cocoon.REQUEST_OBJECT)).getRequestURI();"
+
                "if (uri.startsWith(\"/\")) uri = uri.substring(1);" +
                "if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match (list, uri,
pattern)) {" +
                "return list;" +

As you can see, I have simply replaced the casting of objectModel.get(Cocoon.REQUEST_OBJECT)
to a HttpServletRequest with a cast to a org.apache.cocoon.environment.http.HttpRequest. 
My debugging seemed to prove that the original object was an org.apache.cocoon.environment.http.HttpRequest,
but such an HttpRequest should inherit from HttpServletRequest, as at least one person on
the group has already said, so the original cast should be completely valid.

However, this has done the trick.  Everything now works!

Why? ... answers on a postcard.

Thanks for your help folks,

Stuart.


Mime
View raw message