public abstract class GatewayPort
extends javax.servlet.http.HttpServlet
HttpServlet.doGet(HttpServletRequest, HttpServletResponse)
or
HttpServlet.doPost(HttpServletRequest, HttpServletResponse)
. Then set the module
context and call register()
. When done, call unregister()
.Modifier and Type | Field and Description |
---|---|
protected Hashtable<String,User> |
loggedUsers
Table that Associates usernames with
User s. |
static String |
REALM |
Constructor and Description |
---|
GatewayPort()
Simply initialize the logger and the user table for the security
|
GatewayPort(ModuleContext mcontext) |
Modifier and Type | Method and Description |
---|---|
abstract String |
dataDir()
The symbolic data directory where all the resources reside.
|
ModuleContext |
getContext() |
String[] |
getUserAndPass(String auth) |
boolean |
handleAuthorization(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Handle the login phase
|
void |
logout(User usr) |
boolean |
register() |
protected void |
requireCredentials(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Set the HTTP Basic Authentication response with the realm.
|
void |
setContext(ModuleContext mcontext) |
boolean |
unregister() |
abstract String |
url()
The URL where the servlet is registered and accessed by the web client.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected Hashtable<String,User> loggedUsers
User
s.public static final String REALM
public GatewayPort()
public GatewayPort(ModuleContext mcontext)
protected void requireCredentials(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- The request from goGet methodresp
- The response from doGet method, used to set the header to
WWW-Authenticate and the status to 401public String[] getUserAndPass(String auth)
auth
- The BASE64 encoded user:pass values. If null or empty, returns
falsepublic boolean handleAuthorization(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- The request from goGet method, used to retrieve the
"Authorization" headerresp
- The response from doGet method, used to redirect to the
correct url()public void logout(User usr)
public void setContext(ModuleContext mcontext)
public ModuleContext getContext()
public abstract String url()
public abstract String dataDir()
<script type="text/javascript" src="/myservicedir/script.js">
public boolean register()
public boolean unregister()
Copyright © 2018 universAAL Consortium. All rights reserved.