You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Deacon Marcus <de...@wwtech.pl> on 2001/06/16 08:57:50 UTC
PATCH: Aliases again - this time tested and working, but...
Hi,
Unfortunately, the patch I submitted a few days ago for host aliases isn't
enough. Looks like <Alias/> tags are just ignored - they're supposed to be
handled in org.apache.catalina.startup.Catalina, which is uninteligible to
me (I use only JDOM for XML in my projects).
I made a quick fix, but it's using a dirty hack violating (or enhancing ;> )
current server.xml syntax. After applying this patch you can use syntax
like:
<host name="somewhere.com : www.somewhere.com , somewhere.net ,
www.somewhere.net" >
First name is hostname, the rest are aliases, allowed separators are ";" ":"
",", whitespace is ignored. I know it's quick and dirty, but it works and
looks stable - I need it before yesterday, and I'm sure I'm not the only
one.
Patch:
File: org.apache.catalina.core.StandardHost, line 325, method setName
=====
public void setName(String name) {
if (name == null)
throw new IllegalArgumentException
(sm.getString("standardHost.nullName"));
name = name.toLowerCase(); // Internally all names are lower case
// ***** patch start
java.util.StringTokenizer st = new java.util.StringTokenizer( name,
":;," );
name = st.nextToken().trim();
while( st.hasMoreTokens() )
{
addAlias( st.nextToken().trim() );
}
// ***** patch end
String oldName = this.name;
this.name = name;
support.firePropertyChange("name", oldName, this.name);
}
=====
Greetings,
deacon Marcus