public class DisplayState extends Object implements Serializable
Chips. Note: Event values are not encoded and therfore special characters can be stored
to the database. This enables malicious code to be stored and later executed. For enabling encoding for a special
event, the event id must start with Chip.FILTERED_PREFIX.| Modifier and Type | Field and Description |
|---|---|
static String |
COMMAND_EVENT |
static String |
COMMAND_PREFIX |
static char |
DELIMITER |
static String |
EVENT_EVENT |
static int |
MAX_ITEM_HISTORY |
static String |
RESOURCE_BASENAME |
Map<String,Chip> |
theChips |
static String |
TRANSLATION_CHIPID |
static String |
TRANSLATION_REALID |
static String |
TRANSLATION_REALVALUE |
static String |
TRANSLATION_TRANSLATEDID |
static String |
TRANSLATION_TRANSLATEDVALUE |
| Modifier | Constructor and Description |
|---|---|
protected |
DisplayState(HttpSession session,
MasterServlet masterServlet,
JaloSession jaloSession,
String remoteHost,
String remoteUser)
Creates a new DisplayState which does not have a predecessor.
|
protected |
DisplayState(HttpSession session,
MasterServlet masterServlet,
JaloSession jaloSession,
String prefix,
String remoteHost,
String remoteUser)
Creates a new DisplayState which does not have a predecessor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorMessage(String error)
Posts error messages to the error handler Usually these error messages will be displayed as popup windows.
|
void |
addExtraParamHandler(ExtraParamHandler handler) |
void |
addInfoMessage(String info)
Posts info messages to the error handler Usually these info messages will be displayed as popup windows.
|
void |
addItemCreationListener(ItemCreationListener listener)
Adds an
ItemCreationListener to this DisplayState (=session) which will be notified whenever an Item of a
certain (sub-)type is created. |
void |
addItemToHistory(Item item) |
void |
addLanguageChangeListener(LanguageChangeListener listener) |
void |
addLanguageCreationListener(LanguageCreationListener listener) |
protected void |
addWindowEvent(WindowEvent event)
Posts WindowEvents to the handler
|
void |
clearErrorMessages()
Removes all error messages.
|
void |
clearInfoMessages()
Removes all info messages.
|
protected void |
discard() |
void |
dispose()
called when this state is unbound from its http session.
|
static String |
encodeHTML(String input)
Deprecated.
since 2.0. use de.hybris.platform.util.Utilities#escapeHTML( String ) instead.
|
boolean |
errorQueueEmpty() |
void |
extractEventsFromParameters(Map<String,String[]> requestParameters,
boolean prgRequest)
Extracts all webchip events from the request parameters and adds them to the event map of the corresponding
webchip.
|
Object |
getAttribute(String key)
Returns the attribute for the given key or null.
|
Chip |
getChip(String id)
Returns the chip with the given id.
|
String |
getChipPrefix() |
Object |
getClipboard()
Gets an Object from the WebChips-clipboard
|
static DisplayState |
getCurrent() |
Window |
getDefaultWindow()
Creates a default window.
|
List |
getErrorMessages()
Returns a list of all error messages.
|
protected Frame |
getFrame(String id)
Returns a Frame with the given id.
|
List<String> |
getInfoMessages()
Returns a list of all info messages.
|
protected List<WeakReference<ItemCreationListener>> |
getItemCreationListeners()
|
List<Item> |
getItemHistory() |
JaloSession |
getJaloSession() |
protected List<WeakReference<LanguageChangeListener>> |
getLanguageChangeListeners() |
protected List<WeakReference<LanguageCreationListener>> |
getLanguageCreationListeners() |
Locale |
getLocale() |
String |
getLocalizedString(String strKey)
Returns a localized string for the given key or the key itself if no localized string were found.
|
String |
getLocalizedString(String strKey,
Object[] arguments)
Returns a localized string for the given key or the key itself if no localized string were found.
|
protected String |
getLocalizedStringInternal(String key) |
String |
getRemoteHost() |
String |
getRemoteUser() |
HttpServletRequest |
getRequest()
Returns the current
HttpServletRequest, if called during event processing. |
HttpServletResponse |
getResponse()
Returns the current
HttpServletResponse, if called during event processing. |
Map<String,List<String>> |
getUnparseableParameters()
Returns the parameters from the last request which could not be parsed (outside parameters)
|
protected Window |
getWindow(String chipID)
Returns a Window with the given id.
|
List<WindowEvent> |
getWindowEvents()
Returns a list of all WindowEvents.
|
protected void |
handleUnparseableParameters()
Calls handleExtraParams() on all registered ExtraParamHandlers with the current map of unparseable parameters.
|
void |
notifyItemCreation(ItemCreationEvent event)
|
void |
notifyLanguageChange(LanguageChangeEvent event) |
void |
notifyLanguageCreation(LanguageCreationEvent event) |
protected void |
processEvents(HttpServletRequest request,
boolean prgRequest)
Process all those Events in the request which can be recognized as valid
|
String |
register(Chip aChip)
Creates a unique id and registers it for events
|
String |
registerChipName(String proposedName,
Chip chip) |
void |
removeInfoMessage(int pos) |
protected void |
render(String windowID,
HttpServletRequest request,
HttpServletResponse response)
Renders the content of the Window with the given id.
|
void |
setAttribute(String key,
Object value)
Sets an attribute which is visible in this session only.
|
void |
setClipboard(Object object)
Puts an Object into the WebChips-clipboard.
|
static void |
setCurrent(DisplayState state) |
static void |
unsetCurrent() |
public static final String COMMAND_PREFIX
public static final char DELIMITER
public static final String TRANSLATION_CHIPID
public static final String TRANSLATION_REALID
public static final String TRANSLATION_TRANSLATEDID
public static final String TRANSLATION_REALVALUE
public static final String TRANSLATION_TRANSLATEDVALUE
public static final String EVENT_EVENT
public static final String COMMAND_EVENT
public static final String RESOURCE_BASENAME
public static final int MAX_ITEM_HISTORY
protected DisplayState(HttpSession session,
MasterServlet masterServlet,
JaloSession jaloSession,
String prefix,
String remoteHost,
String remoteUser)
prefix - the prefix of chip idsprotected DisplayState(HttpSession session,
MasterServlet masterServlet,
JaloSession jaloSession,
String remoteHost,
String remoteUser)
public static final void setCurrent(DisplayState state)
public static final DisplayState getCurrent()
public static final void unsetCurrent()
public void dispose()
public JaloSession getJaloSession()
protected final Window getWindow(String chipID)
protected void discard()
protected final void render(String windowID, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
ServletExceptionIOExceptionprotected void processEvents(HttpServletRequest request,
boolean prgRequest)
public final void extractEventsFromParameters(Map<String,String[]> requestParameters, boolean prgRequest)
requestParameters - the requestParameterspublic void setClipboard(Object object)
AbstractChip.setClipboard(Object)public Object getClipboard()
AbstractChip.getClipboard()public void addErrorMessage(String error)
AbstractChip.postErrorMessage(String)public void addInfoMessage(String info)
AbstractChip.postInfoMessage(String)public void removeInfoMessage(int pos)
throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionprotected void addWindowEvent(WindowEvent event)
public List getErrorMessages()
public boolean errorQueueEmpty()
true if at least one error message existspublic void clearErrorMessages()
public void clearInfoMessages()
public List<WindowEvent> getWindowEvents()
public String getLocalizedString(String strKey, Object[] arguments)
The localized string will be processed by MessageFormat using given arguments.
strKey - the key to get a localized representation for.arguments - the argumentspublic String getLocalizedString(String strKey)
strKey - the key to get a localized representation for.public String getChipPrefix()
public String register(Chip aChip)
public Object getAttribute(String key)
public void setAttribute(String key, Object value)
@Deprecated public static String encodeHTML(String input)
public Locale getLocale()
public Map<String,List<String>> getUnparseableParameters()
public String getRemoteHost()
public String getRemoteUser()
protected void handleUnparseableParameters()
public void addExtraParamHandler(ExtraParamHandler handler)
public void addLanguageChangeListener(LanguageChangeListener listener)
protected List<WeakReference<LanguageChangeListener>> getLanguageChangeListeners()
public void notifyLanguageChange(LanguageChangeEvent event)
public void addLanguageCreationListener(LanguageCreationListener listener)
protected List<WeakReference<LanguageCreationListener>> getLanguageCreationListeners()
public void notifyLanguageCreation(LanguageCreationEvent event)
public void addItemCreationListener(ItemCreationListener listener)
ItemCreationListener to this DisplayState (=session) which will be notified whenever an Item of a
certain (sub-)type is created. The ItemCreationListener can provide a ComposedType via
ItemCreationListener.getListeningType(). If this method returns null the listener will be notified of all
item creations. If it, for example, returns the ComposedType 'Product' the listener will be notified whenever a
new Product or any item which is a subtype of Product is created.protected List<WeakReference<ItemCreationListener>> getItemCreationListeners()
public void notifyItemCreation(ItemCreationEvent event)
public HttpServletRequest getRequest()
HttpServletRequest, if called during event processing. Otherwise null is
returned.HttpServletRequest, if called during event processing. Otherwise null is returnedpublic HttpServletResponse getResponse()
HttpServletResponse, if called during event processing. Otherwise null is
returned.HttpServletResponse, if called during event processing. Otherwise null is
returnedpublic void addItemToHistory(Item item)
public Window getDefaultWindow()
Copyright © 2017 SAP SE. All Rights Reserved.