You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Torsten Schlabach <ts...@apache.org> on 2005/11/28 18:25:58 UTC

[Concrete Thought] How to modify web.xml from a block properly?

Hi!

I hope I haven't overlooked this in the archives. But the thread that
sounded promising at first
(http://www.mail-archive.com/dev@cocoon.apache.org/msg35223.html) had
little to do with the info I was looking for.

I am trying to pick up the CHS petstore example (Cocoon, Hibernate,
Spring) from http://www.cocoondev.org/main/117/43.html with the latest
release of Cocoon (2.1.8), but I am having a hard time getting this to
work.

Following the comments on that CHS example page it turns out that one of
the problems is that this block needs to add a couple of entries to the
web.xml file, such as a context-parameter, a listener, a filter and a
filter-mapping.

Jetty applies a strict DTD to web.xml, therefore the order of elements
matters. (Other than Tomcat by default, were you can mix them in whatever
order you want.)

There is a mechanism described in the comments that uses tags hidden in
XML comments in Cocoons web.xml file in src/webapp/WEB-INF/web.xml as a
sort of anchors to direct XPatch to put the additional elements in the
rights positions in the final web.xml file.

Pretty creative approach, and it works fine. The only problem being that
other blocks (faces!) that also add stuff to web.xml don't use that
mechanism but just use absolut positioning of their additions (i.e. "put
that listener right in front"), thus leaving no change to but for example
and context-parameter elements before that listener.

The problem can be circumvented by disabling the faces block in my case,
but it leaves me with the question: Is that mechanism of using comments to
insert fragments into the right position in web.xml sort of the official
Cocoon way. Or is there no official way because that problem never showed
up so far?

If it is the official way, should I file a bug for the faces block?

I guess it will become more of an issue sooner or later.

Any thoughts?

Is there any way to teach XPath the DTD so it would find out itself where
an element belongs, for example?

Regards,
Torsten


Re: [Concrete Thought] How to modify web.xml from a block properly?

Posted by Torsten Schlabach <ts...@apache.org>.
 > IMO the "official" way should be the way that works. So if marker
comments are a way to solve the problem, let's make it the official way
and fix the faces config!
 >
 > Sylvain

Of course, anything that works is better than something broken.

But I felt that these anchor comments cannot be the proper way, so I did 
some research. We could use JAXB instead. WDYT? Would anyone consider this
an overkill? It would be very clean and very state of the art.

Regards,
Torsten

Sylvain Wallez schrieb:
> Torsten Schlabach wrote:
>
>> Hi!
>> I hope I haven't overlooked this in the archives. But the thread that
sounded promising at first
>> (http://www.mail-archive.com/dev@cocoon.apache.org/msg35223.html) had
little to do with the info I was looking for.
>> I am trying to pick up the CHS petstore example (Cocoon, Hibernate,
Spring) from http://www.cocoondev.org/main/117/43.html with the latest
release of Cocoon (2.1.8), but I am having a hard time getting this to
work.
>> Following the comments on that CHS example page it turns out that one
of
>> the problems is that this block needs to add a couple of entries to the
web.xml file, such as a context-parameter, a listener, a filter and a
filter-mapping.
>> Jetty applies a strict DTD to web.xml, therefore the order of elements
matters. (Other than Tomcat by default, were you can mix them in
whatever
>> order you want.)
>> There is a mechanism described in the comments that uses tags hidden in
XML comments in Cocoons web.xml file in src/webapp/WEB-INF/web.xml as a
sort of anchors to direct XPatch to put the additional elements in the
rights positions in the final web.xml file.
>> Pretty creative approach, and it works fine. The only problem being
that
>> other blocks (faces!) that also add stuff to web.xml don't use that
mechanism but just use absolut positioning of their additions (i.e.
"put
>> that listener right in front"), thus leaving no change to but for
example
>> and context-parameter elements before that listener.
>> The problem can be circumvented by disabling the faces block in my
case,
>> but it leaves me with the question: Is that mechanism of using 
comments to
>> insert fragments into the right position in web.xml sort of the
official
>> Cocoon way. Or is there no official way because that problem never
showed
>> up so far?
>> If it is the official way, should I file a bug for the faces block?
>>
>
>
> IMO the "official" way should be the way that works. So if marker 
comments are a way to solve the problem, let's make it the official way 
and fix the faces config!
>
> Sylvain
>





Re: [Concrete Thought] How to modify web.xml from a block properly?

Posted by Sylvain Wallez <sy...@apache.org>.
Torsten Schlabach wrote:
> Hi!
>
> I hope I haven't overlooked this in the archives. But the thread that
> sounded promising at first
> (http://www.mail-archive.com/dev@cocoon.apache.org/msg35223.html) had
> little to do with the info I was looking for.
>
> I am trying to pick up the CHS petstore example (Cocoon, Hibernate,
> Spring) from http://www.cocoondev.org/main/117/43.html with the latest
> release of Cocoon (2.1.8), but I am having a hard time getting this to
> work.
>
> Following the comments on that CHS example page it turns out that one of
> the problems is that this block needs to add a couple of entries to the
> web.xml file, such as a context-parameter, a listener, a filter and a
> filter-mapping.
>
> Jetty applies a strict DTD to web.xml, therefore the order of elements
> matters. (Other than Tomcat by default, were you can mix them in whatever
> order you want.)
>
> There is a mechanism described in the comments that uses tags hidden in
> XML comments in Cocoons web.xml file in src/webapp/WEB-INF/web.xml as a
> sort of anchors to direct XPatch to put the additional elements in the
> rights positions in the final web.xml file.
>
> Pretty creative approach, and it works fine. The only problem being that
> other blocks (faces!) that also add stuff to web.xml don't use that
> mechanism but just use absolut positioning of their additions (i.e. "put
> that listener right in front"), thus leaving no change to but for example
> and context-parameter elements before that listener.
>
> The problem can be circumvented by disabling the faces block in my case,
> but it leaves me with the question: Is that mechanism of using comments to
> insert fragments into the right position in web.xml sort of the official
> Cocoon way. Or is there no official way because that problem never showed
> up so far?
>
> If it is the official way, should I file a bug for the faces block?
>   

IMO the "official" way should be the way that works. So if marker 
comments are a way to solve the problem, let's make it the official way 
and fix the faces config!

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://bluxte.net                     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director