Hash (#) character as context delimiter '/' stand-in

View: New views
5 Messages — Rating Filter:   Alert me  

Hash (#) character as context delimiter '/' stand-in

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

I'm trying to use the foo#bar convention for a deployment path yielding
"/foo/bar" as my context path and everything seems to work as expected.

Except that I'm using Cocoon with one of my projects.

For Cocoon, everything is a URL. When Cocoon tries to build URLs to
point to, say, files on the disk in the deployment directory, it gets a
URL like "file:///home/path/to/tomcat/webapps/foo#bar/some/file" which
ends up trying to access "file:///home/path/to/tomcat/webapps/foo" which
is neither a file nor a directory.

:(

One obvious solution is to use a conf/Catalina/localhost/foo#bar.xml
file and deploy the webapp somewhere else. I'd honestly rather not do
that, but my only other option is to replace '/' in the URL with '-'
which I've already done because /something/ had to be done.

Any other suggestions?

Can anyone comment on the decision to use '#' as the stand-in for '/' in
the first place? Was it intentionally something that could not appear in
the path of a legit URL?

Are there any options for changing the '/' stand-in to, say, ':' or
something more URL-friendly? I suspect this would require a patch to the
Tomcat source.

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAkrxrqwACgkQ9CaO5/Lv0PA5LQCWNFarapxSaFfhGtLCkfJXLPtv
7gCgtorjbxQ6owFYx5UBxnH3nDMqmL8=
=cVEX
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Hash (#) character as context delimiter '/' stand-in

by Konstantin Kolinko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/4 Christopher Schultz <chris@...>:
>
> For Cocoon, everything is a URL. When Cocoon tries to build URLs to
> point to, say, files on the disk in the deployment directory, it gets a
> URL like "file:///home/path/to/tomcat/webapps/foo#bar/some/file" which
> ends up trying to access "file:///home/path/to/tomcat/webapps/foo" which
> is neither a file nor a directory.
>

That URL should have been written with %23 instead of '#'.

If I remember correctly (don't have an IDE running), you can make that
one by calling
 File.toURI().toURL().

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Hash (#) character as context delimiter '/' stand-in

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 11/4/2009 12:06 PM, Konstantin Kolinko wrote:

> 2009/11/4 Christopher Schultz <chris@...>:
>>
>> For Cocoon, everything is a URL. When Cocoon tries to build URLs to
>> point to, say, files on the disk in the deployment directory, it gets a
>> URL like "file:///home/path/to/tomcat/webapps/foo#bar/some/file" which
>> ends up trying to access "file:///home/path/to/tomcat/webapps/foo" which
>> is neither a file nor a directory.
>>
>
> That URL should have been written with %23 instead of '#'.

Yes, it should have been. The problem is that Cocoon does something
similar to the following to determine file paths (I can't confirm,
because there are 2900 classes in Cocoon and I have no idea where to start):

new URL(request.getRealPath(xsltFile))

and uses that for everything. :(

This is not a path that I have control over... it's not like I'm
setting-up a configuration file that contains # symbols and I should be
using %23 instead. Cocoon is, IMO, broken in this way because it does
not protect /itself/ from these paths.

See http://issues.apache.org/jira/browse/COCOON-2270 for more details.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrx0G8ACgkQ9CaO5/Lv0PDQbACgpuMEjYZl/+zf4Pc3bssZxN8r
Bt4AmwWvqFmza6sKCkbF5kfQ1HQ+ksBv
=uR4g
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Hash (#) character as context delimiter '/' stand-in

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Any ideas? I'm also still curious about the decision to use the # in the
first place. I read in a recent post that _ used to be the character of
choice. Was that changed for any particular reason?

- -chris

On 11/4/2009 11:41 AM, Christopher Schultz wrote:

> All,
>
> I'm trying to use the foo#bar convention for a deployment path yielding
> "/foo/bar" as my context path and everything seems to work as expected.
>
> Except that I'm using Cocoon with one of my projects.
>
> For Cocoon, everything is a URL. When Cocoon tries to build URLs to
> point to, say, files on the disk in the deployment directory, it gets a
> URL like "file:///home/path/to/tomcat/webapps/foo#bar/some/file" which
> ends up trying to access "file:///home/path/to/tomcat/webapps/foo" which
> is neither a file nor a directory.
>
> :(
>
> One obvious solution is to use a conf/Catalina/localhost/foo#bar.xml
> file and deploy the webapp somewhere else. I'd honestly rather not do
> that, but my only other option is to replace '/' in the URL with '-'
> which I've already done because /something/ had to be done.
>
> Any other suggestions?
>
> Can anyone comment on the decision to use '#' as the stand-in for '/' in
> the first place? Was it intentionally something that could not appear in
> the path of a legit URL?
>
> Are there any options for changing the '/' stand-in to, say, ':' or
> something more URL-friendly? I suspect this would require a patch to the
> Tomcat source.
>
> Thanks,
> -chris

- ---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkry9csACgkQ9CaO5/Lv0PC33wCeLx/vVxgf6hREh/wizB7c7kYd
8hgAnRLjRDHX5CQRGpcpaB7qOZnxbON0
=FwIU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Hash (#) character as context delimiter '/' stand-in

by markt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Schultz wrote:
> All,
>
> Any ideas? I'm also still curious about the decision to use the # in the
> first place. I read in a recent post that _ used to be the character of
> choice. Was that changed for any particular reason?

As far as I am aware, _ was never used for this.


>> Can anyone comment on the decision to use '#' as the stand-in for '/' in
>> the first place? Was it intentionally something that could not appear in
>> the path of a legit URL?

Exactly.

>> Are there any options for changing the '/' stand-in to, say, ':' or
>> something more URL-friendly? I suspect this would require a patch to the
>> Tomcat source.

No.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...