cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Lorenz" <jens.lor...@interface-business.de>
Subject Re: Suggestion for src/org/apache/cocoon/processor/xsp/xsp-java.xsl (v1.17)
Date Thu, 17 Aug 2000 16:15:47 GMT
"Robin Green" <greenrd@hotmail.com> wrote:


> >There were classes with the same names but different packages ... This
> >seems to confuse the java compiler while importing
> >with <package-name>.* ...
>
> Well it would do, wouldn't it?

Of course ... But I didn't thought of import statements of Cocoon
itself ... And it took a long time through Cocoon internals
until I discovered the problem ... (and quite an amount of time
until I searched in Cocoon internals)

> There are two ways to disambiguate. First, put the class you want as a
> fully-qualified <xsp:include>, not using ".*". Alternatively, use
> fully-qualified class names directly in your own code. I prefer the
former -
> it involves less typing.

Well. There are lot's of classes in this package. Both ways are too much
for an ordinary lazy coder ...

> >Because the a fairly big amount of my own source won't use any DOM
> >classes or other Cocoon related classes I rewrote the file
> >src/org/apache/cocoon/processor/xsp/xsp-java.xsl to only use import
> >statements without an * and only full qualified class names ... This
> >way I don't have to bother with Cocoon internals and I am able to
> >develop the java code in the XSP pages straight forward ...
>
> I'm afraid this cannot be changed in the official Cocoon distribution in
the
> way you suggest. It would break existing users' code (such as my code, for
> example) which relies on the .* imports.

That's what I too discovered in the meantime (while using the provided
tag lib util)... I reincluded all the * imports but the other code still
has only full qualified class names ... This way it doesn't interfere
with my own imports while (hopefully) not breaking any other code ...

It also has the advantage that I don't have to bother about Cocoons own
* imports while still using them when needed. The java code of the
current xsp-java.xsl can be easily broken by a single user * import ...
(I had the effect that an XSP page with only an xsp:include statement
wouldn't compile)

> There is no need, anyway - as I said, you can just disambiguate your own
> code, without touching xsp-java.xsl.

I will use some kind of sed script to convert on my code just before
putting it into the location specified in the cocoon.properties ...
I'm much to lazy to put the whole package name (which can be very
long with some packages) in front of every class (and will I use the
oracle.ifs.beans.Document class heavily) ...

The current diff follows ... As said it's the same as the last one
except that I've reincluded all the standard * imports ... Every
class name is still full qualified. (I don't know if this is a
problem for other java compilers than Sun's javac and jikes - it
should not) ...


92c92
<     public class <xsl:value-of select="@name"/> extends XSPPage {
---
>     public class <xsl:value-of select="@name"/> extends
org.apache.cocoon.processor.xsp.XSPPage {
97,99c97,99
<         HttpServletRequest request,
<         HttpServletResponse response,
<         Document document
---
>         javax.servlet.http.HttpServletRequest request,
>         javax.servlet.http.HttpServletResponse response,
>         org.w3c.dom.Document document
101c101
<         throws Exception
---
>         throws java.lang.Exception
104,106c104,106
<         Node xspParentNode = null;
<         Node xspCurrentNode = document;
<         Stack xspNodeStack = new Stack();
---
>         org.w3c.dom.Node xspParentNode = null;
>         org.w3c.dom.Node xspCurrentNode = document;
>         java.util.Stack xspNodeStack = new java.util.Stack();
116c116
<         HttpSession session = request.getSession(<xsl:value-of
select="$create-session"/>);
---
>         javax.servlet.http.HttpSession session =
request.getSession(<xsl:value-of select="$create-session"/>);
143,144c143,144
<     ((Element) xspCurrentNode).normalize();
<     xspCurrentNode = (Node) xspNodeStack.pop();
---
>     ((org.w3c.dom.Element) xspCurrentNode).normalize();
>     xspCurrentNode = (org.w3c.dom.Node) xspNodeStack.pop();
148c148
<     ((Element) xspCurrentNode).setAttribute(
---
>     ((org.w3c.dom.Element) xspCurrentNode).setAttribute(
231,232c231,232
<     ((Element) xspCurrentNode).normalize();
<     xspCurrentNode = (Node) xspNodeStack.pop();
---
>     ((org.w3c.dom.Element) xspCurrentNode).normalize();
>     xspCurrentNode = (org.w3c.dom.Node) xspNodeStack.pop();
243c243
<     ((Element) xspCurrentNode).setAttribute(
---
>     ((org.w3c.dom.Element) xspCurrentNode).setAttribute(
264,267c264,267
<     Node xspParentNode = null;
<     Node xspCurrentNode = <xsl:value-of select="@node-argument"/>;
<     Stack xspNodeStack = new Stack();
<     Document document = <xsl:value-of
select="@node-argument"/>.getOwnerDocument();
---
>     org.w3c.dom.Node xspParentNode = null;
>     org.w3c.dom.Node xspCurrentNode = <xsl:value-of
select="@node-argument"/>;
>     Stack xspNodeStack = new java.util.Stack();
>     org.w3c.dom.Document document = <xsl:value-of
select="@node-argument"/>.getOwnerDocument();



Best Regards,

Jens Lorenz



Mime
View raw message