01: /*
02: * Created on Dec 14, 2004
03: */
04: package uk.org.ponder.rsf.viewstate;
05:
06: /**
07: * A simple set of view parameters that defines no extra fields, and maps the
08: * viewID parameter onto the end of the servlet path.
09: *
10: * @author Antranig Basman (antranig@caret.cam.ac.uk)
11: *
12: */
13: public class SimpleViewParameters extends ViewParameters {
14: public SimpleViewParameters() {
15: }
16:
17: public SimpleViewParameters(String viewID) {
18: this .viewID = viewID;
19: }
20:
21: public void clearParams() {
22: }
23:
24: public void parsePathInfo(String pathinfo) {
25: // remove leading / which is specced to be there
26: viewID = pathinfo.substring(1);
27: }
28:
29: public String toPathInfo() {
30: if (viewID == null) {
31: throw new IllegalArgumentException("ViewParameters of "
32: + getClass() + " does not have a viewID set");
33: }
34: return "/" + viewID;
35: }
36:
37: public String getParseSpec() {
38: return ViewParameters.BASE_PARSE_SPEC;
39: }
40:
41: }
|