You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/06/05 02:35:47 UTC

[Bug 53359] New: Request for or as element inside

https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

          Priority: P2
            Bug ID: 53359
          Assignee: dev@tomcat.apache.org
           Summary: Request for <Aliases> or <Alias> as element inside
                    <Context>
          Severity: enhancement
    Classification: Unclassified
          Reporter: esmond.pitt@bigpond.com
          Hardware: PC
            Status: NEW
           Version: 7.0.27
         Component: Catalina
           Product: Tomcat 7

I have a large and growing number of requirements for aliases, and the existing
(new for Tomcat 7) aliases= attribute is unwieldy for me. The line is already
289 characters long ;-(

It would be a lot more convenient if aliases could be specified individually
via a repeatable nested <Alias> entry, something like:

<Context>
<Alias aliasPath="/xyz" docBase="/real_path"/> ...
</Context>

as opposed to current:

<Context
    path="/cLabs"
    crossContext="true"
   
aliases="/EDSILabCatalog=c:/xampp/htdocs/cLabs/EDSILabCatalog,/EDSILabs=c:/xampp/htdocs/cLabs/EDSILabs,/Global=c:/xampp/htdocs/cLabs/Global,/Skyline=c:/xampp/htdocs/cLabs/Skyline,/Sun=c:/xampp/htdocs/cLabs/Sun,/Sunset=c:/xampp/htdocs/cLabs/Sunset,/Tech2000=c:/xampp/htdocs/cLabs/Tech2000"
    />

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #8 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to comment #6)
> That is the only place this gets processed but you'll need to do the same
> with the split("=") two lines as well for completeness.

I'm happy to do that, but didn't want the patch to grow bigger than the
original requirements. It makes perfect sense to me to trim whitespace around
the '='.

> A test case would be nice too as would an update to the docs on hoe white
> space will be handled :)

Of course. I mainly wanted to verify that this was the only place a functional
change needed to be made.

(In reply to comment #7)
> I think you should also beware of empty strings (produced by ',,' or by an
> extra ',' at the end of values) and ignore them.

Noted.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #9 from Christopher Schultz <ch...@christopherschultz.net> ---
Looks like I can't avoid using String.trim() anyway, so I'm just going to use
that instead of modifying the regex.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
I'd rather avoid adding that option since it adds complexity to the code I'd
rather not have. What if we ensured that white-space was trimmed so you could
use something like:
aliases="/pathA=C:/pathA,
         /pathB=C:/some/other/path,
         /special=C:/here/be/dragons"

Thoughts?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #4 from Esmond Pitt <es...@bigpond.com> ---
In that case Mark Thomas's solution is perfect. I would have thought you needed
to trim the whitespace anyway, to allow spaces after the commas as per many
programming habits ;-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #11 from Christopher Schultz <ch...@christopherschultz.net> ---
Replacement is bug 53373.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #7 from Konstantin Kolinko <kn...@gmail.com> ---
I think you should also beware of empty strings (produced by ',,' or by an
extra ',' at the end of values) and ignore them.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #10 from Christopher Schultz <ch...@christopherschultz.net> ---
Okay, I'm going to close this as WONTFIX and create a new bug for trimming
whitespace. I'm doing this so that this bug can be REOPENED in the future if
there is sufficient demand for <Alias> subelements within <Context>.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #6 from Mark Thomas <ma...@apache.org> ---
That is the only place this gets processed but you'll need to do the same with
the split("=") two lines as well for completeness.

A test case would be nice too as would an update to the docs on hoe white space
will be handled :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #5 from Christopher Schultz <ch...@christopherschultz.net> ---
I'm prepared to make this fix, but I want to be sure I can do it all in one
place. Mark, could you comment?

It looks like BaseDirContext.java:237 could just change from

        String[] kvps = theAliases.split(",");

to

        String[] kvps = theAliases.split("\\s*,\\s*");

I've read-through the rest of the code and it appears that this is all that is
required, but there may be other places where similar splits are happening.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
There is no prohibition of any kind of whitespace (except maybe form-feed?) in
an attribute value. You only need to escape the standard < and > plus "
characters.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53359] Request for or as element inside

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53359

--- Comment #2 from Esmond Pitt <es...@bigpond.com> ---
That's OK by me but is it legal XML?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org