%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%@ page import="org.crosswire.webtools.RightsAndRoles" %>
<%@ page import="org.crosswire.webtools.annotation.*" %>
<%@ page import="org.crosswire.webtools.*" %>
<%!
@Description(value = "Close a session.", name = "auth/session/close")
public static class MyParameters extends Parameters {
@Description(value = "Show usage for this web service", example = "true", defaultValue = "false")
public Boolean help = false;
@Description(value = "Session hash given from auth/session/open")
public String sessionHash = null;
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.help) {
params.format = "html";
}
else if (params.getErrors().size() == 0) {
if (params.sessionHash == null) params.sessionHash = RightsAndRoles.getInstance().getCurrentSession(request, response);
if (params.sessionHash != null) {
RightsAndRoles.getInstance().closeSession(params.sessionHash, response);
XMLBlock retVal = XMLBlock.createXMLBlock("");
Serializer.output(response, out, params, retVal);
return;
}
else {
params.addError(-4, "no open session");
}
}
Serializer.reportErrors(request, response, out, params, true);
%>