1 package org.paneris.util;
2
3 import org.webmacro.servlet.WebContext;
4 import javax.servlet.http.HttpSession;
5
6
7
8
9 public class SessionUtil {
10
11
12
13
14 public static synchronized void setReturnURL
15 (String name, WebContext context) {
16 HttpSession session = context.getSession();
17
18 if (context.getForm("return") != null) {
19 if (context.getCGI().getHTTP_REFERER() != null)
20 context.getSession().setAttribute("LoginUserReturnURL",
21 context.getCGI().getHTTP_REFERER());
22 }
23
24 if (context.get(name) != null)
25 session.setAttribute(name, (String) context.get(name));
26 if (context.getForm(name) != null)
27 session.setAttribute(name, (String) context.getForm(name));
28
29
30 if (session.getAttribute(name) == null) {
31 session.setAttribute(name, "/");
32 }
33 System.err.println("Setting " + name + " to " +
34 session.getAttribute(name));
35 context.put(name, session.getAttribute(name));
36 }
37 }