diff -r 1574965c7dc7 -r 57cfb94ab99f src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Wed May 13 21:46:26 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Thu May 14 22:48:01 2020 +0200 @@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.sql.Connection; @@ -225,6 +226,18 @@ } /** + * @param req the servlet request object + * @param location the location where to redirect + * @see Constants#REQ_ATTR_REDIRECT_LOCATION + */ + public void setRedirectLocation(HttpServletRequest req, String location) { + if (location.startsWith("./")) { + location = location.replaceFirst("\\./", Functions.baseHref(req)); + } + req.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, location); + } + + /** * Specifies the name of an additional stylesheet used by the module. *
* Setting an additional stylesheet is optional, but quite common for HTML
@@ -240,6 +253,30 @@
req.setAttribute(Constants.REQ_ATTR_STYLESHEET, Functions.enforceExt(stylesheet, ".css"));
}
+ /**
+ * Obtains a request parameter of the specified type.
+ * The specified type must have a single-argument constructor accepting a string to perform conversion.
+ * The constructor of the specified type may throw an exception on conversion failures.
+ *
+ * @param req the servlet request object
+ * @param clazz the class object of the expected type
+ * @param name the name of the parameter
+ * @param