You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Matthias D. Herold" <mh...@javisto.com> on 2001/03/01 09:59:11 UTC
[C2] XSP / keywords in directory names
Hello,
I just downloaded C2 and tried to write some XSP-Pages. It works fine, except
when I want to load an XSP-file that is in a directory with the name of a java
keyword (for example: 'static/index.xsp').
DEBUG 16895 [cocoon ] (Thread-10): Language Exception
org.apache.cocoon.components.language.LanguageException: Error compiling index_xsp:
Line 0, column 0: C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:3: Identifier expected.
package org.apache.cocoon.static;
^
Line 0, column 0: C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:59: Superclass XSPGenerator of class index_xsp not found.
public class index_xsp extends XSPGenerator {
^
Tested on Win2000 / Sun JDK 1.3; latest Cocoon2-CVS.
Regards,
Matthias
Re: [C2] XSP / keywords in directory names
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 5 Mar 2001, Tagunov Anthony wrote:
> >On Fri, 2 Mar 2001, Davanum Srinivas wrote:
> >
> >> Checked in code which adds a $ suffix to the package elements if the package elements are java
> >> keywords.
> >>
> >> For example,
> >> com.mycom.www.static.volatile
> >> Will be turned into,
> >> com.mycom.www.static$.volatile$
> >
> >that's going to make life just a _tad_ difficult for people in UNIX
> >environments who want to poke around in their repositories - $ is a
> >special character to most shells and needs to be escaped if it occurs in a
> >path - a real pain for /bin/sh users. suggest using an underscore instead.
>
> Well, I would certanly expect problems, but surprisingly instead on my Linux RH 6.2 with
> bash I can easily create folders named aaa$, aaa$/bbb and ls 'em..
> So maybe it okay?
bash is particularly nice in handling special characters, especially if
you use path autocompletion. but there are many other shells people like
to use that aren't so friendly. it's not a huge deal, i'm not going to
poke around and figure out where to do it, but if it's just a one
character change and dims is willing to spend a moment doing it, more
power to him.
- donald
Re: [C2] XSP / keywords in directory names
Posted by Tagunov Anthony <at...@nnt.ru>.
On Fri, 2 Mar 2001 16:53:13 -0500 (EST), Donald Ball wrote:
>On Fri, 2 Mar 2001, Davanum Srinivas wrote:
>
>> Checked in code which adds a $ suffix to the package elements if the package elements are java
>> keywords.
>>
>> For example,
>> com.mycom.www.static.volatile
>> Will be turned into,
>> com.mycom.www.static$.volatile$
>
>that's going to make life just a _tad_ difficult for people in UNIX
>environments who want to poke around in their repositories - $ is a
>special character to most shells and needs to be escaped if it occurs in a
>path - a real pain for /bin/sh users. suggest using an underscore instead.
Well, I would certanly expect problems, but surprisingly instead on my Linux RH 6.2 with
bash I can easily create folders named aaa$, aaa$/bbb and ls 'em..
So maybe it okay?
Re: [C2] XSP / keywords in directory names
Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 2 Mar 2001, Davanum Srinivas wrote:
> Checked in code which adds a $ suffix to the package elements if the package elements are java
> keywords.
>
> For example,
> com.mycom.www.static.volatile
> Will be turned into,
> com.mycom.www.static$.volatile$
that's going to make life just a _tad_ difficult for people in UNIX
environments who want to poke around in their repositories - $ is a
special character to most shells and needs to be escaped if it occurs in a
path - a real pain for /bin/sh users. suggest using an underscore instead.
- donald
Re: [C2] XSP / keywords in directory names
Posted by Davanum Srinivas <di...@yahoo.com>.
Checked in code which adds a $ suffix to the package elements if the package elements are java
keywords.
For example,
com.mycom.www.static.volatile
Will be turned into,
com.mycom.www.static$.volatile$
Thanks,
dims
--- Sylvain Wallez <sy...@anyware-tech.com> wrote:
>
>
> Berin Loritsch a �crit :
> >
> > "Matthias D. Herold" wrote:
> > >
> > > "Berin Loritsch" wrote:
> > > >
> > > > "Matthias D. Herold" wrote:
> > > > >
> > > > > Hello Davanum,
> > > > >
> > > > > if I rename the directory, it works. But I think it should also work
> > > > > with java keywords as directory name...
> > > > >
> > > > > IMO there should be a better method for mapping directories to package names
> > > > > (for example just adding underscores to the beginning and the end of each
> > > > > package name would be fine: directory /static maps to org.apache.cocoon._static_).
> > > > >
> > > > > I am currently not familiar enough with the code to be able to fix such things;
> > > > > so I'll just send bug reports ;-)
> > > >
> > > > If you actually had an extension on your file name, it would work as well:
> > > > org.apache.cocoon.static_xmap
> > >
> > > There is an extension on the file name; the file is named 'index.jsp' and put
> > > in a directory named 'static': 'static/index.xsp'.
> >
> > Ah. so the class is:
> >
> > com.mycom.www.static.index_xsp (or equiv.).
> >
> > That makes sense that your having this problem. It's too much work to check for
> > keywords in the path, and I want the clean com.mycom.www prefix to work. Another
> > solution would be that ALL generated classes have the same prefix, but no subdirectories:
> >
> > com.mycom.www.static_index_xsp
> >
> > Or preferably, remove the underscore and capitalize the first char of each word:
> >
> > com.mycom.www.StaticIndexXsp
> >
> > The problem with that is we might reach a limit on the character length of the class
> > name.
> >
> > Truthfully, the most scalable approach is still prefixing or postfixing a character
> > to the directory name. We already mangle the name to remove periods and dashes, but
> > who said we have to use an underscore?
> >
> > com.mycom.www.c_static.c_volatile.c_index_xsp
> >
> > The thing is the prefixing with an underscore according to some C/C++ coding practices
> > is indicative of a compiler or system constant that you can't rely on to be useable.
> > That is my beef with the underscore thing.
> >
>
> In Java, the '$' character is used for this purpose. This is specified
> by the JLS at
> http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
>
> The compiler uses it e.g. for generated identifiers when you reference a
> Class object (writing "org.apache.Foo.class" produces a
> "class$org$apache$Foo" attribute in the class file).
>
> So there's nothing against the use of the '_' prefix but the C/C++
> history and IMO it's important that java keywords do not impact the
> naming of directories in the web site !
>
> My .02 euro.
>
> --
> Sylvain Wallez
> Anyware Technologies
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
Re: [C2] XSP / keywords in directory names
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Berin Loritsch a écrit :
>
> "Matthias D. Herold" wrote:
> >
> > "Berin Loritsch" wrote:
> > >
> > > "Matthias D. Herold" wrote:
> > > >
> > > > Hello Davanum,
> > > >
> > > > if I rename the directory, it works. But I think it should also work
> > > > with java keywords as directory name...
> > > >
> > > > IMO there should be a better method for mapping directories to package names
> > > > (for example just adding underscores to the beginning and the end of each
> > > > package name would be fine: directory /static maps to org.apache.cocoon._static_).
> > > >
> > > > I am currently not familiar enough with the code to be able to fix such things;
> > > > so I'll just send bug reports ;-)
> > >
> > > If you actually had an extension on your file name, it would work as well:
> > > org.apache.cocoon.static_xmap
> >
> > There is an extension on the file name; the file is named 'index.jsp' and put
> > in a directory named 'static': 'static/index.xsp'.
>
> Ah. so the class is:
>
> com.mycom.www.static.index_xsp (or equiv.).
>
> That makes sense that your having this problem. It's too much work to check for
> keywords in the path, and I want the clean com.mycom.www prefix to work. Another
> solution would be that ALL generated classes have the same prefix, but no subdirectories:
>
> com.mycom.www.static_index_xsp
>
> Or preferably, remove the underscore and capitalize the first char of each word:
>
> com.mycom.www.StaticIndexXsp
>
> The problem with that is we might reach a limit on the character length of the class
> name.
>
> Truthfully, the most scalable approach is still prefixing or postfixing a character
> to the directory name. We already mangle the name to remove periods and dashes, but
> who said we have to use an underscore?
>
> com.mycom.www.c_static.c_volatile.c_index_xsp
>
> The thing is the prefixing with an underscore according to some C/C++ coding practices
> is indicative of a compiler or system constant that you can't rely on to be useable.
> That is my beef with the underscore thing.
>
In Java, the '$' character is used for this purpose. This is specified
by the JLS at
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
The compiler uses it e.g. for generated identifiers when you reference a
Class object (writing "org.apache.Foo.class" produces a
"class$org$apache$Foo" attribute in the class file).
So there's nothing against the use of the '_' prefix but the C/C++
history and IMO it's important that java keywords do not impact the
naming of directories in the web site !
My .02 euro.
--
Sylvain Wallez
Anyware Technologies
Re: [C2] XSP / keywords in directory names
Posted by Berin Loritsch <bl...@apache.org>.
"Matthias D. Herold" wrote:
>
> "Berin Loritsch" wrote:
> >
> > "Matthias D. Herold" wrote:
> > >
> > > Hello Davanum,
> > >
> > > if I rename the directory, it works. But I think it should also work
> > > with java keywords as directory name...
> > >
> > > IMO there should be a better method for mapping directories to package names
> > > (for example just adding underscores to the beginning and the end of each
> > > package name would be fine: directory /static maps to org.apache.cocoon._static_).
> > >
> > > I am currently not familiar enough with the code to be able to fix such things;
> > > so I'll just send bug reports ;-)
> >
> > If you actually had an extension on your file name, it would work as well:
> > org.apache.cocoon.static_xmap
>
> There is an extension on the file name; the file is named 'index.jsp' and put
> in a directory named 'static': 'static/index.xsp'.
Ah. so the class is:
com.mycom.www.static.index_xsp (or equiv.).
That makes sense that your having this problem. It's too much work to check for
keywords in the path, and I want the clean com.mycom.www prefix to work. Another
solution would be that ALL generated classes have the same prefix, but no subdirectories:
com.mycom.www.static_index_xsp
Or preferably, remove the underscore and capitalize the first char of each word:
com.mycom.www.StaticIndexXsp
The problem with that is we might reach a limit on the character length of the class
name.
Truthfully, the most scalable approach is still prefixing or postfixing a character
to the directory name. We already mangle the name to remove periods and dashes, but
who said we have to use an underscore?
com.mycom.www.c_static.c_volatile.c_index_xsp
The thing is the prefixing with an underscore according to some C/C++ coding practices
is indicative of a compiler or system constant that you can't rely on to be useable.
That is my beef with the underscore thing.
Re: [C2] XSP / keywords in directory names
Posted by "Matthias D. Herold" <mh...@javisto.com>.
"Berin Loritsch" wrote:
>
> "Matthias D. Herold" wrote:
> >
> > Hello Davanum,
> >
> > if I rename the directory, it works. But I think it should also work
> > with java keywords as directory name...
> >
> > IMO there should be a better method for mapping directories to package names
> > (for example just adding underscores to the beginning and the end of each
> > package name would be fine: directory /static maps to org.apache.cocoon._static_).
> >
> > I am currently not familiar enough with the code to be able to fix such things;
> > so I'll just send bug reports ;-)
>
> If you actually had an extension on your file name, it would work as well:
> org.apache.cocoon.static_xmap
There is an extension on the file name; the file is named 'index.jsp' and put
in a directory named 'static': 'static/index.xsp'.
> Personally, I don't like seeing tons of extra underscores. It reminds me of some
> really old C code. However, we can add them in.
The underscores were just my first idea to solve the problem; there
might be other or cleaner solutions, of course.
I think it would be great for an easy use of Cocoon that all
directory names the OS permits, can be used with Cocoon.
Matthias
Re: [C2] XSP / keywords in directory names
Posted by Berin Loritsch <bl...@apache.org>.
"Matthias D. Herold" wrote:
>
> Hello Davanum,
>
> if I rename the directory, it works. But I think it should also work
> with java keywords as directory name...
>
> IMO there should be a better method for mapping directories to package names
> (for example just adding underscores to the beginning and the end of each
> package name would be fine: directory /static maps to org.apache.cocoon._static_).
>
> I am currently not familiar enough with the code to be able to fix such things;
> so I'll just send bug reports ;-)
If you actually had an extension on your file name, it would work as well:
org.apache.cocoon.static_xmap
Personally, I don't like seeing tons of extra underscores. It reminds me of some
really old C code. However, we can add them in.
Re: [C2] XSP / keywords in directory names
Posted by "Matthias D. Herold" <mh...@javisto.com>.
Hello Davanum,
if I rename the directory, it works. But I think it should also work
with java keywords as directory name...
IMO there should be a better method for mapping directories to package names
(for example just adding underscores to the beginning and the end of each
package name would be fine: directory /static maps to org.apache.cocoon._static_).
I am currently not familiar enough with the code to be able to fix such things;
so I'll just send bug reports ;-)
Regards,
Matt
----- Original Message -----
From: "Davanum Srinivas" <di...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Thursday, March 01, 2001 12:14 PM
Subject: Re: [C2] XSP / keywords in directory names
> Matthias,
>
> As far as i know "static" is a java keyword and hence should not be in the package name. So please
> rename the directory and try again.
>
> Thanks,
> dims
>
> --- "Matthias D. Herold" <mh...@javisto.com> wrote:
> > Hello,
> >
> > I just downloaded C2 and tried to write some XSP-Pages. It works fine, except
> > when I want to load an XSP-file that is in a directory with the name of a java
> > keyword (for example: 'static/index.xsp').
> >
> > DEBUG 16895 [cocoon ] (Thread-10): Language Exception
> > org.apache.cocoon.components.language.LanguageException: Error compiling index_xsp:
> > Line 0, column 0:
> > C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:3:
> > Identifier expected.
> > package org.apache.cocoon.static;
> > ^
> > Line 0, column 0:
> > C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:59:
> > Superclass XSPGenerator of class index_xsp not found.
> > public class index_xsp extends XSPGenerator {
> > ^
> >
> > Tested on Win2000 / Sun JDK 1.3; latest Cocoon2-CVS.
> >
> >
> > Regards,
> >
> > Matthias
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
>
>
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
Re: [C2] XSP / keywords in directory names
Posted by Davanum Srinivas <di...@yahoo.com>.
Matthias,
As far as i know "static" is a java keyword and hence should not be in the package name. So please
rename the directory and try again.
Thanks,
dims
--- "Matthias D. Herold" <mh...@javisto.com> wrote:
> Hello,
>
> I just downloaded C2 and tried to write some XSP-Pages. It works fine, except
> when I want to load an XSP-file that is in a directory with the name of a java
> keyword (for example: 'static/index.xsp').
>
> DEBUG 16895 [cocoon ] (Thread-10): Language Exception
> org.apache.cocoon.components.language.LanguageException: Error compiling index_xsp:
> Line 0, column 0:
> C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:3:
> Identifier expected.
> package org.apache.cocoon.static;
> ^
> Line 0, column 0:
> C:\old_prog\tomcat\work\localhost_8080%2Fstatic\org\apache\cocoon\static\index_xsp.java:59:
> Superclass XSPGenerator of class index_xsp not found.
> public class index_xsp extends XSPGenerator {
> ^
>
> Tested on Win2000 / Sun JDK 1.3; latest Cocoon2-CVS.
>
>
> Regards,
>
> Matthias
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/