|
Tynamo™-SNAP v1.0.4 |
||||||||
| 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
com.qindesign.servlet.AuthenticatedHttpServlet
com.qindesign.servlet.example.AuthExampleServlet
public class AuthExampleServlet
Example of an authenticated servlet. The realm is "Realm", and the username and password are "test" and "test".
This servlet implements SingleThreadModel so that the call
to isAuthExpired happens for the same request as
doGet. This is only necessary, however, if more than
one request will be made to this servlet at the same time.
| Constructor Summary | |
|---|---|
AuthExampleServlet()
|
|
| Method Summary | |
|---|---|
protected void |
doGet(HttpServletRequest req,
HttpServletResponse resp)
Authorized GET. |
protected void |
doPost(HttpServletRequest req,
HttpServletResponse resp)
Authorized POST. |
protected void |
doUnauthorizedGet(HttpServletRequest req,
HttpServletResponse resp)
Unauthorized GET request. |
protected void |
doUnauthorizedPost(HttpServletRequest req,
HttpServletResponse resp)
Unauthorized POST request. |
String |
getPassword(String realm,
String user)
Required method. |
String |
getRealm(HttpServletRequest req)
Required method. |
boolean |
isAuthExpired(long age,
HttpServletRequest req)
Checks if the authorization is expired for the given request. |
| Methods inherited from class com.qindesign.servlet.AuthenticatedHttpServlet |
|---|
authorizedService, doUnauthorizedDelete, doUnauthorizedHead, doUnauthorizedOptions, doUnauthorizedPut, doUnauthorizedTrace, getDefaultScheme, getProperty, isSchemeAcceptable, service, service, unauthorizedService |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doOptions, doPut, doTrace, getLastModified |
| 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 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AuthExampleServlet()
| Method Detail |
|---|
public String getRealm(HttpServletRequest req)
getRealm in interface com.qindesign.snap.http.Authenticator.AuthorizergetRealm in class AuthenticatedHttpServletreq - the request
Authenticator.Authorizer
public String getPassword(String realm,
String user)
getPassword in interface com.qindesign.snap.http.Authenticator.AuthorizergetPassword in class AuthenticatedHttpServletrealm - the protection space, a case-insensitive valueuser - the username
public boolean isAuthExpired(long age,
HttpServletRequest req)
This is used by Digest authentication.
isAuthExpired in interface com.qindesign.snap.http.Authenticator.AuthorizerisAuthExpired in class AuthenticatedHttpServletage - the age, in ms, of the authorizationreq - the request
true if the age is greater than 20 seconds.
protected void doGet(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doGet in class HttpServletServletException
IOException
protected void doPost(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doGet.
doPost in class HttpServletServletException
IOException
protected void doUnauthorizedGet(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doUnauthorizedGet in class AuthenticatedHttpServletServletException
IOException
protected void doUnauthorizedPost(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
IOException
doUnauthorizedGet.
doUnauthorizedPost in class AuthenticatedHttpServletServletException
IOException
|
Tynamo™-SNAP v1.0.4 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||