Package net.sf.basedb.opengrid.servlet
Class ServletUtil
java.lang.Object
net.sf.basedb.opengrid.servlet.ServletUtil
Utility functions for servlets.
- Since:
- 1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Checks if the currently logged in user has permission to manage Open Grid Clusters (=WRITE permission for the extension system).static SessionControl
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.
-
Constructor Details
-
ServletUtil
public ServletUtil()
-
-
Method Details
-
getSessionControl
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
Checks if the currently logged in user has permission to manage Open Grid Clusters (=WRITE permission for the extension system).
-