Reinhard Poetz wrote:
Patrick Refondini wrote:
Reinhard Poetz wrote:
Patrick Refondini wrote:

Reinhard Poetz wrote:

Patrick Refondini wrote:

Is there a cocoon-22-archetype-block working with the current trunk ?



no, yesterday evening I've started to work on it.

Great ! I'll be please to give feedback when it is available.


please try (IIRC, the only thing you forgot was the blocks-fw-impl dependency)
Indeed blocks-fw-impl was missing !


I have tested referencing the a testblock from a testwebapp as follow:

Created testblock:

mvn archetype:create -DarchetypeGroupId=org.apache.cocoon -DarchetypeArtifactId=cocoon-22-archetype-block -DarchetypeVersion=1.0.0-M4-SNAPSHOT -DgroupId=ch.extentis -DartifactId=testblock

Installed testblock

Created testwebapp

mvn archetype:create -DarchetypeGroupId=org.apache.cocoon -DarchetypeArtifactId=cocoon-22-archetype-webapp -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=ch.extentis -DartifactId=testwebapp

Added testblock dependency to testwebapp POM:

<dependency>
  <groupId>ch.extentis</groupId>
  <artifactId>testblock</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Added the following to testwebapp sitemap:

<!--  Reference any block by its blockContextURL / mount path ?  -->
<map:match pattern="*/**">
  <map:mount uri-prefix="{1}" src="blockcontext:/{1}/"/>
</map:match>

This shouldn't be necessary to get some result from your testblock as it is automaticially mounted.

1. Webapp

Sorry if I have introduced some confusion by talking of webapp "testwebapp" in a thread titled "How to run block...". I did that test while lacking to run block directly...

In the context of the web application root "testwebapp" I created with cocoon-22-archetype-webapp I did not manage to get result from the testblock in any other way. Given what I read at:

It seems that block protocol is not available from root webapp according to:
http://www.nabble.com/Configuring-BlockServlets-via-properties-and-sitemap-reloading-for-blocks-t2450880.html
Or do I miss something ?


2. Block

Now I finally got block running directly using:
mvn package cocoon:deploy jetty:run

After that the block name "testblock" is available at:
http://localhost:8888/testblock/

Is this the right way to proceed ?

Then in my testblock pom.xml I modified the cocoon-deployer-plugin from its initial state provided by the archetype:

  <plugin>
    <groupId>org.apache.cocoon</groupId>
    <artifactId>cocoon-deployer-plugin</artifactId>
    <version>1.0.0-M2-SNAPSHOT</version>
  </plugin>

to:

  <plugin>
    <groupId>org.apache.cocoon</groupId>
    <artifactId>cocoon-deployer-plugin</artifactId>
    <version>1.0.0-M2-SNAPSHOT</version>
    <executions>
      <execution>
        <phase>package</phase>
          <goals>
            <goal>deploy</goal>
          </goals>
      </execution>
    </executions>
  </plugin>

then the block can simply be run as:
mvn package jetty:run

I am not particularly knowledgeable with that kind of Maven configurations, its just that its was like this a couple of weeks ago :)

Feedback are welcome as I plan write some "Getting started" documentation and would avoid writing wrong tips.

TIA,

Patrick


Then after
mvn package jetty:run

I could get testblock answer from localhost:8888/testblock/


Is this the right way to proceed for referencing blocks from a webapp ? I just discovered blockcontext: syntax lately.

see above


Reply via email to