public class

HTTPHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.utils.HTTPHelper

Class Overview

This class contains some public utility methods that can be used for handling parameters included on collections such as the HttpServletRequest object, and the RequestKeys object.

Summary

Public Constructors
HTTPHelper()
Public Methods
static int fixInt(RequestKeys rk, String param, int defaultValue, boolean isZeroLengthValid)
Transforms the string sent as parameter into an int value.
static int fixInt(RequestKeys rk, String param, int defaultValue)
static int fixInt(String fixedValue, int defaultValue)
Transforms the string sent as parameter into an int value.
static String fixString(RequestKeys rk, String param, String defaultValue)
Searches for the asked parameter on the request object.
static String fixString(RequestKeys rk, String param, String defaultValue, boolean isZeroLengthValid)
Searches for the asked parameter on the request object.
static int getBrowserLocale(AppContext appContext)
static String getDescriptor(int key)
This method is deprecated. No replacement.
static String getDescriptor(int key, Messages messages)
Obtains the descriptor string corresponding to the indicated key
static String getEnumerationValue(String enumValue)
This method is deprecated. This method is deprecated. Instead use getEnumerationValue(String).
static String getLastRowPosition(ReportBean rb)
Gets the position where the new attribute will be displayed
static int getLocale(String localeStr, AppContext appContext)
static int getOutputFormatToUse(Preferences preferences, BrowserSettings browserSettings)
This method is deprecated. Use getOutputFormatToUse(AppContext)
static int getOutputFormatToUse(AppContext appContext)
Determines the output mode the beans should use when getting displayed based on the preferences as defined by the instance of AppContext.
static WebProjectInstance getProject(WebIServerSession session)
static String getProjectAlias(String serverName, int serverPort, String projectName)
This method is deprecated. use getProjectAlias(String, int, String, Locale)
static String getProjectAlias(String serverName, String projectName)
static String getProjectAlias(WebIServerSession session)
Utility method for obtaining the project alias string based on the Server and original Project name.
static String getProjectAlias(String serverName, int serverPort, String projectName, Locale locale)
Utility method for obtaining the project alias string based on the Server and original Project name.
static boolean isDefaultLocale(String localeStr)
static boolean isIFrameRequest(PageComponent mstrPage)
static boolean isKeyExisting(RequestKeys keys, WebEvent event, int argID)
Checks if the argument sent as parameter exists on the RequestKeys instance
static boolean isKeyExisting(RequestKeys keys, String argName)
Checks if the argument sent as parameter exists on the RequestKeys instance
static String mimeEncode(String input)
Utility method to encode the HTTP header value with RFC 2047.
static void processApplyChanges(WebComponent wc)
Handles the request for the instances of ReportBean and RWBean
static void processResetChanges(ReportBean rb)
Resets the changes om the ReportBean.
static String toSysBeanName(int sysBeanType)
static int toSysBeanType(String sysBeanName)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public HTTPHelper ()

Public Methods

public static int fixInt (RequestKeys rk, String param, int defaultValue, boolean isZeroLengthValid)

Transforms the string sent as parameter into an int value.

Parameters
rk RequestKeys object initialized
param String containing the name of the parameter to search for
defaultValue String with the default value of the parameter
isZeroLengthValid boolean flag indicating if the value of the parameter can be zero-length
Returns
  • the value of the parameter. If not found, or the length of the value is zero and this is not allowed, the default value will be used. Otherwise, the value found for the parameter will be the output of the method.

public static int fixInt (RequestKeys rk, String param, int defaultValue)

public static int fixInt (String fixedValue, int defaultValue)

Transforms the string sent as parameter into an int value.

Parameters
fixedValue String containing the value to transform into an integer
defaultValue int with the default value of the parameter
Returns
  • the value of the parameter as an int. If an error is generated while the conversion the default value will be used.

public static String fixString (RequestKeys rk, String param, String defaultValue)

Searches for the asked parameter on the request object.

Parameters
rk RequestKeys object initialized
param String containing the name of the parameter to search for
defaultValue String with the default value of the parameter
Returns
  • the value of the parameter. If not found, or the length of the value is zero and since this is not allowed, the default value will be used. Otherwise, the value found for the parameter will be the output of the method.

public static String fixString (RequestKeys rk, String param, String defaultValue, boolean isZeroLengthValid)

Searches for the asked parameter on the request object.

Parameters
rk RequestKeys object initialized
param String containing the name of the parameter to search for
defaultValue String with the default value of the parameter
isZeroLengthValid Boolean flag indicating if the value of the parameter can be zero-length
Returns
  • the value of the parameter. If not found, or the length of the value is zero and this is not allowed, the default value will be used. Otherwise, the value found for the parameter will be the output of the method.

public static int getBrowserLocale (AppContext appContext)

public static String getDescriptor (int key)

This method is deprecated.
No replacement.

Obtains the descriptor string corresponding to the indicated key

Parameters
key identifier to look for on the string database
Returns
  • string corresponding to the indicated key

public static String getDescriptor (int key, Messages messages)

Obtains the descriptor string corresponding to the indicated key

Parameters
key identifier to look for on the string database
messages Messages instance where the descriptor string will be looked for.
Returns
  • string corresponding to the indicated key

public static String getEnumerationValue (String enumValue)

This method is deprecated.
This method is deprecated. Instead use getEnumerationValue(String).

Returns the value of the constant defined in the Java fully qualified class name and constant name received as a parameter. The value is always returned as a String regardless of the original data type. If the class cannot be resolved or the data member does not exist, null is returned.

Parameters
enumValue FCN of the data member to resolved. i.e. com.microstrategy.web.beans.EnumReportBeanEvents.REPORT_EVENT_EXECUTE
Returns
  • String object containing the value of the FCN memmber provided. For the previous example, the return value is "4001"

public static String getLastRowPosition (ReportBean rb)

Gets the position where the new attribute will be displayed

Parameters
rb a ReportBean instance initialized
Returns
  • the last index (plus one) of the row axis on the template. If an error happens, returns 1 by default.

public static int getLocale (String localeStr, AppContext appContext)

public static int getOutputFormatToUse (Preferences preferences, BrowserSettings browserSettings)

This method is deprecated.
Use getOutputFormatToUse(AppContext)

Determines the output mode the beans should use when getting displayed based on preferences

Parameters
preferences Preferences initialized instance
browserSettings BrowserSettings initialized instance
Returns

public static int getOutputFormatToUse (AppContext appContext)

Determines the output mode the beans should use when getting displayed based on the preferences as defined by the instance of AppContext.

Parameters
appContext AppContext
Returns
  • int

public static WebProjectInstance getProject (WebIServerSession session)

public static String getProjectAlias (String serverName, int serverPort, String projectName)

This method is deprecated.
use getProjectAlias(String, int, String, Locale)

Utility method for obtaining the project alias string based on the Server and original Project name.

Parameters
serverName String with the name of the I-Server of the project to look for
serverPort Port of I-Server.
projectName String with the original project name to look for
Returns
  • a String with the original project name if no alias was found, or the value of the alias found on the System Preferences for the given project.

public static String getProjectAlias (String serverName, String projectName)

This method is deprecated.
Please use getProjectAlias(WebIServerSession) or getProjectAlias(String, int, String, Locale).

Utility method for obtaining the project alias string based on the Server and original Project name

Parameters
serverName String with the name of the I-Server of the project to look for
projectName String with the original project name to look for
Returns
  • a String with the original project name if no alias was found, or the value of the alias found on the System Preferences for the given project.

public static String getProjectAlias (WebIServerSession session)

Utility method for obtaining the project alias string based on the Server and original Project name.

Parameters
session session available for lookup.
Returns
  • a String with the original project name if no alias was found, or the value of the alias found on the System Preferences for the given project.

public static String getProjectAlias (String serverName, int serverPort, String projectName, Locale locale)

Utility method for obtaining the project alias string based on the Server and original Project name.

Parameters
serverName String with the name of the I-Server of the project to look for
serverPort Port of I-Server.
projectName String with the original project name to look for
locale locale of the project alias to return
Returns
  • a String with the original project name if no alias was found, or the value of the alias found on the System Preferences for the given project.

public static boolean isDefaultLocale (String localeStr)

public static boolean isIFrameRequest (PageComponent mstrPage)

public static boolean isKeyExisting (RequestKeys keys, WebEvent event, int argID)

Checks if the argument sent as parameter exists on the RequestKeys instance

Parameters
keys a RequestKeys initialized instance
event a WebEvent instance from where the argument name will be obtained
argID the identifier of the argument to search for
Returns
  • True if the argument was found as a parameter on the RequestKeys, either as the exact name or with the '.x' or '.y' extension (passed as an image input).

public static boolean isKeyExisting (RequestKeys keys, String argName)

Checks if the argument sent as parameter exists on the RequestKeys instance

Parameters
keys a RequestKeys initialized instance
argName the name of the argument to search for
Returns
  • True if the argument was found as a parameter on the RequestKeys, either as the exact name or with the '.x' or '.y' extension (passed as an image input).

public static String mimeEncode (String input)

Utility method to encode the HTTP header value with RFC 2047.

Parameters
input HTTP header value which has non-ASCII characters.
Returns
  • an encoded String

public static void processApplyChanges (WebComponent wc)

Handles the request for the instances of ReportBean and RWBean

Parameters
wc WebComponent
Throws
WebException
WebException

public static void processResetChanges (ReportBean rb)

Resets the changes om the ReportBean.

Parameters
rb ReportBean
Throws
WebException

public static String toSysBeanName (int sysBeanType)

public static int toSysBeanType (String sysBeanName)