giacomo 00/08/22 16:07:19
Modified: src/org/apache/cocoon/environment Tag: xml-cocoon2
Environment.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpEnvironment.java
Log:
Added redirect method to make redirect-uri sitemap element work
Revision Changes Path
No revision
No revision
1.1.2.7 +2 -1
xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java
Index: Environment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- Environment.java 2000/08/04 21:11:33 1.1.2.6
+++ Environment.java 2000/08/22 23:07:18 1.1.2.7
@@ -19,7 +19,7 @@
* Base interface for an environment abstraction
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/08/04 21:11:33 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/08/22 23:07:18 $
*/
public interface Environment extends EntityResolver {
@@ -27,6 +27,7 @@
public String getUri ();
public void changeContext (String uriprefix, String context)
throws MalformedURLException;
+ public void redirect (String url) throws IOException;
// Request methods
public String getView ();
No revision
No revision
1.1.2.10 +14 -1
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java
Index: HttpEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- HttpEnvironment.java 2000/08/19 16:01:30 1.1.2.9
+++ HttpEnvironment.java 2000/08/22 23:07:19 1.1.2.10
@@ -97,7 +97,6 @@
*/
public void changeContext(String prefix, String context)
throws MalformedURLException {
-this.servletContext.log("changeContext: prefix="+prefix+",context="+context);
if (uri.startsWith (prefix)) {
this.prefix.append (prefix);
uri = uri.substring(prefix.length());
@@ -109,6 +108,20 @@
} else {
//FIXME: should we throw an error here ?
}
+ }
+
+ /**
+ * Redirect the client to a new URL
+ */
+ public void redirect (String newURL) throws IOException {
+ String qs = request.getQueryString();
+ if (qs != null) {
+System.out.println ("newURL='"+newURL+"?"+qs+"'");
+ this.response.sendRedirect (newURL+"?"+qs);
+ } else {
+System.out.println ("newURL='"+newURL+"'");
+ this.response.sendRedirect (newURL);
+ }
}
// Request methods