Java Code Examples for org.osgl.http.H#Flash
The following examples show how to use
org.osgl.http.H#Flash .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SessionManager.java From actframework with Apache License 2.0 | 5 votes |
public H.Flash resolveFlash(H.Request request) { String encodedFlash = mapper.readFlash(request); if (null != encodedFlash) { H.Flash flash = codec.decodeFlash(encodedFlash); flash.discard(); return flash; } return new H.Flash(); }
Example 2
Source File: SessionManager.java From actframework with Apache License 2.0 | 5 votes |
public void dissolveState(H.Session session, H.Flash flash, H.Response response) { String encodedSession = codec.encodeSession(session); // flash could be null if precheck CSRF failed String encodedFlash = codec.encodeFlash(flash); long expiry = session.expiry(); if (expiry > 0) { mapper.writeExpiration(session.expiry(), response); } mapper.write(encodedSession, encodedFlash, response); }
Example 3
Source File: DefaultSessionCodec.java From actframework with Apache License 2.0 | 5 votes |
@Override public String encodeFlash(H.Flash flash) { if (null == flash || flash.isEmpty()) { return null; } return dissolveIntoCookieContent(flash.out(), false); }
Example 4
Source File: DefaultSessionCodec.java From actframework with Apache License 2.0 | 5 votes |
@Override public H.Flash decodeFlash(String encodedFlash) { H.Flash flash = new H.Flash(); if (S.notBlank(encodedFlash)) { resolveFromCookieContent(flash, encodedFlash, false); flash.discard(); // prevent cookie content from been output to response again } return flash; }
Example 5
Source File: JsonWebTokenSessionCodec.java From actframework with Apache License 2.0 | 5 votes |
@Override public String encodeFlash(H.Flash flash) { if (null == flash || flash.isEmpty()) { return null; } return populateToken(jwt.newToken(), flash).toString(jwt); }
Example 6
Source File: JsonWebTokenSessionCodec.java From actframework with Apache License 2.0 | 5 votes |
@Override public H.Flash decodeFlash(String encodedFlash) { H.Flash flash = new H.Flash(); if (S.notBlank(encodedFlash)) { resolveFromJwtToken(flash, encodedFlash, false); flash.discard(); // prevent cookie content from been output to response again } return flash; }
Example 7
Source File: HttpCurrentStateStore.java From actframework with Apache License 2.0 | 4 votes |
@Override public H.Flash flash() { ActionContext ctx = ActionContext.current(); return null == ctx ? null : ctx.flash(); }
Example 8
Source File: ActionContext.java From actframework with Apache License 2.0 | 4 votes |
public H.Flash flash() { return flash; }
Example 9
Source File: ActionContext.java From actframework with Apache License 2.0 | 4 votes |
public H.Flash flash(String key, String value) { return flash.put(key, value); }
Example 10
Source File: ActProviders.java From actframework with Apache License 2.0 | 4 votes |
@Override public H.Flash get() { return ActionContext.current().flash(); }
Example 11
Source File: SessionCodec.java From actframework with Apache License 2.0 | 2 votes |
/** * Encode a flash into a string * @param flash * @return */ String encodeFlash(H.Flash flash);
Example 12
Source File: SessionCodec.java From actframework with Apache License 2.0 | 2 votes |
/** * Decode a flash string into a flash. * * @param encodedFlash * the encoded flash string */ H.Flash decodeFlash(String encodedFlash);