Package de.kosmos_lab.web.server
Class MyHttpServletRequest
- java.lang.Object
-
- de.kosmos_lab.web.server.MyHttpServletRequest
-
public class MyHttpServletRequest extends Object
"small" wrapper for our Requests primarily used to cache the body / jsonobject body objects and allow the direct getting of ints etc
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description MyHttpServletRequest(jakarta.servlet.http.HttpServletRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckParameter(String[] params)ObjectgetAttribute(String key)StringgetBody()org.json.JSONArraygetBodyAsJSONArray()org.json.JSONObjectgetBodyAsJSONObject()booleangetBoolean(String key)booleangetBoolean(String key, boolean defaultValue)doublegetDouble(String key)doublegetDouble(String key, double defaultValue)intgetInt(String key)intgetInt(String key, int defaultValue)StringgetParameter(String key)StringgetParameter(String key, boolean throwException)jakarta.servlet.http.HttpServletRequestgetRequest()StringgetString(String key)StringgetString(String key, String defaultValue)UsergetUser()
-
-
-
Method Detail
-
checkParameter
public void checkParameter(String[] params) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getBody
@Nonnull public String getBody() throws IOException
- Throws:
IOException
-
getBodyAsJSONArray
public org.json.JSONArray getBodyAsJSONArray()
-
getBodyAsJSONObject
public org.json.JSONObject getBodyAsJSONObject()
-
getBoolean
public boolean getBoolean(String key) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
-
getDouble
public double getDouble(String key) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getDouble
public double getDouble(String key, double defaultValue)
-
getInt
public int getInt(String key) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getInt
public int getInt(String key, int defaultValue)
-
getParameter
@Nonnull public String getParameter(String key, boolean throwException) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest()
-
getString
@Nonnull public String getString(String key) throws ParameterNotFoundException
- Throws:
ParameterNotFoundException
-
getUser
public User getUser()
-
-