1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package org.objectledge.web.mvc;
30
31 import org.objectledge.context.Context;
32
33 /***
34 * The web context contains all needed information about mvc processing parameters.
35 *
36 * @author <a href="mailto:pablo@caltha.pl">Pawel Potempski</a>
37 * @author <a href="mailto:dgajda@caltha.pl">Damian Gajda</a>
38 * @version $Id: MVCContext.java,v 1.12 2005/05/06 09:31:13 rafal Exp $
39 */
40 public class MVCContext
41 {
42 /***
43 * Usefull method to retrieve http context from context.
44 *
45 * @param context the context.
46 * @return the http context.
47 */
48 public static MVCContext getMVCContext(Context context)
49 {
50 return (MVCContext)context.getAttribute(MVCContext.class);
51 }
52
53 /*** request parameters used to override params. */
54
55
56 /*** the action parameter. */
57 private String action;
58
59 /*** the view parameter. */
60 private String view;
61
62 /*** the view build result */
63 private String buildResult;
64
65 /*** the current processing stage. */
66 private ProcessingStage stage = ProcessingStage.PROCESSING;
67
68 /***
69 * Construct new pipeline context.
70 */
71 public MVCContext()
72 {
73
74
75
76
77 }
78
79 /***
80 * Returns the action paremeter.
81 *
82 * @return the value of action parameter.
83 */
84 public String getAction()
85 {
86 return action;
87 }
88
89 /***
90 * Sets the action parameter.
91 *
92 * @param action the action parameter.
93 */
94 public void setAction(String action)
95 {
96 this.action = action;
97 }
98
99 /***
100 * Returns the view paremeter.
101 *
102 * @return the value of view parameter.
103 */
104 public String getView()
105 {
106 return view;
107 }
108
109 /***
110 * Sets the view parameter.
111 *
112 * @param view the view parameter.
113 */
114 public void setView(String view)
115 {
116 this.view = view;
117 }
118
119 /***
120 * Gets the result of building the view part of MVC pipeline.
121 *
122 * @return the result of building the MVC view
123 */
124 public String getBuildResult()
125 {
126 return buildResult;
127 }
128
129 /***
130 * Sets the result of building the view part of MVC pipeline.
131 *
132 * @param buildResult a string representing built view which should be sent to the browser
133 */
134 public void setBuildResult(String buildResult)
135 {
136 this.buildResult = buildResult;
137 }
138
139 /***
140 * Returns the processing stage.
141 *
142 * @return the stage.
143 */
144 public ProcessingStage getStage()
145 {
146 return stage;
147 }
148
149 /***
150 * Sets the processing stage.
151 *
152 * @param stage The stage to set.
153 */
154 public void setStage(ProcessingStage stage)
155 {
156 this.stage = stage;
157 }
158 }