[opencms-dev] Flex and Servlet API 2.2

Alexander Kandzior alex at opencms.org
Tue Feb 25 10:06:26 CET 2003


Hi Publius Ismanescu,

I choose Servlet 2.3 because it had the read-made wrapper classes
available in the API. 

You might be able to just take the source code from the 2.3 API
implementation, copy the wrapper classes stuff to another package, and
use this wrappers instead of the ones from the 2.3 API. 

However, the classcast exception you are experiencing might not even be
related to that issue. There are servlet container implementations that
wrap another class around the request (e.g. Resin does). I tested it
with Tomcat and BEA, where this works, but others seem to handle the
requests differently. In this environments you can not classcast the
"request" object back to a FlexRequest. This is why we do not recommend
to use the classcast on a JSP anymore and have introduced a bean called
CmsJspActionElement (all of this will be described in the 5.0
documentation).

To implement a different mechansim would possible but time-consuming. My
initial idea is to have the OpenCms information stored in a
requestContext attribute, then access the information from there in the
mentioned CmsJspActionElement. I will be able to work on this issue for
quite some time, though.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org 
> [mailto:owner-opencms-dev at www.opencms.org] On Behalf Of 
> Publius Ismanescu
> Sent: Monday, February 24, 2003 7:31 PM
> To: opencms-dev at www.opencms.org
> Subject: [opencms-dev] Flex and Servlet API 2.2
> 
> 
> Hi Alexander Kandzior
> 
> I would appreciate if you can help me out with this.
> I know flex is using Servlet 2.3. but I have to make it work with 
> servlet 2.2.
> My plan is to change the Flex classes to use the servlet 2.2 
> API's If you remember the problems you had when you were 
> writing flex I would 
> appreciate if you can mention some of the major ones.
> So far , what I did , was to change the CmsFlexRequest and 
> CmsFlexResponse to implement the interfaces rather than the wrapper 
> class from Servlet 2.3. an some other changes
> 
> I am getting a cast exception when I call the index.jsp.
> 
> Can you please make some comments on this , are there some 
> problems with 
> using servlet 2.2 so you decided to implement using the 
> servlet 2.3 or 
> it is posible to do it even with servlet 2.2 but maybe more 
> diffficult 
> that the way you did it (with Servlet 2.3)
> 
> Thank you
> Publius Ismanescu
> 
> 
> javax.servlet.ServletException: Resource loader error in file 
> '/index.jsp'
> 
> Root cause:
> java.lang.ClassCastException: com.opencms.flex.cache.CmsFlexRequest
>     at 
> org.apache.tomcat.facade.RequestDispatcherImpl.doInclude(Reque
> stDispatcherImpl.java:300)
>     at 
> org.apache.tomcat.facade.RequestDispatcherImpl.include(Request
> DispatcherImpl.java:189)
>     at 
> com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> xRequestDispatcher.java:131)
>     at 
> com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> xRequestDispatcher.java:169)
>     at com.opencms.flex.CmsJspLoader.service(CmsJspLoader.java:946)
>     at 
> com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> xRequestDispatcher.java:257)
>     at com.opencms.flex.CmsJspLoader.load(CmsJspLoader.java:554)
>     at com.opencms.flex.CmsJspLoader.initlaunch(CmsJspLoader.java:226)
>     at com.opencms.core.OpenCms.showResource(OpenCms.java:840)
>     at 
> com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:282)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>     at 
> org.apache.tomcat.facade.ServletHandler.doService(ServletHandl
> er.java:574)
>     at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
>     at org.apache.tomcat.core.Handler.service(Handler.java:235)
>     at 
> org.apache.tomcat.facade.ServletHandler.service(ServletHandler
> .java:485)
>     at 
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:917)
>     at 
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
>     at 
> org.apache.tomcat.modules.server.Http10Interceptor.processConn
> ection(Http10Interceptor.java:176)
>     at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> nt.java:494)
>     at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:516)
>     at java.lang.Thread.run(Thread.java:479)
> 
> --------------- End of root cause.
> 
>     at com.opencms.flex.CmsJspLoader.service(CmsJspLoader.java:956)
>     at 
> com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFle
> xRequestDispatcher.java:257)
>     at com.opencms.flex.CmsJspLoader.load(CmsJspLoader.java:554)
>     at com.opencms.flex.CmsJspLoader.initlaunch(CmsJspLoader.java:226)
>     at com.opencms.core.OpenCms.showResource(OpenCms.java:840)
>     at 
> com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:282)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>     at 
> org.apache.tomcat.facade.ServletHandler.doService(ServletHandl
> er.java:574)
>     at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
>     at org.apache.tomcat.core.Handler.service(Handler.java:235)
>     at 
> org.apache.tomcat.facade.ServletHandler.service(ServletHandler
> .java:485)
>     at 
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:917)
>     at 
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
>     at 
> org.apache.tomcat.modules.server.Http10Interceptor.processConn
> ection(Http10Interceptor.java:176)
>     at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> nt.java:494)
>     at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:516)
>     at java.lang.Thread.run(Thread.java:479)
> 
> 
> 





More information about the opencms-dev mailing list