You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Luca Marrocco <lu...@gmail.com> on 2007/05/27 22:03:11 UTC

integrating wicket and cocoon

i have a trip in my mind. I want using wicket inside cocoon.

a brief regression on cocoon wicket integration interest.. i'm a
professional free software agile developer. My software factory use
only free software or open source software for all development,
testing and production stack. Our application is essentially based
over cocoon (2.1.9) using a custom framework (around cform and
flowscript, you anyone know was it) for controller development and
client side interface. During this day we have interested to
substitute cform (that is quite noise to development) and i want
introduce the using of wicket instead it ;)

now. I have tried this example using wicket 1.2.6 and cocoon 2.2.
Teorically it must work fine, but i have a trouble (a strange
exception) that i'm not understand. Any other people is interesting in
this trip and want help me to integrate wicket and cocoon?

last but not least, the problem :)

first i have developed a workgin wicket application based on these three file:
. MyWebApplication.java
. HomePage.java
. HomePage.html

this is simplest as possible application that display a message (using
simple label value) in the home page of application.

now using cocoon block archetipe creator, i have make a wicket
application that work as cocoon block. essentially i have create a
file in my wicket application like this:
src/main/resources/META-INF/cocoon/spring/servlet-service.xml
<beans . . . >
 <bean id="sitemapServlet" class="org.apache.cocoon.sitemap.SitemapServlet">
   <servlet:context mount-path="/" context-path="blockcontext:/wicket-block/">
       <servlet:connections>
           <entry key="wicketServlet" value-ref="wicketServlet"/>
       </servlet:connections>
   </servlet:context>
 </bean>

 <bean id="wicketServlet" class="wicket.protocol.http.WicketServlet">
   <servlet:context mount-path="/wicket"
context-path="blockcontext:/wicket-block/">
       <servlet:init-params>
           <entry key="applicationClassName"
value="SimplestAsPossibleWebApplication"/>
       </servlet:init-params>
   </servlet:context>
 </bean>
</beans>

essentially this file (used by cocoon) declare two bean or servlet
that can be used inside cocoon's sitemap or from http requet. For
instance:
http://localhost:8888/wicket, call WicketServlet and wicket framework
work and response
http://localhost:8888/, call sitemap servlet aka cocoon framework work
and response

now i have create ad hoc sitemap for this application:
src/main/resources/COB-INF/sitemap.xmap

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 <map:pipelines>
   <map:pipeline>
     <map:match pattern="message">
       <map:generate src="servlet:wicketServket:/" />
       <map:serialize type="html"/>
     </map:match>
   </map:pipeline>
 </map:pipelines>
</map:sitemap>

in my mind (i have a serios problem in my mind? :) this is i want:
* i want call cocoon using follow request http://localhost:8888/message
* cocoon match pipeline
* cocoon generate a stream (for example of html) calling wicketServlet
/ aka calling http://localhost:8888/wicket/
* wicket must elaborate the request and return a html content
* cocoon serialize content

but when i try above example in running application i get following
message from cocoon and wicket..
java.lang.UnsupportedOperationException
       at org.apache.cocoon.servletservice.util.BlockCallHttpServletRequest.getLocale(BlockCallHttpServletRequest.java:160)
       at wicket.protocol.http.servlet.ServletWebRequest.getLocale(ServletWebRequest.java:91)
       at wicket.protocol.http.WebApplication.getSession(WebApplication.java:662)
       at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:197)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:537)
       at org.apache.cocoon.servletservice.ServletServiceContext$NamedDispatcher.forward(ServletServiceContext.java:480)
       at org.apache.cocoon.servletservice.ServletConnection.getInputStream(ServletConnection.java:115)
       at org.apache.cocoon.servletservice.components.ServletSource.getInputStream(ServletSource.java:54)
       at org.apache.cocoon.components.source.util.SourceUtil.getInputSource(SourceUtil.java:371)
       at org.apache.cocoon.components.source.util.SourceUtil.parse(SourceUtil.java:237)
       at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:61)
       at $Proxy4.generate(Unknown Source)
       at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:542)
       at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:271)
       at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:61)
       at $Proxy3.process(Unknown Source)
       at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134)
       at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
       at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
       at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
       at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:151)
       at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
       at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
       at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
       at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:171)
       at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:251)
       at org.apache.cocoon.servlet.RequestProcessor.process(RequestProcessor.java:349)
       at org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java:163)
       at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:61)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:537)
       at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:519)
       at org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:229)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
       at $Proxy0.service(Unknown Source)
       at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:124)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459)
       at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
       at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231)
       at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629)
       at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:453)
       at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
       at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
       at org.mortbay.jetty.Server.handle(Server.java:303)
       at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452)
       at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349)
       at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:320)
       at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)



the first two line is quite interesting:
java.lang.UnsupportedOperationException
       at org.apache.cocoon.servletservice.util.BlockCallHttpServletRequest.getLocale(BlockCallHttpServletRequest.java:160)
       at wicket.protocol.http.servlet.ServletWebRequest.getLocale(ServletWebRequest.java:91)

?? wicket try to getLocale from BlockCallHttpServletRequest but it
response with an exception that getLocale is no supported. ??


Luca

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: integrating wicket and cocoon

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Luca Marrocco pisze:
> i have a trip in my mind. I want using wicket inside cocoon.
> 
> a brief regression on cocoon wicket integration interest.. i'm a
> professional free software agile developer. My software factory use
> only free software or open source software for all development,
> testing and production stack. Our application is essentially based
> over cocoon (2.1.9) using a custom framework (around cform and
> flowscript, you anyone know was it) for controller development and
> client side interface. During this day we have interested to
> substitute cform (that is quite noise to development) and i want
> introduce the using of wicket instead it ;)

Would you like to explain us why you want to integrate Wicket? What are the benefits?

<snip/>

> 
> the first two line is quite interesting:
> java.lang.UnsupportedOperationException
>       at 
> org.apache.cocoon.servletservice.util.BlockCallHttpServletRequest.getLocale(BlockCallHttpServletRequest.java:160) 
> 
>       at 
> wicket.protocol.http.servlet.ServletWebRequest.getLocale(ServletWebRequest.java:91) 
> 
> 
> ?? wicket try to getLocale from BlockCallHttpServletRequest but it
> response with an exception that getLocale is no supported. ??

Take a look at:
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java

Especially:
/* (non-Javadoc)
  * @see javax.servlet.ServletRequest#getLocale()
  */
public Locale getLocale() {
   // TODO Implement this
   throw new UnsupportedOperationException();
}

As you see there is TODO mark. Servlet-service is a work-in-progress and there is a plenty of work to have meaningful implementation of all 
methods. Basically, we need to pass values from original request to the servlet request. Your problem is similar to the one described here:
https://issues.apache.org/jira/browse/COCOON-2066

I think we need to wait until Daniel (as he is a main author of servlet-service-fw) helps to resolve COCOON-2066 so we'll know how to fix 
your problem. Create an issue for your problem and we'll take care of it as soon as we'll be able.

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org