fr.paris.lutece.portal.service.util
Class AppPathService

java.lang.Object
  extended by fr.paris.lutece.portal.service.util.AppPathService

public final class AppPathService
extends java.lang.Object

this class provides services for locate repository or url


Field Summary
static java.lang.String SESSION_BASE_URL
           
 
Method Summary
static UrlItem buildRedirectUrlItem(java.lang.String strRootUrl, java.lang.String strUrlPropertySuffixKey)
          Build the url item to use for a url that includes the redirection parameter for reconnection.
static java.lang.String getAbsolutePathFromRelativePath(java.lang.String strDirectory)
          Returns the absolute path of a repository from a relative path
static java.lang.String getAdminMenuUrl()
          Returns the admin menu page relative url (jsp/admin/site/AdminMenu.jsp) defined in lutece.properties
static java.lang.String getAdminPortalUrl()
          Returns the admin portal page relative url (jsp/admin/site/AdminSite.jsp) defined in lutece.properties
static ReferenceList getAvailableVirtualHosts()
          Gets available virtual hosts defined in the config.properties
static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
          Return the url of the webapp, built from rhe request
static java.lang.String getPath(java.lang.String strKey)
          Returns the absolute path of a repository from a relative definition in properties file
static java.lang.String getPath(java.lang.String strKey, java.lang.String strFilename)
          Returns the absolute path of file from its relative definition in properties file.
static java.lang.String getPortalUrl()
          Returns the portal page relative url (jsp/site/Portal.jsp) defined in lutece.properties
static java.io.FileInputStream getResourceAsStream(java.lang.String strPath, java.lang.String strFilename)
          Gets a file as stream
static java.lang.String getSiteMessageUrl(javax.servlet.http.HttpServletRequest request)
          Return the url of the webapp, built from the request
static java.lang.String getVirtualHostKey(javax.servlet.http.HttpServletRequest request)
          Gets a Virtual Host Key if the request contains a virtual host key
static java.lang.String getWebAppPath()
          Returns the webapp path from the properties file
static void init(javax.servlet.ServletContext context)
          Initialize The path service
static void init(java.lang.String strWebAppPath)
          Initialize The webapppath
static UrlItem resolveRedirectUrl(javax.servlet.http.HttpServletRequest request, java.lang.String strDefaultRedirectUrl)
          Retrieve the url to redirect to after login.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_BASE_URL

public static final java.lang.String SESSION_BASE_URL
See Also:
Constant Field Values
Method Detail

init

public static void init(javax.servlet.ServletContext context)
Initialize The path service

Parameters:
context - The servlet context

init

public static void init(java.lang.String strWebAppPath)
Initialize The webapppath

Parameters:
strWebAppPath - The Webapp path

getPath

public static java.lang.String getPath(java.lang.String strKey)
Returns the absolute path of a repository from a relative definition in properties file

Parameters:
strKey - the repository key definied in properties file
Returns:
the repository absolute path

getWebAppPath

public static java.lang.String getWebAppPath()
Returns the webapp path from the properties file

Returns:
the webapp path

getPath

public static java.lang.String getPath(java.lang.String strKey,
                                       java.lang.String strFilename)
Returns the absolute path of file from its relative definition in properties file.

Parameters:
strKey - the repository key defined in properties file
strFilename - The name of file
Returns:
the absolute path of file

getResourceAsStream

public static java.io.FileInputStream getResourceAsStream(java.lang.String strPath,
                                                          java.lang.String strFilename)
Gets a file as stream

Parameters:
strPath - the path
strFilename - The name of file
Returns:
a FileInput Stream object

getAbsolutePathFromRelativePath

public static java.lang.String getAbsolutePathFromRelativePath(java.lang.String strDirectory)
Returns the absolute path of a repository from a relative path

Parameters:
strDirectory - the relative path
Returns:
the repository absolute path

getBaseUrl

public static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
Return the url of the webapp, built from rhe request

Parameters:
request - The HttpServletRequest
Returns:
strBase the webapp url

getSiteMessageUrl

public static java.lang.String getSiteMessageUrl(javax.servlet.http.HttpServletRequest request)
Return the url of the webapp, built from the request

Parameters:
request - The HttpServletRequest
Returns:
strBase the webapp url

getPortalUrl

public static java.lang.String getPortalUrl()
Returns the portal page relative url (jsp/site/Portal.jsp) defined in lutece.properties

Returns:
the Portal Url

getAdminPortalUrl

public static java.lang.String getAdminPortalUrl()
Returns the admin portal page relative url (jsp/admin/site/AdminSite.jsp) defined in lutece.properties

Returns:
the Portal Url

getAdminMenuUrl

public static java.lang.String getAdminMenuUrl()
Returns the admin menu page relative url (jsp/admin/site/AdminMenu.jsp) defined in lutece.properties

Returns:
the Admin Menu Url

getAvailableVirtualHosts

public static ReferenceList getAvailableVirtualHosts()
Gets available virtual hosts defined in the config.properties

Returns:
A reference list containing the key and the description of each virtual host configuration. The list is empty if there is no configuration defined.

getVirtualHostKey

public static java.lang.String getVirtualHostKey(javax.servlet.http.HttpServletRequest request)
Gets a Virtual Host Key if the request contains a virtual host key

Parameters:
request - The HTTP request
Returns:
A Virtual Host Key if present, otherwise null.

buildRedirectUrlItem

public static UrlItem buildRedirectUrlItem(java.lang.String strRootUrl,
                                           java.lang.String strUrlPropertySuffixKey)
Build the url item to use for a url that includes the redirection parameter for reconnection.

Parameters:
strRootUrl - the root part of the url, to build an absolute url
strUrlPropertySuffixKey - The property suffix to retrieve the url
Returns:
an absolute url, completed with the redirectUrl parameter (contains the relative part of the url), as an UrlItem

resolveRedirectUrl

public static UrlItem resolveRedirectUrl(javax.servlet.http.HttpServletRequest request,
                                         java.lang.String strDefaultRedirectUrl)
Retrieve the url to redirect to after login. It is given by the redirectUrl parameter if found. The request parameters are copied (except the login and acces code). This is to be used by the doLogin method of AdminLoginJspBean.

Parameters:
request - the http request
strDefaultRedirectUrl - the default url to go to after login
Returns:
an UrlItem corresponding to the url to redirect to after login.


Copyright © 2010 Mairie de Paris. All Rights Reserved.