public class AVMUrlValve
extends org.apache.catalina.valves.ValveBase
implements org.apache.catalina.Lifecycle
RFCs regarding hostnames & fully qualified domain names (FQDN):
608, 810, 952, 1035, and 1123. The following PCRE-style
regex defines a valid label within a FQDN:
^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$
Less formally:
o Case insensitive
o First/last character: alphanumeric
o Interior characters: alphanumeric plus hyphen
o Minimum length: 2 characters
o Maximum length: 63 characters
The minimum 2-char length does not seem to be enforced by
nameservers/resovlers in the real world. For example, djbdns
uses nameserver names like: a.ns.example.com, b.ns.example.com, etc.
The FQDN (fully qualified domain name) is the following constraints:
o Maximum 255 characters (e.g.: www.foo.example.com)
o Must contain at least one alpha (i.e.: [a-z])
Thus, the following FQDN would be illegal because it contains
a hostname label that is too long (64 > 63):
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com
But the following FQDN would be ok because no host label is > 63 chars,
and the total length is less than 255 chars:
moo.cow.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com
Ultimately, I18N-encoded domain names will be supported via the IDNA
(Internationalizing Domain Names In Applications) standard.
IDNA encodes host labels that would normally contain I18N chars using
a "xn--" prefix. Apps present IDNA URLs in decoded form, but only
the "traditional" DNS characters ever go over the wire. For details,
see RFC-3490 (http://www.ietf.org/rfc/rfc3490.txt)
and RFC-3492 (http://www.ietf.org/rfc/rfc3492.txt).
The encoding scheme used for virtualization has been designed to
be IDNA-friendly; when GUI support becomes available, no changes
will be needed as far as the virtualization logic is concnered.
| Modifier and Type | Field and Description |
|---|---|
protected static ThreadLocal |
AVMUrlValve_invoked_ |
protected org.apache.catalina.util.LifecycleSupport |
lifecycle
Lifecycle event support.
|
protected static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
AVMUrlValve() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLifecycleListener(org.apache.catalina.LifecycleListener listener) |
org.apache.catalina.LifecycleListener[] |
findLifecycleListeners() |
static String |
GetContextNameFromStoreName(int version,
String storeName,
String webappName)
Transforms a version (e.g.: -1), a storeName (e.g.: "mysite--alice"),
and a webappName (e.g.: "ROOT") into a virtualized context name
(e.g.: "/$-1$mysite--alice$ROOT")
|
static String |
GetContextNameFromStorePath(int version,
String storePath)
Transforms a version (e.g.: -1), and a storePath
(e.g.: "mysite--alice:/www/avm_webapps/ROOT")
into a virtualized context name (e.g.: "/$-1$mysite--alice$ROOT").
|
void |
invoke(org.apache.catalina.connector.Request request,
org.apache.catalina.connector.Response response)
This method is called by Tomcat's pipeline mechanism on every new request.
|
void |
removeLifecycleListener(org.apache.catalina.LifecycleListener listener) |
void |
start() |
void |
stop() |
static String |
unMangleAVMuri(String uri)
Returns an un AVM-mangled version of uri.
|
backgroundProcess, createObjectName, getContainer, getContainerName, getController, getDomain, getInfo, getNext, getObjectName, getParentName, postDeregister, postRegister, preDeregister, preRegister, setContainer, setController, setNext, setObjectName, toStringprotected static org.apache.commons.logging.Log log
protected org.apache.catalina.util.LifecycleSupport lifecycle
protected static ThreadLocal AVMUrlValve_invoked_
public void addLifecycleListener(org.apache.catalina.LifecycleListener listener)
addLifecycleListener in interface org.apache.catalina.Lifecyclepublic org.apache.catalina.LifecycleListener[] findLifecycleListeners()
findLifecycleListeners in interface org.apache.catalina.Lifecyclepublic void removeLifecycleListener(org.apache.catalina.LifecycleListener listener)
removeLifecycleListener in interface org.apache.catalina.Lifecyclepublic void start()
throws org.apache.catalina.LifecycleException
start in interface org.apache.catalina.Lifecycleorg.apache.catalina.LifecycleExceptionpublic void stop()
throws org.apache.catalina.LifecycleException
stop in interface org.apache.catalina.Lifecycleorg.apache.catalina.LifecycleExceptionpublic static String GetContextNameFromStoreName(int version, String storeName, String webappName)
public static String GetContextNameFromStorePath(int version, String storePath)
public void invoke(org.apache.catalina.connector.Request request,
org.apache.catalina.connector.Response response)
throws IOException,
javax.servlet.ServletException
$TOMCAT_HOME/conf/server.xml
this valve is directly contained by the <Engine> node, thereby
enabling it to view every request to localhost prior to any other part
of the servlet engine. For example:
<Engine name="Catalina" defaultHost="localhost">
<Valve className="org.alfresco.catalina.valve.AVMUrlValve"/>
...
</Engine>
invoke in interface org.apache.catalina.Valveinvoke in class org.apache.catalina.valves.ValveBaserequest - The request, prior to the servlet engine seeing it.response - The reqponse, after the servlet engine is done with it.IOExceptionjavax.servlet.ServletExceptionpublic static String unMangleAVMuri(String uri)
Example of AVM-mangled subreq URI:
/$-1$store-1$servlets-examples/servlet/RequestInfoExample
After unmangling:
/servlets-examples/servlet/RequestInfoExample
If this were for a non-HEAD version (e.g.: '4'), the mangled
subrequest URI might look like this:
/$4$store-1$servlets-examples/servlet/RequestInfoExample
The URI would still contain the webapp name after unmangling:
/servlets-examples/servlet/RequestInfoExample
However, if this is the ROOT webapp, because the context path
is "", a mangle name like this:
/$-1$store-1$ROOT/servlet/RequestInfoExample
becomes:
/servlet/RequestInfoExample
Copyright © 2005–2014 Alfresco Software. All rights reserved.