Modified DNS hostname mangling scheme, URL generator logic,

and automatic virtualization server registration so that
  now we virtualize on URLs like this:

     http://mysite.www--sandbox.ip.localdomain.lan:8180/
     http://alice.mysite.www--sandbox.ip.localdomain.lan:8180/
     http://preview.alice.mysite.www--sandbox.ip.localdomain.lan:8180/

  Or if you're using EchDNS at ip.alfrescodemo.net (the default):

     http://mysite.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/
     http://alice.mysite.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/
     http://preview.alice.mysite.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/

  The reasons behind this change have to do with:
  
    [1] Allowing wildcard cookies to be shared with subdomains, if desired.
        The scenario is that if you have an elaborate webapp that
        needs a cookie to function (or some auth), the user "alice"
        does not want to have to re-log in to the app just to get
        preview functions to work. 

    [2] Making the mangling scheme compatible with I18N-encoded URLs
        See:  IDNA  (Internationalizing Domain Names In Applications)
        RFCs: 3490,3492.   The problem with the old scheme was that
        relied on the string "--" as a delimiter within host labels,
        but IDNA uses "xn--" as a prefix to indicate that a label
        was I18N-encoded (and that the app should un-mangle in the
        presentation layer).  Ugh.

   The names of the stores was also rationalized to match the new URL 
   scheme.   The "." delimiting host lables becomes "--" in the
   repo's dir name, and the ordering of labels is reversed.

   Reasons:

    [1]  It's nicer to see project-first ordering in the 
         file system because it's more tab-complete friendly.
         It's also prettier visually with "ls -l" because
         logically related dirs line-up visually.

    [2]  It's dangerous to use "." as a character in directory names
         because a fully-patched version of IIS might refuse to
         serve content off such a path.  Weird, huh?
   
   It's too bad that the repo's dir name can't just be exactly
   the same as the fqdn (or a portion of it), but this reverse
   ordering ended up being the lesser of the available evils,
   because it optimizes the user's experience in each relm at 
   the expense of a small amont of URL <--> file system funkines.
   Note that they can't be the same in any case because of the
   "--" vs "." issue... so the "identity" mapping was already
   a lost cause.




git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4688 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jon Cox
2006-12-22 03:07:43 +00:00
parent 2190c4f29d
commit edfc87cc55
4 changed files with 106 additions and 25 deletions

View File

@@ -99,7 +99,7 @@ public final class AVMConstants
{
throw new IllegalArgumentException("Username is mandatory.");
}
return store + '-' + username + AVMConstants.STORE_MAIN;
return store + STORE_SEPARATOR + username + AVMConstants.STORE_MAIN;
}
public static String buildAVMUserPreviewStoreName(String store, String username)
@@ -112,7 +112,7 @@ public final class AVMConstants
{
throw new IllegalArgumentException("Username is mandatory.");
}
return store + '-' + username + AVMConstants.STORE_PREVIEW;
return store + STORE_SEPARATOR + username + AVMConstants.STORE_PREVIEW;
}
public static String buildAVMStoreRootPath(String store)
@@ -304,7 +304,7 @@ public final class AVMConstants
}
/**
* Returns the path portion up the webap
* Returns the path portion up the webapp
*
* @param absoluteAVMPath the path from which to extract the webapp path
*
@@ -400,17 +400,27 @@ public final class AVMConstants
}
}
// Component Separator.
private static final String STORE_SEPARATOR = "--";
// names of the stores representing the layers for an AVM website
public final static String STORE_STAGING = "-staging";
public final static String STORE_MAIN = "-main";
public final static String STORE_PREVIEW = "-preview";
public final static String STORE_STAGING = "";
public final static String STORE_MAIN = "";
public final static String STORE_PREVIEW = STORE_SEPARATOR + "preview";
// system directories at the top level of an AVM website
//
// TODO: The virtualization server should get these two parameters
// from the Alfresco webapp at registration time.
//
public final static String DIR_APPBASE = "appBase";
public final static String DIR_WEBAPPS = "avm_webapps";
// servlet implicit root directory
// servlet default webapp
// Note: this webapp is mapped to the URL path ""
//
public final static String DIR_ROOT = "ROOT";
// system property keys for sandbox identification and DNS virtualisation mapping
@@ -428,8 +438,8 @@ public final class AVMConstants
private static final String BEAN_VIRT_SERVER_REGISTRY = "VirtServerRegistry";
// URLs for preview of sandboxes and assets
private final static String PREVIEW_SANDBOX_URL = "http://www-{0}.{1}:{2}";
private final static String PREVIEW_ASSET_URL = "http://www-{0}.{1}:{2}{3}";
private final static String PREVIEW_SANDBOX_URL = "http://{0}.www--sandbox.{1}:{2}";
private final static String PREVIEW_ASSET_URL = "http://{0}.www--sandbox.{1}:{2}{3}";
// pattern for absolute AVM Path
private final static Pattern WEBAPP_RELATIVE_PATH_PATTERN =