it.eng.spago.util
Class PortletUtilities

java.lang.Object
  extended byit.eng.spago.util.PortletUtilities

public class PortletUtilities
extends java.lang.Object

Author:
Zoppello

Constructor Summary
PortletUtilities()
           
 
Method Summary
static java.lang.String cleanString(java.lang.String original)
          Cleans a string from spaces and tabulation characters.
static java.lang.String createPortletURL(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(HttpServletRequest aHttpServletRequest, java.lang.String resourcePath)
          Creates the particular portlet URL for a resource, given its path.
static UploadedFile getFirstUploadedFile(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 PortletRequest getPortletRequest()
          Gets the PortletRequest object.
static PortletResponse getPortletResponse()
          Gets the PortletResponse object.
static SourceBean getServiceRequestFromMultipartPortletRequest(PortletRequest portletRequest)
          Gets the service request from a Multipart Portlet Request.
 
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(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(HttpServletRequest aHttpServletRequest,
                                                           java.lang.String resourcePath)
Creates the particular portlet URL for a resource, given its path.

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

getPortletRequest

public static PortletRequest getPortletRequest()
Gets the PortletRequest object.

Returns:
The portlet request object

getPortletResponse

public static PortletResponse getPortletResponse()
Gets the PortletResponse object.

Returns:
The portlet response object

getServiceRequestFromMultipartPortletRequest

public static SourceBean getServiceRequestFromMultipartPortletRequest(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(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.

cleanString

public static java.lang.String cleanString(java.lang.String original)
Cleans a string from spaces and tabulation characters.

Parameters:
original - The input string
Returns:
The cleaned string

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