Class ServletUtil

java.lang.Object
net.sf.basedb.opengrid.servlet.ServletUtil

public class ServletUtil extends Object
Utility functions for servlets.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Checks if the currently logged in user has permission to manage Open Grid Clusters (=WRITE permission for the extension system).
    getSessionControl(javax.servlet.ServletRequest req)
    Get an existing session control and check that a user is logged in.
    static org.json.simple.JSONObject
    parseRequest(javax.servlet.http.HttpServletRequest request)
    Parse the request as JSON data.
    static void
    setJsonResponseHeaders(javax.servlet.http.HttpServletResponse resp)
    Set proper response headers for returning a JSON response.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServletUtil

      public ServletUtil()
  • Method Details

    • getSessionControl

      public static SessionControl getSessionControl(javax.servlet.ServletRequest req)
      Get an existing session control and check that a user is logged in.
    • setJsonResponseHeaders

      public static void setJsonResponseHeaders(javax.servlet.http.HttpServletResponse resp)
      Set proper response headers for returning a JSON response. This sets the content type to: application/json;charset=UTF8 and disable caching of the responses.
    • parseRequest

      public static org.json.simple.JSONObject parseRequest(javax.servlet.http.HttpServletRequest request) throws IOException, org.json.simple.parser.ParseException
      Parse the request as JSON data.
      Throws:
      IOException
      org.json.simple.parser.ParseException
    • checkPermission

      public static void checkPermission(DbControl dc)
      Checks if the currently logged in user has permission to manage Open Grid Clusters (=WRITE permission for the extension system).