cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Refondini <patrick.refond...@pobox.com>
Subject Re: Cocoon 2.2 - how to wire block into webapp
Date Tue, 24 Oct 2006 08:18:08 GMT

Hi Felix,

Felix Knecht wrote:
> HI Patrick
> 
>> Hi,
>> I have created a webapp named test and a block named demo
>>
>> They've been created using the cocoon-22-archetype-webapp and
>> cocoon-22-archetype-block
>>
>> Now I have introduce a dependency in test webapp on demo block:
>> (...)
>>   <dependencies>
>> (...)
>>     <dependency>
>>       <groupId>ch.smartgene</groupId>
>>       <artifactId>demo</artifactId>
>>       <version>1.0.0-SNAPSHOT</version>
>>     </dependency>
>>   </dependencies>
>> (...)
>>
>> I can see the demo block is deployed into the test webapp.
>>
>> My questions:
>>
>> 1. Is the above the right way to include blocks into webapp with Cocoon
>> 2.2 ?
> 
> This looks ok to me.
> You need to install the block using mvn install.
> 
>> 2. If 1. is no wrong then how can test webapp make use of what is
>> available in demo block (URL conventions /demo /blocks/demo ... to be
>> defined ?)
> 
> The url /block/demo should be the right one. You need to start the
> (web-)application first:
> - Goto the block directory and install the block (mvn install)
> - Goto to the webapp directory
> - Start the application: mvn cocoon:deploy jetty6:run (I'm not sure if
> cocoon:deploy is still needed)	
> - Point your browser to http://localhost:8888/block/demo
Yes, this is the case when I am running the demo block by itself in its 
own project.

When I run the "test" project which does include the demo block I cannot 
manage to have the same URL working.
The webapp layout I observe in test project target/cocoon-webapp 
directory is:

|-- WEB-INF
|   |-- applicationContext.xml
|   |-- cocoon
|   |   |-- cocoon.xconf
|   |   |-- lib
(...)
|   |   |   |-- demo-1.0.0-SNAPSHOT.jar
(...)
|   |   |-- spring
|   |   |   |-- cocoon-core-applicationContext.xml
|   |   |   `-- demo-application-context.xml
(...)
|   `-- web.xml
|-- blocks
|   `-- demo
|       |-- demo.js
|       |-- demo.xml
|       `-- sitemap.xmap
|-- sitemap.xmap
`-- welcome.xml

The content of the root sitemap.xmap only pipeline is as follow:
<map:pipeline>
   <map:match pattern="">
     <map:generate src="welcome.xml"/>
       <map:serialize type="xhtml"/>
     </map:match>

     <!-- ADDED FOR TEST -->
     <map:match pattern="demo">
       <map:redirect-to uri="blocks/demo/"/>
     </map:match>		

     <!-- ADDED FOR TEST -->
     <!--+
         | Mount everything else by calling the sitemap.xmap file located
	| in the requested folder (sub-folder).
	+-->
      <map:match pattern="*/**">
        <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/>
      </map:match>
</map:pipeline>

Neither the redirect-to nor mount has the effect I expected: The demo 
block stays unreachable !

Any idea of what I overlook ?

Patrick

> 
> Port configuration can be found in test/pom.xml (test = webapp directory)
> 
>> Any hints or direction to examples, documentation are welcome.
> 
> Sample for webapp: {cocoon2.2-src}/core/cocoon-webapp
> Sample for block:  {cocoon2.2-src}/blocks
> 
> Felix
> 
>> Patrick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


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


Mime
View raw message