2121import javax .servlet .ServletResponse ;
2222
2323import org .ocpsoft .rewrite .context .Context ;
24+ import org .ocpsoft .rewrite .event .Flow ;
2425import org .ocpsoft .rewrite .exception .RewriteException ;
2526import org .ocpsoft .rewrite .servlet .RewriteLifecycleContext ;
2627
@@ -42,7 +43,7 @@ public abstract class BaseRewrite<IN extends ServletRequest, OUT extends Servlet
4243 public BaseRewrite (final IN request , final OUT response , final ServletContext servletContext )
4344 {
4445 this .servletContext = servletContext ;
45- flow = Flow .UN_HANDLED ;
46+ flow = ServletRewriteFlow .UN_HANDLED ;
4647 this .request = request ;
4748 this .response = response ;
4849 }
@@ -57,7 +58,7 @@ public BaseRewrite(final IN request, final OUT response, final ServletContext se
5758 */
5859 public void abort ()
5960 {
60- this .flow = Flow .ABORT_REQUEST ;
61+ this .flow = ServletRewriteFlow .ABORT_REQUEST ;
6162 }
6263
6364 /**
@@ -67,7 +68,7 @@ public void abort()
6768 */
6869 public void proceed ()
6970 {
70- this .flow = Flow .PROCEED ;
71+ this .flow = ServletRewriteFlow .PROCEED ;
7172 }
7273
7374 /**
@@ -77,7 +78,7 @@ public void proceed()
7778 */
7879 public void handled ()
7980 {
80- this .flow = Flow .HANDLED ;
81+ this .flow = ServletRewriteFlow .HANDLED ;
8182 }
8283
8384 /**
@@ -87,7 +88,7 @@ public void handled()
8788 public void include (final String resource )
8889 {
8990 this .dispatchResource = resource ;
90- this .flow = Flow .INCLUDE ;
91+ this .flow = ServletRewriteFlow .INCLUDE ;
9192 }
9293
9394 /**
@@ -97,24 +98,24 @@ public void include(final String resource)
9798 public void forward (final String resource )
9899 {
99100 this .dispatchResource = resource ;
100- this .flow = Flow .FORWARD ;
101+ this .flow = ServletRewriteFlow .FORWARD ;
101102 }
102103
103104 /*
104105 * Getters
105106 */
106107 /**
107- * Get the current {@link Flow } state.
108+ * Get the current {@link ServletRewriteFlow } state.
108109 */
109110 public Flow getFlow ()
110111 {
111112 return flow ;
112113 }
113114
114115 /**
115- * Set the current {@link Flow } state.
116+ * Set the current {@link ServletRewriteFlow } state.
116117 */
117- public void setFlow (final Flow flow )
118+ public void setFlow (final ServletRewriteFlow flow )
118119 {
119120 this .flow = flow ;
120121 }
@@ -171,7 +172,7 @@ public void setResponse(final OUT response)
171172 /**
172173 * Enum to represent the finite state of the Rewrite container.
173174 */
174- public enum Flow
175+ public enum ServletRewriteFlow implements Flow
175176 {
176177 UN_HANDLED (null ),
177178 HANDLED (null ),
@@ -186,24 +187,24 @@ public enum Flow
186187 REDIRECT_TEMPORARY (ABORT_REQUEST ),
187188 REDIRECT_PERMANENT (ABORT_REQUEST );
188189
189- private Flow parent ;
190+ private ServletRewriteFlow parent ;
190191
191- private Flow (final Flow flow )
192+ private ServletRewriteFlow (final ServletRewriteFlow flow )
192193 {
193194 this .parent = flow ;
194195 }
195196
196197 /**
197- * Return true if this {@link Flow } is a descendant of the given value.
198+ * Return true if this {@link ServletRewriteFlow } is a descendant of the given value.
198199 */
199- public boolean is (final Flow other )
200+ public boolean is (final ServletRewriteFlow other )
200201 {
201202 if (other == null )
202203 {
203204 return false ;
204205 }
205206
206- Flow t = this ;
207+ ServletRewriteFlow t = this ;
207208 while (t != null )
208209 {
209210 if (other == t )
@@ -216,16 +217,16 @@ public boolean is(final Flow other)
216217 }
217218
218219 /**
219- * Return true if the given {@link Flow } is a descendant of <code>this</code>.
220+ * Return true if the given {@link ServletRewriteFlow } is a descendant of <code>this</code>.
220221 */
221- public boolean contains (final Flow other )
222+ public boolean contains (final ServletRewriteFlow other )
222223 {
223224 if (other == null )
224225 {
225226 return false ;
226227 }
227228
228- Flow t = other ;
229+ ServletRewriteFlow t = other ;
229230 while (t != null )
230231 {
231232 if (this == t )
@@ -236,6 +237,20 @@ public boolean contains(final Flow other)
236237 }
237238 return false ;
238239 }
240+
241+ @ Override
242+ public boolean isHandled ()
243+ {
244+ return is (HANDLED );
245+ }
246+
247+ @ Override
248+ public boolean is (Flow flow )
249+ {
250+ if (flow instanceof ServletRewriteFlow )
251+ return is ((ServletRewriteFlow ) flow );
252+ return false ;
253+ }
239254 }
240255
241256 @ Override
0 commit comments