org.pentaho.platform.web.servlet
Class LocalizationServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.pentaho.platform.web.servlet.ServletBase
              extended by org.pentaho.platform.web.servlet.LocalizationServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, ILogger

public class LocalizationServlet
extends ServletBase

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.

Author:
Jordan Ganoff (jganoff@pentaho.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pentaho.platform.web.servlet.ServletBase
debug
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Constructor Summary
LocalizationServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 String getJSONBundle(String pluginId, String name)
          Load the resource bundle for the plugin provided and return the resulting properties map as JSON.
 org.apache.commons.logging.Log getLogger()
           
 boolean isMessageCachingEnabled(IPluginManager pm, String pluginId)
          Should the messages in the Resource Bundle be cached?
 
Methods inherited from class org.pentaho.platform.web.servlet.ServletBase
debug, debug, error, error, fatal, fatal, getLoggingLevel, getObjectName, info, info, setLoggingLevel, trace, trace, warn, warn
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizationServlet

public LocalizationServlet()
Method Detail

getLogger

public org.apache.commons.logging.Log getLogger()
Specified by:
getLogger in class ServletBase

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws javax.servlet.ServletException,
                  IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

isMessageCachingEnabled

public boolean isMessageCachingEnabled(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:
true if the localization messages loaded from this plugin should be cached

getJSONBundle

public String getJSONBundle(String pluginId,
                            String name)
Load 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