info.magnolia.init
Class DefaultMagnoliaInitPaths

java.lang.Object
  extended by info.magnolia.init.DefaultMagnoliaInitPaths
All Implemented Interfaces:
MagnoliaInitPaths

@Singleton
public class DefaultMagnoliaInitPaths
extends Object
implements MagnoliaInitPaths

A simple wrapper about the few initial variables used to resolve PropertySource.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Field Summary
protected static String MAGNOLIA_UNQUALIFIED_SERVER_NAME
          Context parameter name.
 
Constructor Summary
DefaultMagnoliaInitPaths(MagnoliaServletContextListener magnoliaServletContextListener, javax.servlet.ServletContext servletContext)
           
 
Method Summary
protected  String determineContextPath(javax.servlet.ServletContext context)
           
protected  String determineRootPath(javax.servlet.ServletContext context)
          Figures out the root path where the webapp is deployed.
protected  String determineServerName(javax.servlet.ServletContext context)
          Figures out the local host name, makes sure it's lowercase, and use its unqualified name if the "magnolia.unqualified.server.name" init parameter is set to true.
protected  String determineWebappFolderName(String determinedRootPath, javax.servlet.ServletContext context)
           
 String getContextPath()
           
 String getRootPath()
           
 String getServerName()
          The server name is resolved to the full name obtained by using InetAddress.getLocalHost().getHostName(), which may also contain the server domain, depending on your server configuration/operating system.
 String getWebappFolderName()
          Returns the last token in the webapp path (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGNOLIA_UNQUALIFIED_SERVER_NAME

protected static final String MAGNOLIA_UNQUALIFIED_SERVER_NAME
Context parameter name. If set to true in web.xml the server name resolved by magnolia will never contain the domain (the server "server.domain.com" will be simply resolved as "server").

See Also:
Constant Field Values
Constructor Detail

DefaultMagnoliaInitPaths

@Inject
public DefaultMagnoliaInitPaths(MagnoliaServletContextListener magnoliaServletContextListener,
                                       javax.servlet.ServletContext servletContext)
Method Detail

determineServerName

protected String determineServerName(javax.servlet.ServletContext context)
Figures out the local host name, makes sure it's lowercase, and use its unqualified name if the "magnolia.unqualified.server.name" init parameter is set to true.


determineRootPath

protected String determineRootPath(javax.servlet.ServletContext context)
Figures out the root path where the webapp is deployed.


determineWebappFolderName

protected String determineWebappFolderName(String determinedRootPath,
                                           javax.servlet.ServletContext context)

determineContextPath

protected String determineContextPath(javax.servlet.ServletContext context)

getServerName

public String getServerName()
The server name is resolved to the full name obtained by using InetAddress.getLocalHost().getHostName(), which may also contain the server domain, depending on your server configuration/operating system. You can set the optional context parameter "magnolia.unqualified.server.name" to true if you prefer using the unqualified name (the server "server.domain.com" will be simply resolved as "server").
 <context-param>
   <param-name>magnolia.unqualified.server.name</param-name>
   <param-value>true</param-value>
 </context-param>
 

Specified by:
getServerName in interface MagnoliaInitPaths

getRootPath

public String getRootPath()
Specified by:
getRootPath in interface MagnoliaInitPaths

getWebappFolderName

public String getWebappFolderName()
Description copied from interface: MagnoliaInitPaths
Returns the last token in the webapp path (e.g. magnoliaPublic for a webapp deployed at tomcat/webapps/magnoliaPublic).

Specified by:
getWebappFolderName in interface MagnoliaInitPaths

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface MagnoliaInitPaths


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.