|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.universAAL.ri.servicegateway.GatewayPort
public abstract class GatewayPort
Base class for HTTP servlets. To create a servlet, create a subclass and
overwrite one of the methods
HttpServlet.doGet(HttpServletRequest, HttpServletResponse)
or
HttpServlet.doPost(HttpServletRequest, HttpServletResponse)
. Then set the module
context and call register()
. When done, call unregister()
.
Field Summary | |
---|---|
protected Hashtable<String,User> |
loggedUsers
Table that Associates usernames with User s. |
static String |
REALM
|
Constructor Summary | |
---|---|
GatewayPort()
Simply initialize the logger and the user table for the security |
|
GatewayPort(ModuleContext mcontext)
|
Method Summary | |
---|---|
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. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Hashtable<String,User> loggedUsers
User
s.
public static final String REALM
Constructor Detail |
---|
public GatewayPort()
public GatewayPort(ModuleContext mcontext)
Method Detail |
---|
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
false
public 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |