public abstract class AbstractJcmsAjaxContext
extends java.lang.Object
implements java.io.Serializable
package custom; public class MyAjaxClass extends com.jalios.jcms.AbstractJcmsAjaxContext { public String saySomething(String str) { if (isLogged) { return str + " " + loggedMember.getFriendlyName() + "!"; } return str + "!"; } }2. Instanciate your class using the jcmsContext variable available in the any jsp and register this new instance using JSON.
json_bridge.registerObject("MyAjaxClass", new MyAjaxClass(jcmsContext));3. Call your methods from javascript using JSON.
<script type="text/javascript"> function saySomething(str) { var msg; try { msg = JcmsJsContext.getJsonRPC().MyAjaxClass.saySomething(str); } catch(ex) { alert(I18N.glp('warn.json.sessiontimeout')); return; } alert(msg); } </script> <a href="#" onclick="saySomething('Hello'); return false;">Say Hello</a>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
baseUrl |
protected Caddy |
caddy |
protected Channel |
channel |
protected java.lang.String |
contextPath |
protected Category[] |
ctxCategories |
protected Category |
currentCategory |
protected boolean |
debug |
protected boolean |
isAdmin |
protected boolean |
isIE |
protected boolean |
isInFrontOffice |
protected boolean |
isLogged |
protected boolean |
isWindows |
protected Member |
loggedMember |
protected java.lang.String |
method |
protected java.util.Map<java.lang.String,java.lang.String[]> |
parameterMap |
protected PortalInterface |
portal |
protected Category |
portalCategory |
protected Publication |
pub |
protected java.lang.String |
resourcePath |
protected java.lang.String |
url |
protected java.lang.String |
userCountry |
protected java.lang.String |
userLang |
protected java.util.Locale |
userLocale |
protected Workspace |
workspace |
protected java.lang.String |
zone |
Modifier | Constructor and Description |
---|---|
protected |
AbstractJcmsAjaxContext()
Use this constructor when you need to override some values available
in JcmsJspContext by calling setters of this object but still want
to benefit from other values already available in the JcmsContext.
|
protected |
AbstractJcmsAjaxContext(JcmsJspContext ctxt)
Build a new JcmsAjaxContext based on information available in the JcmsJspContext.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkAccess(java.lang.String resource)
Check if the current member is authorized to access the specified resource.
|
boolean |
checkAccess(java.lang.String resource,
java.util.Map<java.lang.String,java.lang.Object> ctxt)
Check if the current member is authorized to access the specified resource.
|
boolean |
debug(java.lang.String key) |
java.lang.String |
deflate() |
java.lang.String |
getBaseUrl()
Retrieve the base URL of the initial request or any base URL that might have specified
using
setBaseUrl(String) . |
Caddy |
getCaddy()
Returns the caddy stored in current session.
|
java.lang.String |
getContextPath()
Retrieve the context path of the initial request or any context path that might have specified
using
setContextPath(String) . |
Category[] |
getCtxCategories()
Retrieve the contextual categories to used for refinement
|
Category |
getCurrentCategory()
Retrieve the current category, either the category available at the time of
the initial request or the one overrided by
setCurrentCategory(Category) |
Member |
getLoggedMember()
Retrieve the logged Member at the time of the initial request.
|
java.lang.String |
getMethod()
Retrieve the method of the initial request or any base URL that might have specified
using
setMethod(String) . |
java.util.Map<java.lang.String,java.lang.String[]> |
getParameterMap()
Retrieve the map of paramaters available for the original request or map path that
might have specified using
setParameterMap(Map) . |
PortalInterface |
getPortal()
Returns the stored portal interface for the given request
|
Category |
getPortalCategory()
Retrieve the portal category, either the category available at the time of
the initial request or the one overrided by
setPortalCategory(Category) |
Publication |
getPublication()
Returns the stored Publication for the given request
|
java.lang.String |
getResourcePath()
Retrieve the original request resource path or any resource path that
might have specified using
setResourcePath(String) . |
java.lang.String |
getUrl()
Retrieve the URL of the initial request or any URL that might have specified
using
setUrl(String) . |
java.lang.String |
getUserCountry()
Retrieve the country to use for localized features.
|
java.lang.String |
getUserLang()
Retrieve the language to use for localized message and localized features.
|
java.util.Locale |
getUserLocale()
Retrieve the Locale to use for localized message and localized features.
|
Workspace |
getWorkspace()
Retrieve the workspace, either the workspace available at the time of
the initial request or the one overrided by
setWorkspace(Workspace) |
java.lang.String |
getZone()
Return the zone status
|
java.lang.String |
glp(java.lang.String key,
java.lang.Object... params)
Resolve a language property in the current user language.
|
void |
inflate(java.lang.String data,
javax.servlet.http.HttpServletRequest request) |
boolean |
isAdmin()
Return the admin status of the logged user.
|
boolean |
isInFrontOffice()
Return the isInFrontOffice status
|
boolean |
isLogged()
Return the user logging status for the initial request.
|
protected void |
readObject(java.util.Map<java.lang.String,java.lang.Object> map,
javax.servlet.http.HttpServletRequest request) |
void |
setBaseUrl(java.lang.String baseUrl)
Sets the base URL.
|
void |
setContextPath(java.lang.String contextPath)
Sets the context path.
|
void |
setCtxCategories(Category[] ctxCategories)
Sets the contextual categories used for refinement.
|
void |
setCurrentCategory(Category currentCategory)
Set the current category.
|
void |
setJcmsContext(JcmsJspContext jcmsContext)
Sets the following values from values found in the specified JcmsJspContext.
|
void |
setLoggedMember(Member loggedMember)
Sets the logged member.
|
void |
setMethod(java.lang.String method)
Sets the method.
|
void |
setParameterMap(java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
Sets the request parameter Map.
|
void |
setPortal(PortalInterface portal)
Set the portal interface for the given request
|
void |
setPortalCategory(Category portalCategory)
Set the portal category.
|
void |
setPublication(Publication pub)
Set the Publication for the given request
|
void |
setResourcePath(java.lang.String resourcePath)
Sets the resource path.
|
void |
setUrl(java.lang.String url)
Sets the URL.
|
void |
setUserCountry(java.lang.String userCountry)
Sets the user country.
|
void |
setUserLang(java.lang.String userLang)
Sets the user lang.
|
void |
setUserLocale(java.util.Locale userLocale)
Sets the user Locale.
|
void |
setWorkspace(Workspace workspace)
Sets the workspace.
|
protected void |
writeObject(java.util.Map<java.lang.String,java.lang.Object> map) |
protected transient Channel channel
protected transient boolean debug
protected transient Member loggedMember
protected transient java.lang.String userLang
protected transient java.lang.String userCountry
protected transient java.util.Locale userLocale
protected transient boolean isLogged
protected transient boolean isAdmin
protected transient Workspace workspace
protected transient Category currentCategory
protected transient Category portalCategory
protected transient Category[] ctxCategories
protected transient java.lang.String zone
protected transient boolean isInFrontOffice
protected transient Caddy caddy
protected transient PortalInterface portal
protected transient Publication pub
protected transient java.lang.String url
protected transient java.lang.String baseUrl
protected transient java.lang.String contextPath
protected transient java.lang.String resourcePath
protected transient java.util.Map<java.lang.String,java.lang.String[]> parameterMap
protected transient java.lang.String method
protected transient boolean isWindows
protected transient boolean isIE
protected AbstractJcmsAjaxContext()
setJcmsContext(JcmsJspContext)
after.protected AbstractJcmsAjaxContext(JcmsJspContext ctxt)
ctxt
- the JcmsJspContext available in the first "standard" request
prior to calling AJAX methods.public final void setLoggedMember(Member loggedMember)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.loggedMember
- the Logged MembersetJcmsContext(JcmsJspContext)
public final Member getLoggedMember()
public final void setUserLang(java.lang.String userLang)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.userLang
- the user langsetJcmsContext(JcmsJspContext)
public final java.lang.String getUserLang()
public final void setUserCountry(java.lang.String userCountry)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.userCountry
- the user countrysetJcmsContext(JcmsJspContext)
public final java.lang.String getUserCountry()
public final void setUserLocale(java.util.Locale userLocale)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.userLocale
- the user LocalesetJcmsContext(JcmsJspContext)
public final java.util.Locale getUserLocale()
public boolean isLogged()
public boolean isAdmin()
public boolean isInFrontOffice()
public java.lang.String getZone()
public final void setWorkspace(Workspace workspace)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.workspace
- the workspacesetJcmsContext(JcmsJspContext)
public final Workspace getWorkspace()
setWorkspace(Workspace)
public void setCurrentCategory(Category currentCategory)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.currentCategory
- Categorypublic Category getCurrentCategory()
setCurrentCategory(Category)
public void setPortalCategory(Category portalCategory)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.portalCategory
- Categorypublic Category getPortalCategory()
setPortalCategory(Category)
public final void setCtxCategories(Category[] ctxCategories)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.ctxCategories
- Category[] of contextual categoriessetJcmsContext(JcmsJspContext)
public final Category[] getCtxCategories()
public Caddy getCaddy()
public PortalInterface getPortal()
public void setPortal(PortalInterface portal)
portal
- public Publication getPublication()
public void setPublication(Publication pub)
pub
- public final void setUrl(java.lang.String url)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.url
- the full URL of the page accessed initiallysetJcmsContext(JcmsJspContext)
public final java.lang.String getUrl()
setUrl(String)
.public final void setBaseUrl(java.lang.String baseUrl)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.baseUrl
- the base URL of the page accessed initiallysetJcmsContext(JcmsJspContext)
public final java.lang.String getBaseUrl()
setBaseUrl(String)
.public final void setMethod(java.lang.String method)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.method
- the method of the page accessed initiallysetJcmsContext(JcmsJspContext)
public final java.lang.String getMethod()
setMethod(String)
.public final void setContextPath(java.lang.String contextPath)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.contextPath
- the base URL of the page accessed initiallysetJcmsContext(JcmsJspContext)
public final java.lang.String getContextPath()
setContextPath(String)
.public final void setResourcePath(java.lang.String resourcePath)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.resourcePath
- the resource pathsetJcmsContext(JcmsJspContext)
public final java.lang.String getResourcePath()
setResourcePath(String)
.ServletUtil.getResourcePath(HttpServletRequest)
public final void setParameterMap(java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
setJcmsContext(JcmsJspContext)
, its
value won't be overiden by values retrieved from the JcmsJspContext.parameterMap
- a Map containing parameter names as keys and parameter values as map values.
This map will be cloned to make sure any modification does not impact your original map and vice versa.setJcmsContext(JcmsJspContext)
public final java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
setParameterMap(Map)
.public void setJcmsContext(JcmsJspContext jcmsContext)
jcmsContext
- the JcmsJspContextpublic java.lang.String deflate()
public void inflate(java.lang.String data, javax.servlet.http.HttpServletRequest request)
protected void writeObject(java.util.Map<java.lang.String,java.lang.Object> map)
protected void readObject(java.util.Map<java.lang.String,java.lang.Object> map, javax.servlet.http.HttpServletRequest request)
public java.lang.String glp(java.lang.String key, java.lang.Object... params)
key
- the language property to resolve, for example "ui.com.lbl.contents"params
- the parameters to use when resolving the format of the given propertypublic boolean checkAccess(java.lang.String resource)
boolean isAuthorized = checkAccess(loggedMember, "admin/dev/store-cleaner");
resource
- a resource URI using a path representation, eg "admin/dev/store-cleaner"public boolean checkAccess(java.lang.String resource, java.util.Map<java.lang.String,java.lang.Object> ctxt)
boolean isAuthorized = checkAccess(loggedMember, "admin-ws/types/content", ctxtMap);
resource
- a resource URI using a path representation, eg "admin/dev/store-cleaner"ctxt
- an optionnal context mappublic boolean debug(java.lang.String key)
Copyright © 2001-2010 Jalios SA. All Rights Reserved.