KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > environment > mock > MockRedirector


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.environment.mock;
17
18 import org.apache.cocoon.ProcessingException;
19 import java.io.IOException JavaDoc;
20
21 import org.apache.cocoon.environment.Redirector;
22
23 public class MockRedirector implements Redirector {
24
25     protected boolean hasRedirected = false;
26
27     private String JavaDoc redirect;
28
29     public void redirect(boolean sessionmode, String JavaDoc url) throws IOException JavaDoc, ProcessingException {
30         this.hasRedirected = true;
31
32         redirect = url;
33     }
34   
35     public void globalRedirect(boolean sessionmode, String JavaDoc url) throws IOException JavaDoc, ProcessingException {
36         redirect(sessionmode, url);
37     }
38
39     public String JavaDoc getRedirect() {
40         return redirect;
41     }
42     
43     public boolean hasRedirected() {
44         return this.hasRedirected;
45     }
46
47     public void reset() {
48         redirect = null;
49         hasRedirected = false;
50     }
51     
52     public void sendStatus(int sc) {
53         hasRedirected = true;
54     }
55 }
56
57
Popular Tags