Added URI fields and added cookie authentication

This commit is contained in:
Ziver Koc 2018-07-27 15:29:00 +02:00
parent 99c67eaaba
commit 8e56ff406a
16 changed files with 133 additions and 71 deletions

View file

@ -64,4 +64,19 @@ public abstract class ZalleryServlet extends HttpServlet {
if (dispatcher != null)
dispatcher.forward(request, response);
}
public void redirect(String url, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (url.startsWith("http"))
response.sendRedirect(url);
else {
if (!url.startsWith("/"))
url = "/" + url;
String path = request.getRequestURI();
if (!path.endsWith("/"))
path = path.substring(0, path.lastIndexOf("/"));
response.sendRedirect(path + url);
}
}
}