public static final class H.Flash extends H.KV<H.Flash>
Like H.Session, you can store only String type
information to flash, and the total number of information stored
including keys and values shall not exceed 4096 bytes as flash is
persisted as cookie in browser
| Constructor and Description |
|---|
Flash() |
| Modifier and Type | Method and Description |
|---|---|
static H.Flash |
current()
Return a flash instance of the current execution context,
For example from a
ThreadLocal |
static void |
current(H.Flash flash)
Set a flash instance into the current execution context,
for example into a
ThreadLocal |
H.Flash |
discard()
Discard the whole output buffer of the flash but
the data buffer is remain untouched.
|
H.Flash |
discard(String key)
Discard a data from the output buffer of the flash but
the data buffer is remain untouched.
|
boolean |
equals(Object obj) |
String |
error()
Get the "error" message that has been added to
the flash scope.
|
H.Flash |
error(String message)
Add an "error" message to the flash scope
|
H.Flash |
error(String message,
Object... args)
Add an "error" message to the flash scope, with
optional format arguments
|
H.Flash |
keep()
Keep all data that has been
put
into the flash for one time. |
H.Flash |
keep(String key)
Keep a data that has been
put
into the flash for one time. |
H.Flash |
now(String key,
String value)
Add an attribute to the flash's current scope.
|
H.KV |
out() |
H.Flash |
put(String key,
Object value)
Add an attribute to the flash scope.
|
H.Flash |
put(String key,
String value)
Add an attribute to the flash scope.
|
static H.Flash |
resolve(H.Cookie flashCookie)
Resolve a Flash instance from a cookie.
|
H.Cookie |
serialize(String flashKey)
Serialize this Flash instance into a Cookie.
|
String |
success()
Get the "success" message that has been added to
the flash scope.
|
H.Flash |
success(String message)
Add a "success" message to the flash scope
|
H.Flash |
success(String message,
Object... args)
Add a "success" message to the flash scope, with
optional format arguments
|
public H.Flash put(String key, String value)
public H.Flash put(String key, Object value)
string
representation before put into the flashpublic H.Flash now(String key, String value)
key - the attribute keyvalue - the attribute valuepublic H.Flash error(String message)
message - the error messageput(String, Object)public H.Flash error(String message, Object... args)
message - the message templateargs - the format argumentspublic String error()
null if
no error message has been added to the flashpublic H.Flash success(String message)
message - the error messageput(String, Object)public H.Flash success(String message, Object... args)
message - the message templateargs - the format argumentspublic String success()
null if
no success message has been added to the flashpublic H.Flash discard(String key)
put(String, Object)
into the flash scope, however they will NOT
be write to the client cookie, thus the next
time client request the server, the app will
not be able to get the info anymorekey - the key to the data to be discardedpublic H.Flash discard()
put(String, Object)
into the flash scope, however they will NOT
be write to the client cookie, thus the next
time client request the server, the app will
not be able to get those info anymorepublic H.Flash keep(String key)
put
into the flash for one time. The data that has been kept
will be persistent to client cookie for one time, thus
the next time when user request the server, the app
can still get the data, but only for one time unless
the app call keep method againkey - the key to identify the data to be keptkeep()public H.Flash keep()
put
into the flash for one time. The data that has been kept
will be persistent to client cookie for one time, thus
the next time when user request the server, the app
can still get the data, but only for one time unless
the app call keep method againpublic H.KV out()
public static H.Flash current()
ThreadLocalpublic static void current(H.Flash flash)
ThreadLocalflash - the flash to be set to current execution contextpublic static H.Flash resolve(H.Cookie flashCookie)
null then an empty Flash instance is returnedflashCookie - the flash cookieserialize(String)public H.Cookie serialize(String flashKey)
flashKey - the cookie nameresolve(org.osgl.http.H.Cookie)Copyright © 2017. All Rights Reserved.