/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

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