|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.acsinet_solutions.cetia4.controller.ControllerTools
public final class ControllerTools
Servlet and controller-related utilities. TODO: Separar - crear un helper de locales
| Field Summary |
|---|
| Fields inherited from interface com.acsinet_solutions.cetia4.controller.ControllerConstants |
|---|
_METHOD_PARAM, _PAGE_PARAM, _ROOT_PARAM, DEFAULT_VIEW, ERROR_URL, ERROR_VIEW, LOAD_CANCEL, LOAD_CURRENT, LOAD_DEFAULT, LOAD_ERROR, LOAD_PREVIOUS |
| Fields inherited from interface com.acsinet_solutions.cetia4.controller.AttributeKeys |
|---|
_BUNDLE_KEY, _CONFIGURATION_KEY, _DEFAULT_CONTROLLER_KEY, _FORM_ACTION_KEY, _FORM_ATTRIBUTE_KEY, _LOCALE_KEY, _MESSAGE_KEY, _NAVIGATION_FLOW_KEY, _PORTAL_PATH_KEY, _RENDER_PARAMETERS_KEY, _SERVICE_LOCATOR_KEY, _SESSION_KEY, _SYSTEM_EXCEPTION_KEY, _VALIDATION_EXCEPTION_KEY |
| Constructor Summary | |
|---|---|
ControllerTools()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
appendQueryString(java.lang.String page,
java.lang.String suffix)
Append the given suffix to the query string. |
static Configuration |
getConfiguration(javax.servlet.ServletContext context)
Get the configuration object reference to the global configuration of the current application, create it if it does not exist. |
static Configuration |
getConfiguration(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config)
Get a configuration object reference for the given context and config reference. |
static Link |
getLink(javax.servlet.http.HttpServletRequest request)
Create a link from a request instance, that contains all request parameters. |
static Link |
getLink(RequestContext context)
Create a link from a RequestContext instance. |
static java.util.Locale |
getLocale(javax.servlet.jsp.PageContext context)
Get the locale configured for the current context request. |
static NavigationFlow |
getNavigationFlow(javax.servlet.http.HttpServletRequest request)
Get the navigation flow for the current application. |
static NavigationFlow |
getNavigationFlow(RequestContext context)
Get the navigation flow for the current application. |
static java.lang.String |
getPortalPath(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request)
Get the basic portal path from the context and request instances. |
static java.lang.String |
getRequestedController(javax.servlet.http.HttpServletRequest request)
Get the original request string, not containing the context path and query string, but containing path info: http://host:8080/contextpath/server/pathinfo?query=string |
static java.lang.String |
getRequestedPage(javax.servlet.http.HttpServletRequest request)
Get the original request string URI, containing both path info and query String: http://host:8080/contextpath/server/pathinfo?query=string |
static java.lang.String |
getRequestedServlet(javax.servlet.http.HttpServletRequest request)
Get the original request string, not containing the context path, but containing both path info and query string: http://host:8080/contextpath/server/pathinfo?query=string |
static ServiceLocator |
getServiceLocator(RequestContext context)
Get the service locator, if any was configured. |
static ServiceLocator |
getServiceLocator(javax.servlet.ServletContext context)
Get the service locator, if any was configured. |
static Link |
getSpecialLink(NavigationFlow flow,
java.lang.String view)
Get the link associated with the given special view in the given NavigationFlow instance. |
static java.lang.String |
getText(javax.servlet.jsp.PageContext pageContext,
java.lang.String key,
java.lang.Object... params)
Get a localized message using the default JSTL-configured locale. |
static java.lang.String |
getText(RequestContext context,
java.lang.String key,
java.lang.Object... params)
Get a localized message using the default JSTL-configured locale. |
static void |
initLocaleAndBundle(javax.servlet.ServletContext context)
Load the JSTL application resource bundle as a map in the context, if provided. |
static void |
loadResourceBundleMap(javax.servlet.ServletContext context,
java.util.Locale locale)
Load the resource bundle configured for the current application as a map implementation. |
static boolean |
requestAccepts(javax.servlet.http.HttpServletRequest request,
java.lang.String type,
java.lang.String subType)
Check if the given HTTP request accepts the given MIME-type. |
static void |
resetMap(RequestContext context,
java.lang.String key)
Convenience method for reseting a context map. |
static void |
resetMap(javax.servlet.ServletContext context,
java.lang.String key)
Convenience method for reseting a context map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ControllerTools()
| Method Detail |
|---|
public static final java.lang.String appendQueryString(java.lang.String page,
java.lang.String suffix)
page - A not-null String URI or URL. May have already a query
string specified, this method will check if a leading '?' or '&' is
needed for the new suffix.suffix - A maybe-null, maybe-empty query string suffix with no
'?' or '&' leading character.
public static Link getLink(javax.servlet.http.HttpServletRequest request)
request - A not-null HttpServletRequest instancepublic static Link getLink(RequestContext context)
request - A not-null HttpServletRequest instancegetLink(HttpServletRequest)
public static final Link getSpecialLink(NavigationFlow flow,
java.lang.String view)
view - one of LOAD_CURRENT, LOAD_PREVIOUS, LOAD_CANCEL or
LOAD_DEFAULT.ControllerConstants.LOAD_CURRENT,
ControllerConstants.LOAD_PREVIOUS,
ControllerConstants.LOAD_CANCEL,
ControllerConstants.LOAD_DEFAULTpublic static final java.lang.String getRequestedPage(javax.servlet.http.HttpServletRequest request)
request - A not-null HttpServletRequest instance
public static final java.lang.String getRequestedServlet(javax.servlet.http.HttpServletRequest request)
request - A not-null HttpServletRequest instance
public static final java.lang.String getRequestedController(javax.servlet.http.HttpServletRequest request)
request - A not-null HttpServletRequest instance
public static final NavigationFlow getNavigationFlow(javax.servlet.http.HttpServletRequest request)
AttributeKeys._NAVIGATION_FLOW_KEYpublic static final NavigationFlow getNavigationFlow(RequestContext context)
AttributeKeys._NAVIGATION_FLOW_KEYpublic static final ServiceLocator getServiceLocator(javax.servlet.ServletContext context)
AttributeKeys._SERVICE_LOCATOR_KEYpublic static final ServiceLocator getServiceLocator(RequestContext context)
AttributeKeys._SERVICE_LOCATOR_KEY
public static final java.lang.String getPortalPath(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request)
Configuration.PORTAL_PATH_PARAM
public static boolean requestAccepts(javax.servlet.http.HttpServletRequest request,
java.lang.String type,
java.lang.String subType)
public static final void resetMap(RequestContext context,
java.lang.String key)
LazyMap,
ServiceInitializerBase,
ContextAttribute
public static final void resetMap(javax.servlet.ServletContext context,
java.lang.String key)
LazyMap,
ServiceInitializerBase,
ContextAttributepublic static final void initLocaleAndBundle(javax.servlet.ServletContext context)
Initializations performed in this method are useful when a single locale and bundle is used application wide, otherwise storing a single bundle at context level won't help much.
ServiceInitializerBase,
loadResourceBundleMap(ServletContext,Locale)public static final java.util.Locale getLocale(javax.servlet.jsp.PageContext context)
AttributeKeys._LOCALE_KEY
public static final java.lang.String getText(RequestContext context,
java.lang.String key,
java.lang.Object... params)
key - A not-null valid key in the default bundleparams - Optional parameters for
the composition of the message
public static final java.lang.String getText(javax.servlet.jsp.PageContext pageContext,
java.lang.String key,
java.lang.Object... params)
key - A not-null valid key in the default bundleparams - Optional parameters for
the composition of the messagepublic static final Configuration getConfiguration(javax.servlet.ServletContext context)
public static final Configuration getConfiguration(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config)
public static final void loadResourceBundleMap(javax.servlet.ServletContext context,
java.util.Locale locale)
For applications that require use of multiple locales for personalization on multiple requests and user profiles, the creation of a single bundle won't help much, but it may not harm also ( for bundles that don't have too many keys ).
ResourceBundleMap,
AttributeKeys._BUNDLE_KEY
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||