KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > core > event > ClientSideRedirectException


1 /*
2  * Copyright (C) 2003 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: ClientSideRedirectException.java,v 1.9 2004/02/01 05:16:27 christianc Exp $
19  */

20 package org.enhydra.barracuda.core.event;
21
22
23 /**
24  * This class defines a ClientSideRedirectException...throwing this will
25  * cause the ApplicationGateway to redirect the browser to the
26  * new Event.
27  */

28 public class ClientSideRedirectException extends EventException {
29
30     //private vars
31
private String JavaDoc url = null;
32
33     /**
34      * The public contructor for ClientSideRedirectException
35      *
36      * @param newEvent - the newEvent the client browser
37      * should be redirected to
38      */

39 //TODO - I don't think we should actually be using a BaseEvent here in the constructor,
40
//since by default the ApplicationGateway will only dispatch HttpRequestEvents - csc
41
public ClientSideRedirectException (BaseEvent newEvent) {
42 //csc_010404_1 setRedirectURL(newEvent.getEventIDWithExtension());
43
setRedirectURL(newEvent.getEventURL()); //csc_010404_1
44
}
45
46     /**
47      * The public contructor for ClientSideRedirectException
48      *
49      * @param iurl - the URL the client browser should be
50      * redirected to
51      */

52     public ClientSideRedirectException (String JavaDoc iurl) {
53         setRedirectURL(iurl);
54     }
55
56     /**
57      * Get the new event that triggered this interrupt
58      */

59     public String JavaDoc getRedirectURL() {
60         return url;
61     }
62
63     //csc_082302.2 - added
64
/**
65      * Set the Redirect URL (normally you don't need to
66      * do this since you simply pass the target URL into the
67      * constructor. If, howver, you find the need to modify a
68      * redirect after its already been created, you can do it
69      * through this method)
70      */

71     public void setRedirectURL(String JavaDoc iurl) {
72         url = iurl;
73     }
74
75     public String JavaDoc toString() {
76         return this.getClass().getName()+"(url="+url+")";
77     }
78 }
79
Popular Tags