Skip to content

Commit

Permalink
Replaced session-based page stack persistence with cookiepack-based.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Jul 6, 2015
1 parent bc90fff commit ba88972
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rapidoid-http/src/main/java/org/rapidoid/http/PageStack.java
Expand Up @@ -31,11 +31,11 @@
@Since("3.1.0") @Since("3.1.0")
public class PageStack { public class PageStack {


public static final String SESSION_PAGE_STACK = "_page_stack_"; public static final String ATTR_PAGE_STACK = "_page_stack_";


public static HttpSuccessException goBack(HttpExchangeImpl x, int steps) { public static HttpSuccessException goBack(HttpExchangeImpl x, int steps) {
String dest = "/"; String dest = "/";
List<String> stack = x.session(SESSION_PAGE_STACK, null); List<String> stack = x.cookiepack(ATTR_PAGE_STACK, null);


if (stack != null) { if (stack != null) {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
Expand All @@ -57,7 +57,7 @@ public static HttpSuccessException goBack(HttpExchangeImpl x, int steps) {


@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void addToPageStack(HttpExchangeImpl x) { public static void addToPageStack(HttpExchangeImpl x) {
List<String> stack = x.sessionGetOrCreate(SESSION_PAGE_STACK, ArrayList.class); List<String> stack = x.cookiepackGetOrCreate(ATTR_PAGE_STACK, ArrayList.class);


String last = !stack.isEmpty() ? stack.get(stack.size() - 1) : null; String last = !stack.isEmpty() ? stack.get(stack.size() - 1) : null;
String current = x.uri(); String current = x.uri();
Expand Down
3 changes: 2 additions & 1 deletion rapidoid-pages/src/main/java/org/rapidoid/pages/Pages.java
Expand Up @@ -197,9 +197,10 @@ public static Object serve(HttpExchange x, Object view) {
load(x, view); load(x, view);
store(x, view); store(x, view);


x.addToPageStack();

Object result = render(x, view); Object result = render(x, view);


x.addToPageStack();
store(x, view); store(x, view);


return result; return result;
Expand Down

0 comments on commit ba88972

Please sign in to comment.