Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Subject: Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Proposal: Adding jar manifest classpath in jar and war plugins
Servlet File Download dialog problem (IE6,Adobe 6 0)
java security AccessControlException: access denied (java io FilePermission
Unsupported major minor version 48 0 problem while running the an
   telope task
Subject: axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
Classpath problem
jsp data into Excel
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
Subject: InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Subject: AXIS: tomcat timeout ?
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
XDoclet, Struts and Maven: Where to start? SOLUTION
Subject: Running junit tests fails
 
Migrating to Cocoon 2.2... calling servlets from Cocoon: ServletServiceGener

Migrating to Cocoon 2.2... calling servlets from Cocoon: ServletServiceGener

2007-11-22       - By Grzegorz Kossakowski

 Back
Reply:     1     2  

Josh2007 pisze:
> Hi,
>
> I'm migrating from Cocoon 2.1 to Cocoon 2.2.
> Cocoon 2.2 is deployed as a servlet in Tomcat along with 2 other servlets:
> Axis 2 and eXist xmldb.
>
> It seems with Cocoon 2.2 I can call my 2 other servlets from Cocoon and get
> any xml result they will generate in my sitemap.

Yep, but you can only call servlets that are registered as Spring-beans, using
configuration file
like this[1]:
  <bean id="org.apache.cocoon.servletservice.demo1.servlet"
class="org.apache.cocoon.servletservice.demo1.DemoServlet">
      <servlet:context mount-path="/test1">
        <servlet:init-params>
        <entry key="foo" value="baz"/>
      </servlet:init-params>
      <servlet:connections>
        <entry key="demo2" value-ref="org.apache.cocoon.servletservice.demo2
.servlet"/>
      </servlet:connections>
    </servlet:context>
  </bean>

In most cases it's not a big problem to configure servlets that way.

> Can I do that with ServletServiceGenerator? Is there any example? I've been
> searching without success for now.

Actually, ServletServiceGenerator does something more than just fetching data
from other servlets
(it's a job of servlet source). Take a look at this example[2]:

     <!-- This is a test of basic servlet services functionality
          servletService generator makes a HTTP POST request on servlet:test2:
/basic-service.
          Generator posts content of test.xml file and returns to the pipeline
result of service call.
     -->
     <map:match pattern="test5">
       <map:generate type="servletService" src="test.xml">
         <map:parameter name="service" value="servlet:test2:/basic-service
?caller=generator"/>
       </map:generate>
       <map:serialize type="xml"/>
     </map:match>

The comment above the match explains what happens quite well. The idea is to
fetch data that is
based on POSTed data. This way servlet:test2:/basic-service can be viewed as
pipeline *fragment*
looking even implementation[2] looks like this:
     <!-- This basic service pipeline takes POSTed XML and applays simple
transformation on it -->
     <map:match pattern="basic-service">
       <map:generate src="service-consumer:"/>
       <map:transform src="service-test.xsl">
         <map:parameter name="caller" value="{request-param:caller}"/>
       </map:transform>
       <map:serialize type="xml"/>
     </map:match>

> Will my sitemap look like this?
>
> <map:pipeline>      
>   <map:match pattern="test">
>     <map:generate src="anySoapRequest.xml" type="ServletServiceGenerator"/>
>     <map:serialize type="xml"/>
>   </map:match>      
> </map:pipeline>

I would say it would look like this:
<map:pipeline>
 <map:match pattern="test">
   <map:generate src="servlet:axis:/anySoapRequest" type="file"/>
   <map:serialize type="xml"/>
 </map:match>
</map:pipeline>

> Thanks for your help,

I suggest to take a closer look at cocoon-servlet-service-sample module that
contains some simple
demos. Of course they are not ideal but at least they present the most
important features of Servlet
Service Framework.

I hope that helps a little.

[1]
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon
-servlet-service-sample/src/main/resources/META-INF/cocoon/spring/cocoon-servlet
-service-demo1-servletService.xml
[2]
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon
-servlet-service-sample/src/main/resources/COB-INF/test1/sitemap.xmap
[3]
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-servlet-service/cocoon
-servlet-service-sample/src/main/resources/COB-INF/test2/sitemap.xmap

--
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)