Package org.pentaho.platform.web.servlet
Class LocalizationServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.pentaho.platform.web.servlet.ServletBase
org.pentaho.platform.web.servlet.LocalizationServlet
- All Implemented Interfaces:
- Serializable,- javax.servlet.Servlet,- javax.servlet.ServletConfig,- org.pentaho.platform.api.engine.ILogger
This class makes a message bundle available as a JSON hash. This is designed to be used as a web service to allow
 thin-clients to retrieve message bundles from the server.
- See Also:
- 
Field SummaryFields inherited from class org.pentaho.platform.web.servlet.ServletBasedebugFields inherited from interface org.pentaho.platform.api.engine.ILoggerACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) protected ResourceBundleRetrieve aResourceBundlefrom a plugin.getJSONBundle(String pluginId, String name) Load the resource bundle for the plugin provided and return the resulting properties map as JSON.protected StringgetJsonForBundle(ResourceBundle bundle) Convert a into a JSON string.org.apache.commons.logging.LogbooleanisMessageCachingEnabled(org.pentaho.platform.api.engine.IPluginManager pm, String pluginId) Should the messages in the Resource Bundle be cached?Methods inherited from class org.pentaho.platform.web.servlet.ServletBasedebug, debug, error, error, fatal, fatal, getLoggingLevel, getObjectName, getPentahoSession, info, info, setCorsHeaders, setLoggingLevel, trace, trace, warn, warnMethods inherited from class javax.servlet.http.HttpServletdoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServletdestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
- 
Constructor Details- 
LocalizationServletpublic LocalizationServlet()
 
- 
- 
Method Details- 
getLoggerpublic org.apache.commons.logging.Log getLogger()- Specified by:
- getLoggerin class- ServletBase
 
- 
doGetpublic void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException - Overrides:
- doGetin class- javax.servlet.http.HttpServlet
- Throws:
- javax.servlet.ServletException
- IOException
 
- 
doPostpublic void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException - Overrides:
- doPostin class- javax.servlet.http.HttpServlet
- Throws:
- javax.servlet.ServletException
- IOException
 
- 
getBundleRetrieve aResourceBundlefrom a plugin.- Parameters:
- pluginId- ID of the plugin to load the resource bundle from
- name- Resource bundle name that resides in the plugin
- Returns:
- Resource bundle for the name provided in the plugin referenced by pluginId
- Throws:
- IllegalArgumentException- Invalid plugin Id
- MissingResourceException- Invalid resource bundle name
 
- 
isMessageCachingEnabledpublic boolean isMessageCachingEnabled(org.pentaho.platform.api.engine.IPluginManager pm, String pluginId) Should the messages in the Resource Bundle be cached?- Parameters:
- pm- Plugin manager
- pluginId- ID of plugin whose "cache-messages" setting should be checked
- Returns:
- trueif the localization messages loaded from this plugin should be cached
 
- 
getJSONBundleLoad the resource bundle for the plugin provided and return the resulting properties map as JSON. This is intended to be used with Dojo's i18n system (http://dojotoolkit.org/reference-guide/1.7/quickstart/internationalization/index .html#quickstart-internationalization-index)- Parameters:
- pluginId- ID of plugin to load the resource from
- name- Name of the resource to load
- Returns:
- JSON String with a hash of key/value pairs representing properties from the requested resource bundle
 
- 
getJsonForBundleConvert a into a JSON string.- Parameters:
- bundle- Resource bundle to convert
- Returns:
- Bundle with all key/value pairs as entries in a hash, returned as a JSON string.
- Throws:
- org.json.JSONException
 
 
-