You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Daniel Fagerstrom <da...@nada.kth.se> on 2006/11/11 17:24:55 UTC
Run Cocoon without deployer
It is now possible to use Cocoon without deployer and to use it in
Eclipse with e.g. the Jetty plugin.
To run Cocoon in Eclipse the shielded mode must, AFAICS, be turned of
(this is because we need the classpath provided by Eclipse with
dynamically build class files and resource and not the shielded one that
point to libraries that the deployer have provided during Maven build
time). This is done by removing the snippet in the webapp pom that calls
the Cocoon deployer.
There is a class DeployUtil that search the class loader for all
instances of COB-INF directories during the startup of Cocoon. The
DeployUtil create a map that associates block names to the URL of the
COB-INF directory in the block. For jar: URLs the block name is
extracted from the Cocoon-Block-Name property in the manifest file. For
a jar: URL the content of the COB-INF directory is unpacked at the temp
area of the webapp (allows for running unexpanded wars). And for file:
URLs the block name is extracted from the path (admittedly a hack).
Then the new BlockContextSource use this association list to get from
block name to sources.
blockcontext:/ - is resolved to a TraversableSource that make it
possible to list the blocks (see
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap
for an example).
blockcontext:/blockname/ - resolves to a file source that contain the
COB-INF directory of the block.
The block context source is not intended to use in sitemaps within
blocks as it exposes the block name. Within blocks the context source
should be used as usual. The block context source is intended for
setting the context URL in a block servlet configuration and for use in
a root sitemap for mounting other blocks. The later use should be
considered as bad practice when the blocks fw stabilizes as block
internal resources should be considered private ad only be exposed
through the block protocol.
/Daniel
Re: Run Cocoon without deployer
Posted by Alexander Klimetschek <al...@mindquarry.com>.
Looks like my webapp configuration does not fit with the new deploying
mechanism. I just copied the new cocoon.xconf in my WEB-INF/cocoon/ dir,
thinking that the source factory config was not loaded correctly, but
this did not help either.
So what else is needed to use the new configuration apart from having
META-INF/cocoon/(avalon|spring) directories in my block? Do I still need
to run the cocoon:deploy? What is the minimum requirement for my webapp
module that contains the src/main/webapp/WEB-INF directory with my own
web.xml?
Sorry if this was posted on this mailing list already, but I don't find
the right information in those long threads discussing the dir structure
etc. ;-)
Alex
Alexander Klimetschek schrieb:
> Reinhard Poetz schrieb:
>> Alexander Klimetschek wrote:
>>> Daniel Fagerstrom schrieb:
>>>> blockcontext:/blockname/ - resolves to a file source that contain
>>>> the COB-INF directory of the block.
>>>
>>> What is the blockname? I tried the name of the directory (like
>>> previously in /blocks/my-block/ => my-block), a name="my-block" in
>>> the bean and the id of the bean as blockname, but all did not work.
>>
>> have you tried the name set in the manifest?
>>
>
> I have debugged the problem and found that the blockcontext
> Sourcefactory cannot be looked up in the Avalon ServiceManager. I have a
> fresh new install of cocoon 2.2 trunk.
>
> Alex
>
--
Alexander Klimetschek
http://www.mindquarry.com
Re: Run Cocoon without deployer
Posted by Alexander Klimetschek <al...@mindquarry.com>.
Reinhard Poetz schrieb:
> Alexander Klimetschek wrote:
>> Daniel Fagerstrom schrieb:
>>> blockcontext:/blockname/ - resolves to a file source that contain the
>>> COB-INF directory of the block.
>>
>> What is the blockname? I tried the name of the directory (like
>> previously in /blocks/my-block/ => my-block), a name="my-block" in the
>> bean and the id of the bean as blockname, but all did not work.
>
> have you tried the name set in the manifest?
>
I have debugged the problem and found that the blockcontext
Sourcefactory cannot be looked up in the Avalon ServiceManager. I have a
fresh new install of cocoon 2.2 trunk.
Alex
--
Alexander Klimetschek
http://www.mindquarry.com
Re: Run Cocoon without deployer
Posted by Reinhard Poetz <re...@apache.org>.
Alexander Klimetschek wrote:
> Daniel Fagerstrom schrieb:
>> blockcontext:/blockname/ - resolves to a file source that contain the
>> COB-INF directory of the block.
>
> What is the blockname? I tried the name of the directory (like
> previously in /blocks/my-block/ => my-block), a name="my-block" in the
> bean and the id of the bean as blockname, but all did not work.
have you tried the name set in the manifest?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
Re: Run Cocoon without deployer
Posted by Alexander Klimetschek <al...@mindquarry.com>.
Yes, while debugging I found out that without setting the manifest entry
"Cocoon-Block-Name" is the name of the jar without the suffix ".jar", so
I got "my-block-0.0.1-SNAPSHOT".
Apart from that my webapp/WEB-INF directory now contains my specific
web.xml, the applicationContext.xml from cocoon-webapp and
cocoon/log4j.xconf.
Alex
Daniel Fagerstrom schrieb:
> Alexander Klimetschek skrev:
>> Daniel Fagerstrom schrieb:
>>> blockcontext:/blockname/ - resolves to a file source that contain the
>>> COB-INF directory of the block.
>>
>> What is the blockname? I tried the name of the directory (like
>> previously in /blocks/my-block/ => my-block), a name="my-block" in the
>> bean and the id of the bean as blockname, but all did not work.
>>
>> Alex
>>
> If the block is packaged as a jar at the classpath you need to set the
> manifest entry Cocoon-Block-Name to the block name, see e.g.
> http://svn.apache.org/repos/asf/cocoon/trunk/blocks/pom.xml. If the
> block is unpacked in the class path (using the file: protocol) it will
> use a part of the path as block name. This is done with a questionable
> hack in the o.a.c.core.deployment.DeployerUtil: the path part before
> "/target/classes/COB-INF" is used as the block name.
>
> /Daniel
>
>
--
Alexander Klimetschek
http://www.mindquarry.com
Re: Run Cocoon without deployer
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Alexander Klimetschek skrev:
> Daniel Fagerstrom schrieb:
>> blockcontext:/blockname/ - resolves to a file source that contain the
>> COB-INF directory of the block.
>
> What is the blockname? I tried the name of the directory (like
> previously in /blocks/my-block/ => my-block), a name="my-block" in the
> bean and the id of the bean as blockname, but all did not work.
>
> Alex
>
If the block is packaged as a jar at the classpath you need to set the
manifest entry Cocoon-Block-Name to the block name, see e.g.
http://svn.apache.org/repos/asf/cocoon/trunk/blocks/pom.xml. If the
block is unpacked in the class path (using the file: protocol) it will
use a part of the path as block name. This is done with a questionable
hack in the o.a.c.core.deployment.DeployerUtil: the path part before
"/target/classes/COB-INF" is used as the block name.
/Daniel
Re: Run Cocoon without deployer
Posted by Alexander Klimetschek <al...@mindquarry.com>.
Daniel Fagerstrom schrieb:
> blockcontext:/blockname/ - resolves to a file source that contain the
> COB-INF directory of the block.
What is the blockname? I tried the name of the directory (like
previously in /blocks/my-block/ => my-block), a name="my-block" in the
bean and the id of the bean as blockname, but all did not work.
Alex
--
Alexander Klimetschek
http://www.mindquarry.com