it.eng.spagobi.commons.utilities
Class PortletUtilities

java.lang.Object
  extended by it.eng.spagobi.commons.utilities.PortletUtilities

public class PortletUtilities
extends java.lang.Object

Contains some SpagoBI's portlet utilities.

Author:
Zoppello

Constructor Summary
PortletUtilities()
           
 
Method Summary
static java.lang.String createPortletURL(javax.servlet.http.HttpServletRequest aHttpServletRequest, java.lang.String originalURL)
          Starting from the original URL and the request, creates a string representing the Portlet URL.
static java.lang.String createPortletURLForResource(javax.servlet.http.HttpServletRequest aHttpServletRequest, java.lang.String resourceAbsolutePath)
          Creates the particular portlet URL for a resource, given its path.
static UploadedFile getFirstUploadedFile(javax.portlet.PortletRequest portletRequest)
          Gets the first uploaded file from a portlet request.
static java.util.Locale getLocaleForMessage()
          Get the locale of the portal or the one setted into the configuration files
static java.lang.String getMessage(java.lang.String code, java.lang.String bundle)
          Gets a localized message given its code and bundle information.
static java.lang.String getPortalLanguageCode()
          Gets the language code of the user portal language.
static java.util.Locale getPortalLocale()
          Gets the portal locale.
static javax.portlet.PortletRequest getPortletRequest()
          Gets the PortletRequest object.
static javax.portlet.PortletResponse getPortletResponse()
          Gets the PortletResponse object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletUtilities

public PortletUtilities()
Method Detail

createPortletURL

public static java.lang.String createPortletURL(javax.servlet.http.HttpServletRequest aHttpServletRequest,
                                                java.lang.String originalURL)
Starting from the original URL and the request, creates a string representing the Portlet URL.

Parameters:
aHttpServletRequest - The request object at input
originalURL - The starting original URL
Returns:
A String representing the Portlet URL

createPortletURLForResource

public static java.lang.String createPortletURLForResource(javax.servlet.http.HttpServletRequest aHttpServletRequest,
                                                           java.lang.String resourceAbsolutePath)
Creates the particular portlet URL for a resource, given its path.

Parameters:
aHttpServletRequest - The request object at input
resourceAbsolutePath - The resource Absolute path
Returns:
The resource Portlet URL String

getPortletRequest

public static javax.portlet.PortletRequest getPortletRequest()
Gets the PortletRequest object.

Returns:
The portlet request object

getPortletResponse

public static javax.portlet.PortletResponse getPortletResponse()
Gets the PortletResponse object.

Returns:
The portlet response object

getFirstUploadedFile

public static UploadedFile getFirstUploadedFile(javax.portlet.PortletRequest portletRequest)
Gets the first uploaded file from a portlet request. This method creates a new file upload handler, parses the request, processes the uploaded items and then returns the first file as an UploadedFile object.

Parameters:
portletRequest - The input portlet request
Returns:
The first uploaded file object.

getPortalLocale

public static java.util.Locale getPortalLocale()
Gets the portal locale.

Returns:
the portal locale

getMessage

public static java.lang.String getMessage(java.lang.String code,
                                          java.lang.String bundle)
Gets a localized message given its code and bundle information. If there isn't any message matching to these infromation, a warning is traced.

Parameters:
code - The message's code string
bundle - The message's bundel string
Returns:
A string containing the message

getLocaleForMessage

public static java.util.Locale getLocaleForMessage()
Get the locale of the portal or the one setted into the configuration files

Returns:
locale for message resolution

getPortalLanguageCode

public static java.lang.String getPortalLanguageCode()
Gets the language code of the user portal language. If it's not possible to gather the locale of the portal it returns the default language code

Returns:
A string containing the language code