PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks-acceptance-tests/src/main/java/com/google/sitebricks/example/PageChain.java

http://github.com/dhanji/sitebricks
Java | 26 lines | 13 code | 5 blank | 8 comment | 0 complexity | 919923124e3c1c6fa18e01edf62f39a8 MD5 | raw file
 1package com.google.sitebricks.example;
 2
 3import com.google.sitebricks.At;
 4import com.google.sitebricks.http.Post;
 5
 6/**
 7 * Demonstrates passing state between pages, without
 8 * leaking it to the client or using a persistent datastore.
 9 *
10 * @author dhanji@google.com (Dhanji R. Prasanna)
11 */
12@At("/pagechain")
13public class PageChain {
14  private String userValue;
15
16  @Post NextPage redirect() {
17
18    // Redirect to nextpage and use this provided instance,
19    // that way we pass the custom value thru.
20    return new NextPage(userValue);
21  }
22
23  public void setUserValue(String userValue) {
24    this.userValue = userValue;
25  }
26}