org.hippoecm.hst.configuration.hosting
Class VirtualHostService

java.lang.Object
  extended by org.hippoecm.hst.configuration.hosting.VirtualHostService
All Implemented Interfaces:
MutableVirtualHost, VirtualHost

public class VirtualHostService
extends Object
implements MutableVirtualHost


Constructor Summary
VirtualHostService(VirtualHostService parent, String[] nameSegments, int position, String hostGroupName, String cmsLocation, Integer defaultPort, HstManagerImpl hstManager)
           
VirtualHostService(VirtualHostsService virtualHosts, HstNode virtualHostNode, VirtualHostService parentHost, String hostGroupName, String cmsLocation, int defaultPort, HstManagerImpl hstManager)
           
 
Method Summary
 void addPortMount(MutablePortMount portMount)
          Add the portMount to this MutableVirtualHost
 void addVirtualHost(MutableVirtualHost virtualHost)
          Adds the virtualHost as child to this MutableVirtualHost
 String getBaseURL(javax.servlet.http.HttpServletRequest request)
          Returns the base of the URL as seen by for example a browser.
 VirtualHost getChildHost(String name)
           
 List<VirtualHost> getChildHosts()
           
 String getCmsLocation()
           
 Integer getDefaultPort()
           
 String getHomePage()
           
 String getHostGroupName()
          Returns the name of host group this virtual host belongs to, for example 'prod', 'acct' or 'dev'
 String getHostName()
          The hostName of this VirtualHost.
 String getLocale()
          the locale for this VirtualHost or null when it does not contain one.
 String getName()
          Returns the name of this VirtualHost.
 String getPageNotFound()
           
 PortMount getPortMount(int portNumber)
           
 String getScheme()
           
 VirtualHosts getVirtualHosts()
           
 boolean isContextPathInUrl()
           
 boolean isPortInUrl()
           
 boolean isVersionInPreviewHeader()
           
 String onlyForContextPath()
          In case the HttpServletRequest.getContextPath() does not matter, this method returns null or empty.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualHostService

public VirtualHostService(VirtualHostsService virtualHosts,
                          HstNode virtualHostNode,
                          VirtualHostService parentHost,
                          String hostGroupName,
                          String cmsLocation,
                          int defaultPort,
                          HstManagerImpl hstManager)
                   throws ServiceException
Throws:
ServiceException

VirtualHostService

public VirtualHostService(VirtualHostService parent,
                          String[] nameSegments,
                          int position,
                          String hostGroupName,
                          String cmsLocation,
                          Integer defaultPort,
                          HstManagerImpl hstManager)
Method Detail

addVirtualHost

public void addVirtualHost(MutableVirtualHost virtualHost)
                    throws IllegalArgumentException
Description copied from interface: MutableVirtualHost
Adds the virtualHost as child to this MutableVirtualHost

Specified by:
addVirtualHost in interface MutableVirtualHost
Parameters:
virtualHost - the MutableVirtualHost to add
Throws:
IllegalArgumentException - if the virtualHost could not be added

addPortMount

public void addPortMount(MutablePortMount portMount)
                  throws IllegalArgumentException
Description copied from interface: MutableVirtualHost
Add the portMount to this MutableVirtualHost

Specified by:
addPortMount in interface MutableVirtualHost
Parameters:
portMount - the MutablePortMount to add
Throws:
IllegalArgumentException - if the portMount could not be added

getName

public String getName()
Description copied from interface: VirtualHost
Returns the name of this VirtualHost. Note, this is not the hostName, but only part of it. If the hostName is www.apache.org, then the name of this VirtualHost might be 'www' or 'apache' or 'org'. It is thus one segment of the entire hostName.

Specified by:
getName in interface VirtualHost
Returns:
The name of this VirtualHost. Note, this is only part of the entire hostName
See Also:
VirtualHost.getHostName()

getHostName

public String getHostName()
Description copied from interface: VirtualHost
The hostName of this VirtualHost. Note that this hostName might contain wildcards, for example www.onehippo.*

Specified by:
getHostName in interface VirtualHost
Returns:
The composite hostName of this VirtualHost, thus including parent VirtualHosts if present

getHostGroupName

public String getHostGroupName()
Description copied from interface: VirtualHost
Returns the name of host group this virtual host belongs to, for example 'prod', 'acct' or 'dev'

Specified by:
getHostGroupName in interface VirtualHost
Returns:
the name of the host group this VirtualHost belongs to.

isContextPathInUrl

public boolean isContextPathInUrl()
Specified by:
isContextPathInUrl in interface VirtualHost
Returns:
true when the created url should have the contextpath in it

onlyForContextPath

public String onlyForContextPath()
Description copied from interface: VirtualHost
In case the HttpServletRequest.getContextPath() does not matter, this method returns null or empty. If Mounts for this host can be used only for a certain contextPath, this method should return that contextPath. If configured, the contextPath is either an empty string, or it must start with a "/" and cannot contain any other "/".

Specified by:
onlyForContextPath in interface VirtualHost
Returns:
null or empty if the contextPath does not matter, otherwise the value the contextPath must have to match Mounts for this host.

isPortInUrl

public boolean isPortInUrl()
Specified by:
isPortInUrl in interface VirtualHost
Returns:
true when the created url should have the port in it

getScheme

public String getScheme()
Specified by:
getScheme in interface VirtualHost
Returns:
the scheme to use for creating external urls, for example http / https

getLocale

public String getLocale()
Description copied from interface: VirtualHost
the locale for this VirtualHost or null when it does not contain one. Note that if an ancestor VirtualHost contains a locale, this value is inherited unless this VirtualHost explicitly defines its own. The VirtualHost directly below the VirtualHosts inherits the value from the VirtualHosts

Specified by:
getLocale in interface VirtualHost
Returns:
the locale for this VirtualHost or null when it does not contain one.

getHomePage

public String getHomePage()
Specified by:
getHomePage in interface VirtualHost
Returns:
the homepage for this virtual host or null when not present

getPageNotFound

public String getPageNotFound()
Specified by:
getPageNotFound in interface VirtualHost
Returns:
the pagenotfound for this Mount or null when not present

isVersionInPreviewHeader

public boolean isVersionInPreviewHeader()
Specified by:
isVersionInPreviewHeader in interface VirtualHost
Returns:
whether the version of the HST is in the header of the preview

getCmsLocation

public String getCmsLocation()
Specified by:
getCmsLocation in interface MutableVirtualHost
Returns:
the cms location (fully qualified URL) or null if not configured

getDefaultPort

public Integer getDefaultPort()

getVirtualHosts

public VirtualHosts getVirtualHosts()
Specified by:
getVirtualHosts in interface VirtualHost
Returns:
the VirtualHosts container of this VirtualHost

getPortMount

public PortMount getPortMount(int portNumber)
Specified by:
getPortMount in interface VirtualHost
Returns:
the

getChildHost

public VirtualHost getChildHost(String name)
Specified by:
getChildHost in interface VirtualHost
Parameters:
name - the name segment of the hostname
Returns:
the child VirtualHost or null if none found

getBaseURL

public String getBaseURL(javax.servlet.http.HttpServletRequest request)
Description copied from interface: VirtualHost
Returns the base of the URL as seen by for example a browser. The base URL is consists of scheme + hostname + portnumber for example 'http://www.hippoecm.org:8081' The scheme is 'http' by default, unless getScheme() returns something else The hostname is the HttpServeltRequest request.getServerName() (proxies must have ProxyPreserveHost On) The portnumber is as follows:

Specified by:
getBaseURL in interface VirtualHost
Parameters:
request - the HttpServletRequest
Returns:
the URL until the context path, thus scheme + hostname + portnumber, for example 'http://www.hippoecm.org:8081'

getChildHosts

public List<VirtualHost> getChildHosts()
Specified by:
getChildHosts in interface VirtualHost
Returns:
the list of all VirtualHost childs of this VirtualHost

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2012 Hippo. All Rights Reserved.