org.primefaces.context
Class RequestContext

java.lang.Object
  extended by org.primefaces.context.RequestContext
Direct Known Subclasses:
DefaultRequestContext

public abstract class RequestContext
extends Object

A RequestContext is a helper class consisting of several utilities. RequestContext is thread-safe and scope is same as FacesContext. Current instance can be retrieved as;

RequestContext.getCurrentInstance();


Constructor Summary
RequestContext()
           
 
Method Summary
abstract  void addCallbackParam(String name, Object value)
          Add a parameter for ajax oncomplete client side callbacks.
abstract  void execute(String script)
          Execute a javascript after current ajax request is completed.
abstract  Map<String,Object> getCallbackParams()
           
static RequestContext getCurrentInstance()
           
abstract  List<String> getScriptsToExecute()
           
abstract  boolean isAjaxRequest()
           
abstract  void reset(Collection<String> ids)
          Reset a collection of editableValueHolders.
abstract  void reset(String id)
          Reset an editableValueHolder.
abstract  void scrollTo(String clientId)
          Scroll to a component after ajax request is completed.
abstract  void update(Collection<String> collection)
          Update components with ajax.
abstract  void update(String name)
          Update a component with ajax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestContext

public RequestContext()
Method Detail

getCurrentInstance

public static RequestContext getCurrentInstance()
Returns:
Current RequestRequest instance in thread-local.

isAjaxRequest

public abstract boolean isAjaxRequest()
Returns:
true if request is an ajax request, otherwise return false.

addCallbackParam

public abstract void addCallbackParam(String name,
                                      Object value)
Add a parameter for ajax oncomplete client side callbacks. Value would be serialized to json.

Parameters:
name - name of the parameter.
object - value of the parameter.

getCallbackParams

public abstract Map<String,Object> getCallbackParams()
Returns:
all callback parameters added in the current request.

getScriptsToExecute

public abstract List<String> getScriptsToExecute()
Returns:
all scripts added in the current request.

execute

public abstract void execute(String script)
Execute a javascript after current ajax request is completed.

Parameters:
script - Javascript statement to execute.

scrollTo

public abstract void scrollTo(String clientId)
Scroll to a component after ajax request is completed.

Parameters:
clientId - Client side identifier of the component.

update

public abstract void update(String name)
Update a component with ajax.

Parameters:
name - Client side identifier of the component.

update

public abstract void update(Collection<String> collection)
Update components with ajax.

Parameters:
collection - Client side identifiers of the components.

reset

public abstract void reset(String id)
Reset an editableValueHolder.

Parameters:
id - Client side identifier of the component.

reset

public abstract void reset(Collection<String> ids)
Reset a collection of editableValueHolders.

Parameters:
ids - Client side identifiers of the components.


Copyright © 2012. All Rights Reserved.