KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > webforwards > WebForward


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.webforwards;
21
22 import com.sslexplorer.policyframework.LaunchSession;
23 import com.sslexplorer.policyframework.Resource;
24 import com.sslexplorer.replacementproxy.Replacement;
25
26 /**
27  * <p>
28  * Interface that encapsulates a single web destination that may be accessed
29  * using SSL-Explorers <strong>Web Forwarding </strong> feature.
30  *
31  * <p>
32  * Currently, 3 different types of web forward are supported.
33  * {@link #TYPE_TUNNELED_SITE},{@link #TYPE_REPLACEMENT_PROXY},
34  * {@link #TYPE_PATH_BASED_REVERSE_PROXY} or {@link #TYPE_HOST_BASED_REVERSE_PROXY}.
35  *
36  * <p>
37  * Instances are provided by the {@link com.sslexplorer.security.SystemDatabase}
38  * implementation in use.
39  *
40  * @author Brett Smith
41  */

42 public interface WebForward extends Resource {
43
44     /**
45      * <p>
46      * A <i>Tunneled site </i> web forward requires the VPN Client to be running
47      * and works by configuring a temporary tunnel connected to the provided
48      * destination that the client browser will be pointed to.
49      *
50      * <p>
51      * This will generally only work when used with a simple static site that
52      * contains only relative links.
53      *
54      * <p>
55      * Because the VPN client will not necessarily know if the browser using the
56      * temporary tunnel has been closed, such tunnels are subject to a time out
57      * as configured in the users profile.
58      *
59      */

60     public final static int TYPE_TUNNELED_SITE = 0;
61
62     /**
63      * <p>
64      * The <i>Replacement Proxy </i> web forward works by loading the required
65      * content through the Replacement proxy engine which is launched via the
66      * {@link com.sslexplorer.replacementproxy.actions.LaunchReplacementProxyAction}
67      * Struts action, with the actual require path encoded in the request as a
68      * parameter.
69      *
70      * <p>
71      * This engine then examines all of the HTTP headers and returned content
72      * (HTML, CSS, JavaScript etc) and replaces all links that it can find with
73      * a special URL always pointing to the SSL-Explorer server.
74      * </p>
75      *
76      * <p>
77      * For example, say a web forward is configured for the destination of <a
78      * HREF="http://www.google.com">http://www.google.com </a>. The link
79      * generated to launch the web forward would read <a
80      * HREF="https://localhost/getURL.do?sslex_url=http://www.google.com">
81      * https://localhost/getURL.do?sslex_url=http://www.google.com </a> and
82      * subsequent links generated by the engine would read
83      * <a
84      * HREF="https://localhost/replacementProxyEngine?sslex_launchId=SPT12345&sslex_url=http://www.google.com">
85      * https://localhost/replacementProxyEngine?sslex_launchId=SPT12345&sslex_url=http://www.google.com </a> where
86      * sslex_launchId is a unique id that represents the current Replacement proxy session and sslex_url
87      * tells the engine which page to get from the remote server.
88      *
89      * <p>
90      * The replacements to perform are determined by the {@link Replacement}
91      * object that are returned by the
92      * {@link com.sslexplorer.security.SystemDatabase#getReplacementsForContent(String, int, String, String)}.
93      * method. The contain the regular expressions that should be used to parse
94      * the content.
95      *
96      * <p>Unfortunately, some sites that contain lots of JavaScript or other
97      * advanced techniques are beyond this method - although the user may
98      * define their own replacements.
99      *
100      *
101      */

102     public final static int TYPE_REPLACEMENT_PROXY = 1;
103
104     /**
105      * <p>Reverse proxy works by simply redirecting all HTTP requests received
106      * by SSL-Explorer that are for paths at or below the specified destination
107      * path to the destination hosts.
108      *
109      * <p>This will only work if the target hosts content is not a the root
110      * of the web provided by that server. I.e a destination path of
111      * http://mail.someco.com/exchange would work, but a path of http://exchange.someco.com/
112      * would not.</p>
113      *
114      * <p>With this method there is also a danger of conflicting paths.
115      *
116      */

117     public final static int TYPE_PATH_BASED_REVERSE_PROXY = 2;
118
119     public final static int TYPE_HOST_BASED_REVERSE_PROXY = 3;
120
121     /**
122      * Tunneled Site String.
123      */

124     public final static String JavaDoc ATTR_TUNNELED_SITE = "Tunneled Site";
125
126     /**
127      * Replacement Proxy String.
128      */

129     public final static String JavaDoc ATTR_REPLACEMENT_PROXY = "Replacement Proxy";
130
131     /**
132      * Reverse Proxy String.
133      */

134     public final static String JavaDoc ATTR_PATH_BASED_REVERSE_PROXY = "Path-Based Reverse Proxy";
135     
136     /**
137      * Rreverse Proxy String.
138      */

139     public final static String JavaDoc ATTR_HOST_BASED_REVERSE_PROXY = "Host-Based Reverse Proxy";
140
141     /**
142      * The type of the web forward. Can be one of {@link #TYPE_TUNNELED_SITE},
143      * {@link #TYPE_REPLACEMENT_PROXY}, {@link #TYPE_PATH_BASED_REVERSE_PROXY}
144      * or {@link #TYPE_HOST_BASED_REVERSE_PROXY}.
145      *
146      * @return type
147      */

148     public int getType();
149
150     /**
151      * Get address to which this forward should direct itself
152      *
153      * @return name
154      */

155     public String JavaDoc getDestinationURL();
156
157     /**
158      * Get the category for this web forward.
159      *
160      * @return default value
161      */

162     public String JavaDoc getCategory();
163
164     /**
165      * Set the category for this web forward.
166      *
167      * @param category category
168      */

169     public void setCategory(String JavaDoc category);
170
171     /**
172      * Set the destination URL for this web forward
173      *
174      * @param destinationURL destination url
175      */

176     public void setDestinationURL(String JavaDoc destinationURL);
177
178     /**
179      * Set the type for this webforward. Can be one of {@link #TYPE_TUNNELED_SITE},
180      * {@link #TYPE_REPLACEMENT_PROXY}, {@link #TYPE_PATH_BASED_REVERSE_PROXY},
181      * {@link #TYPE_HOST_BASED_REVERSE_PROXY}
182      *
183      * @param type type
184      */

185     public void setType(int type);
186
187     /**
188      * Set the resource Id
189      *
190      * @param id
191      */

192     public void setResourceId(int id);
193     
194     /**
195      * Get the URI used to launch this web forward
196      *
197      * @param launchSession launch session
198      */

199     public String JavaDoc getLaunchUri(LaunchSession launchSession);
200
201 }
202
Popular Tags