it.eng.spagobi.utilities
Class PortletUtilities

java.lang.Object
  extended by it.eng.spagobi.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.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()
           
static javax.portlet.PortletRequest getPortletRequest()
          Gets the PortletRequest object.
static javax.portlet.PortletResponse getPortletResponse()
          Gets the PortletResponse object.
static it.eng.spago.base.SourceBean getServiceRequestFromMultipartPortletRequest(javax.portlet.PortletRequest portletRequest)
          Gets the service request from a Multipart Portlet Request.
static boolean isMultipartRequest()
           
 
Methods inherited from class java.lang.Object
equals, 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

getServiceRequestFromMultipartPortletRequest

public static it.eng.spago.base.SourceBean getServiceRequestFromMultipartPortletRequest(javax.portlet.PortletRequest portletRequest)
Gets the service request from a Multipart Portlet Request. This method creates a new file upload handler, then parses the request and processes the new uploaded items. In this way a new uploaded file is obtained, which is put into the serviceRequest object.

Parameters:
portletRequest - The input portlet request
Returns:
The serviceRequest SourceBean containing the uploaded file.

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()

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

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

isMultipartRequest

public static boolean isMultipartRequest()