@Path(value="/") @Consumes(value={"application/json","application/text","text/html","application/x-www-form-urlencoded"}) @Produces(value="application/json;charset=utf-8") public class ServletAnyUserUpdateService<U extends User,E> extends AbstractAnyUserUpdateService<U,E,javax.servlet.http.HttpSession>
User
(Logged in or Guest) supports generic user related methods.
See SecurableService.query(String, Object)
and query(String, String, String, String)
.
<script type="text/javascript" src="js/useraction.min.js"></script>
<script type="text/javascript">
var pingUrl = getBaseUrl(window.location.href) + (typeof SITE_CONTEXT!='undefined'?SITE_CONTEXT:'') + '/services/anyuser/ping';
var ua = new onUserAction(10, function() {$.get(pingUrl+'?action='+window.location.pathname);});
Modifier and Type | Field and Description |
---|---|
protected Map<String,SoftReference<Map>> |
userActivity |
applicationContext, CACHE, NO_CACHE, request, response
Constructor and Description |
---|
ServletAnyUserUpdateService() |
ServletAnyUserUpdateService(boolean checkAuthFiltered) |
Modifier and Type | Method and Description |
---|---|
protected javax.servlet.http.HttpSession |
getSession() |
protected UserSessionAdapter<?,javax.servlet.http.HttpSession,U> |
getUserSessionAdapter() |
void |
ping(String action)
A way the User-Agent / Browser can let the server know the user is active and update its last active state
|
Object |
query(String contextNameId,
String actionId,
String json,
String jsonBody)
Example: http://host/services/anyuser/userAction/all/contactUs?p={'fname':'xxxx','lname':'yyyy'...} http://host/services/anyuser/userAction/all/contactUs?p={'fname':'xxxx','lname':'yyyy'...} Note: This method supports JSON data as a query param and a form param. |
Object |
queryWithinContext(String contextNameId,
String actionId,
String json,
String jsonBody)
Same as
AbstractAnyUserUpdateService.query(String, String, String, String) except that in addition to the Query, the user object is passed automatically
in session to the Array or Map of parameters. |
void |
setUserSessionAdapter(UserSessionAdapter<?,javax.servlet.http.HttpSession,U> userSessionAdapter) |
cleanRedundantSessions, getUserActivityMap, setPingUserData
checkAuthFilterInvoked, filter, query
filter, getCacheDef, getTestString, query
protected Map<String,SoftReference<Map>> userActivity
public ServletAnyUserUpdateService()
public ServletAnyUserUpdateService(boolean checkAuthFiltered)
@GET @Path(value="ping") @Consumes(value="text/plain") @Produces(value="text/plain") public void ping(@QueryParam(value="action") String action) throws Exception
@POST @Path(value="userAction/{contextNameId}/{actionId}") @Produces(value="application/json") public Object query(@PathParam(value="contextNameId") String contextNameId, @PathParam(value="actionId") String actionId, @QueryParam(value="p") String json, @FormParam(value="f") String jsonBody) throws Exception
query
in class AbstractAnyUserUpdateService<U extends User,E,javax.servlet.http.HttpSession>
contextNameId
- as String; a classification for the manner in which the Query is called. Can allow for better and custom security or context or SEO related aspects.actionId
- as String (should match a Spring Transformer bean id that accepts an Object array as params)p
- as Query Param JSON Object String that is converted into a Map or Array of variables @nullable truef
- as Form Param JSON Object String that is converted into a Map or Array of variables @nullable trueException
@POST @Path(value="userContextAction/{contextNameId}/{actionId}") @Produces(value="application/json") public Object queryWithinContext(@PathParam(value="contextNameId") String contextNameId, @PathParam(value="actionId") String actionId, @QueryParam(value="p") String json, @FormParam(value="f") String jsonBody) throws Exception
AbstractAnyUserUpdateService.query(String, String, String, String)
except that in addition to the Query, the user object is passed automatically
in session to the Array or Map of parameters. This method also adds a User
object as sessionUser in the Map or @ the end of the array orqueryWithinContext
in class AbstractAnyUserUpdateService<U extends User,E,javax.servlet.http.HttpSession>
contextNameId
- as String; a classification for the manner in which the Query is called. Can allow for better and custom security or context related aspects.actionId
- as String (should match a Spring Transformer bean id that accepts an Object array as params)Exception
protected UserSessionAdapter<?,javax.servlet.http.HttpSession,U> getUserSessionAdapter()
getUserSessionAdapter
in class AbstractAnyUserUpdateService<U extends User,E,javax.servlet.http.HttpSession>
public void setUserSessionAdapter(UserSessionAdapter<?,javax.servlet.http.HttpSession,U> userSessionAdapter)
protected javax.servlet.http.HttpSession getSession()
getSession
in class AbstractAnyUserUpdateService<U extends User,E,javax.servlet.http.HttpSession>
Copyright © 2018. All rights reserved.