Skip to content
Snippets Groups Projects
Commit 30484a69 authored by tpylak's avatar tpylak
Browse files

minor refactoring

SVN: 19040
parent d7a0e2de
No related branches found
No related tags found
No related merge requests found
......@@ -35,12 +35,17 @@ import ch.systemsx.cisd.openbis.generic.server.SessionConstants;
public abstract class AbstractServlet extends AbstractController
{
protected final String getSessionToken(final HttpServletRequest request)
{
return getParameter(request, SessionConstants.OPENBIS_SESSION_TOKEN_ATTRIBUTE_KEY);
}
private String getParameter(final HttpServletRequest request, String parameterName)
{
// We must have a session reaching this point. See the constructor where we set
// 'setRequireSession(true)'.
final HttpSession session = request.getSession(false);
assert session != null : "Session must be specified.";
return ((String) session.getAttribute(SessionConstants.OPENBIS_SESSION_TOKEN_ATTRIBUTE_KEY));
return ((String) session.getAttribute(parameterName));
}
protected final void writeResponse(final HttpServletResponse response, final String value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment