cziegeler 01/04/18 05:06:06
Modified: . Tag: xml-cocoon2 build.xml changes.xml todo.xml
src/org/apache/cocoon/acting Tag: xml-cocoon2
DatabaseAuthenticatorAction.java HelloAction.java
LangSelect.java SessionInvalidatorAction.java
SessionValidatorAction.java
src/org/apache/cocoon/components/language/markup/xsp Tag:
xml-cocoon2 XSPCookieHelper.java
XSPRequestHelper.java XSPResponseHelper.java
XSPUtil.java
src/org/apache/cocoon/components/language/markup/xsp/java
Tag: xml-cocoon2 response.xsl
src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
AbstractStreamPipeline.java
src/org/apache/cocoon/environment Tag: xml-cocoon2
Context.java Environment.java Request.java
Response.java
src/org/apache/cocoon/environment/commandline Tag:
xml-cocoon2 AbstractCommandLineEnvironment.java
CommandLineRequest.java CommandLineResponse.java
FileSavingEnvironment.java
LinkSamplingEnvironment.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpEnvironment.java HttpRequest22.java
HttpRequest23.java HttpResponse22.java
RequestWrapper22.java RequestWrapper23.java
src/org/apache/cocoon/reading Tag: xml-cocoon2
AbstractReader.java DatabaseReader.java Reader.java
ResourceReader.java
src/org/apache/cocoon/selection/helpers Tag: xml-cocoon2
CodedSelectorHelper.java
webapp/docs/samples/xsp Tag: xml-cocoon2 cookie.xsp
Added: src/org/apache/cocoon/environment Tag: xml-cocoon2
Cookie.java Session.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpCookie.java HttpSession.java
Log:
Added Cookie and Session - we are now independant (nearly) of the
javax.servlet classes - and cleaned up environment
Revision Changes Path
No revision
No revision
1.6.2.77 +2 -2 xml-cocoon/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/build.xml,v
retrieving revision 1.6.2.76
retrieving revision 1.6.2.77
diff -u -r1.6.2.76 -r1.6.2.77
--- build.xml 2001/04/17 18:17:55 1.6.2.76
+++ build.xml 2001/04/18 12:05:44 1.6.2.77
@@ -250,13 +250,13 @@
<!-- Prepares the servlet 2.3 source code
-->
<!-- ===================================================================
-->
<target name="prepare-src-23" depends="prepare-src-main"
if="servlet23.present">
- <copy
file="${src.dir}/org/apache/cocoon/environment/http/HttpRequest23.java"
+ <copy
file="${src.dir}/org/apache/cocoon/environment/http/HttpRequest22.java"
tofile="${build.src}/org/apache/cocoon/environment/http/HttpRequest.java"
filtering="on"/>
<copy
file="${src.dir}/org/apache/cocoon/environment/http/RequestWrapper23.java"
tofile="${build.src}/org/apache/cocoon/environment/http/RequestWrapper.java"
filtering="on"/>
- <copy
file="${src.dir}/org/apache/cocoon/environment/http/HttpResponse23.java"
+ <copy
file="${src.dir}/org/apache/cocoon/environment/http/HttpResponse22.java"
tofile="${build.src}/org/apache/cocoon/environment/http/HttpResponse.java"
filtering="on"/>
</target>
1.9.2.34 +6 -1 xml-cocoon/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/changes.xml,v
retrieving revision 1.9.2.33
retrieving revision 1.9.2.34
diff -u -r1.9.2.33 -r1.9.2.34
--- changes.xml 2001/04/18 06:13:55 1.9.2.33
+++ changes.xml 2001/04/18 12:05:44 1.9.2.34
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: changes.xml,v 1.9.2.33 2001/04/18 06:13:55 cziegeler Exp $
+ $Id: changes.xml,v 1.9.2.34 2001/04/18 12:05:44 cziegeler Exp $
-->
<changes title="History of Changes">
@@ -24,6 +24,11 @@
</devs>
<release version="@version@" date="@date@">
+ <action dev="CZ" type="add">
+ Creating wrappers for Session and Cookie.
+ The creation of these wrapper classes allow us to be independent
+ of the javax.servlet classes.
+ </action>
<action dev="CZ" type="add">
Added reload-method and check-reload configuration attributes for
the sitemap to allow asynchron/synchron sitemap reloading.
1.6.2.27 +1 -7 xml-cocoon/todo.xml
Index: todo.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/todo.xml,v
retrieving revision 1.6.2.26
retrieving revision 1.6.2.27
diff -u -r1.6.2.26 -r1.6.2.27
--- todo.xml 2001/04/18 06:13:55 1.6.2.26
+++ todo.xml 2001/04/18 12:05:45 1.6.2.27
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: todo.xml,v 1.6.2.26 2001/04/18 06:13:55 cziegeler Exp $
+ $Id: todo.xml,v 1.6.2.27 2001/04/18 12:05:45 cziegeler Exp $
-->
@@ -26,12 +26,6 @@
</devs>
<actions priority="high">
- <action context="code" assigned-to="CZ">
- Creating wrappers for Session and Cookie.
- The creation of these wrapper classes would allow us to be independent
- of the javax.servlet classes.
- </action>
-
<action context="code" assigned-to="CZ">
Cleaning up the environment object like Request, Response for the
different environments.
No revision
No revision
1.1.2.4 +17 -17
xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAuthenticatorAction.java
Index: DatabaseAuthenticatorAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAuthenticatorAction.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- DatabaseAuthenticatorAction.java 2001/04/17 18:18:06 1.1.2.3
+++ DatabaseAuthenticatorAction.java 2001/04/18 12:05:46 1.1.2.4
@@ -1,4 +1,4 @@
-// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.3 2001/04/17 18:18:06 dims
Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.4 2001/04/18 12:05:46
cziegeler Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -16,6 +16,7 @@
import org.apache.cocoon.*;
import org.apache.cocoon.util.Tokenizer;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
import java.sql.Connection;
import java.sql.Statement;
@@ -23,7 +24,6 @@
import java.sql.Timestamp;
import java.sql.SQLException;
-import javax.servlet.http.HttpSession;
/**
* This action is used to authenticate user by comparing several request
@@ -42,7 +42,7 @@
* </table>
* </root>
* </pre>
- * The values specified via "request-param" describe the name of HTTP
request
+ * The values specified via "request-param" describe the name of HTTP request
* parameter, "dbcol" indicates matching database column and finally
* "to-session" attribute indicates under which name the value obtained from
* database should stored in the session. Of course new session is created
@@ -53,7 +53,7 @@
* expression.
*
* @author Martin Man <[EMAIL PROTECTED]>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/17 18:18:06 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/18 12:05:46 $
*/
public class DatabaseAuthenticatorAction extends AbstractDatabaseAction
{
@@ -73,7 +73,7 @@
Request req = (Request)
objectModel.get(Constants.REQUEST_OBJECT);
/* check request validity */
- if (req == null)
+ if (req == null)
return null;
@@ -88,11 +88,11 @@
ResultSet rs = st.executeQuery (query);
if (rs.next ()) {
getLogger ().debug ("DBAUTH: authorized successfully");
- HttpSession session = req.getSession (false);
- if (session != null)
+ Session session = req.getSession (false);
+ if (session != null)
session.invalidate ();
session = req.getSession (true);
- if (session == null)
+ if (session == null)
return null;
HashMap actionMap = this.propagateParameters (conf, rs,
session);
@@ -120,20 +120,20 @@
Configuration[] select = table.getChildren ("select");
try {
for (int i = 0; i < select.length; i ++) {
- if (i != 0)
+ if (i != 0)
queryBuffer.append (", ");
dbcol = select[i].getAttribute ("dbcol");
queryBuffer.append (dbcol);
try {
request_param = select[i].getAttribute ("request-param");
- if (request_param == null ||
+ if (request_param == null ||
request_param.trim().equals ("")) {
continue;
}
} catch (Exception e) {
continue;
}
- /* if there is a request parameter name,
+ /* if there is a request parameter name,
* but not the value, we exit immediately do
* that authorization fails authomatically */
request_value = req.getParameter (
@@ -157,7 +157,7 @@
}
private HashMap propagateParameters (Configuration conf, ResultSet rs,
- HttpSession session) {
+ Session session) {
Configuration table = conf.getChild ("table");
Configuration[] select = table.getChildren ("select");
String dbcol, session_param, type;
@@ -167,7 +167,7 @@
dbcol = select[i].getAttribute ("dbcol");
try {
session_param = select[i].getAttribute ("to-session");
- if (session_param != null &&
+ if (session_param != null &&
!session_param.trim().equals ("")) {
String s = rs.getString (i + 1);
getLogger ().debug ("DBAUTH: propagating param "
@@ -183,13 +183,13 @@
}
Object o = null;
if ("string".equals (type)) {
- o = s;
+ o = s;
} else if ("long".equals (type)) {
Long l = Long.decode (s);
- o = l;
+ o = l;
} else if ("double".equals (type)) {
Double d = Double.valueOf (s);
- o = d;
+ o = d;
}
session.setAttribute (session_param, o);
map.put (session_param, o);
@@ -205,5 +205,5 @@
}
}
-// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.3 2001/04/17 18:18:06 dims
Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.4 2001/04/18 12:05:46
cziegeler Exp $
// vim: set et ts=4 sw=4:
1.1.2.14 +3 -4
xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java
Index: HelloAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- HelloAction.java 2001/03/30 17:14:10 1.1.2.13
+++ HelloAction.java 2001/04/18 12:05:47 1.1.2.14
@@ -9,8 +9,6 @@
import java.util.Map;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletContext;
import org.apache.avalon.Component;
import org.apache.avalon.configuration.Configuration;
@@ -22,13 +20,14 @@
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
/**
* A simple Action that tracks if a <code>Session</code> object
* has been created or not.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/03/30 17:14:10 $
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/04/18 12:05:47 $
*/
public class HelloAction extends ComposerAction {
@@ -39,7 +38,7 @@
public Map act (EntityResolver resolver, Map objectModel, String src,
Parameters par) throws Exception {
Request request = (Request)
objectModel.get(Constants.REQUEST_OBJECT);
if (request != null) {
- HttpSession session = request.getSession (false);
+ Session session = request.getSession (false);
if (session != null) {
if (session.isNew()) {
1.1.2.9 +4 -5
xml-cocoon/src/org/apache/cocoon/acting/Attic/LangSelect.java
Index: LangSelect.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/LangSelect.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- LangSelect.java 2001/03/30 17:14:11 1.1.2.8
+++ LangSelect.java 2001/04/18 12:05:47 1.1.2.9
@@ -17,12 +17,11 @@
import java.util.Locale;
import java.util.Map;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpSession;
-
import org.apache.cocoon.Constants;
import org.apache.cocoon.acting.Action;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Cookie;
+import org.apache.cocoon.environment.Session;
import org.apache.avalon.configuration.Parameters;
@@ -79,7 +78,7 @@
Request request =
(Request)(objectModel.get(Constants.REQUEST_OBJECT));
- HttpSession session = request.getSession();
+ Session session = request.getSession();
if (session != null) {
if (session.getAttribute("lang") == null) {
session.setAttribute("lang", lang);
@@ -128,7 +127,7 @@
lang = request.getParameter("lang");
if (lang == null) {
- HttpSession session = request.getSession(false);
+ Session session = request.getSession(false);
if (session != null) {
Object session_lang = session.getAttribute("lang");
if (session_lang != null) {
1.1.2.3 +7 -7
xml-cocoon/src/org/apache/cocoon/acting/Attic/SessionInvalidatorAction.java
Index: SessionInvalidatorAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/SessionInvalidatorAction.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- SessionInvalidatorAction.java 2001/04/17 18:18:11 1.1.2.2
+++ SessionInvalidatorAction.java 2001/04/18 12:05:47 1.1.2.3
@@ -1,4 +1,4 @@
-// $Id: SessionInvalidatorAction.java,v 1.1.2.2 2001/04/17 18:18:11 dims Exp
$
+// $Id: SessionInvalidatorAction.java,v 1.1.2.3 2001/04/18 12:05:47
cziegeler Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -15,15 +15,15 @@
import org.apache.cocoon.*;
import org.apache.cocoon.util.Tokenizer;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
-import javax.servlet.http.HttpSession;
/**
* This is the action used to invalidate an HTTP session. The action returns
* empty map if everything is ok, null otherwise.
*
* @author Martin Man <[EMAIL PROTECTED]>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/17 18:18:11 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/18 12:05:47 $
*/
public class SessionInvalidatorAction extends AbstractAction
{
@@ -32,16 +32,16 @@
*/
public Map act (EntityResolver resolver, Map objectModel, String src,
Parameters parameters) throws Exception {
- Request req = (Request)
+ Request req = (Request)
objectModel.get (Constants.REQUEST_OBJECT);
HashMap actionMap = new HashMap ();
/* check request validity */
- if (req == null)
+ if (req == null)
return null;
/* check session validity */
- HttpSession session = req.getSession (false);
+ Session session = req.getSession (false);
if (session != null)
session.invalidate ();
@@ -49,5 +49,5 @@
}
}
-// $Id: SessionInvalidatorAction.java,v 1.1.2.2 2001/04/17 18:18:11 dims Exp
$
+// $Id: SessionInvalidatorAction.java,v 1.1.2.3 2001/04/18 12:05:47
cziegeler Exp $
// vim: set et ts=4 sw=4:
1.1.2.3 +8 -8
xml-cocoon/src/org/apache/cocoon/acting/Attic/SessionValidatorAction.java
Index: SessionValidatorAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/SessionValidatorAction.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- SessionValidatorAction.java 2001/04/17 18:18:12 1.1.2.2
+++ SessionValidatorAction.java 2001/04/18 12:05:47 1.1.2.3
@@ -1,4 +1,4 @@
-// $Id: SessionValidatorAction.java,v 1.1.2.2 2001/04/17 18:18:12 dims Exp $
+// $Id: SessionValidatorAction.java,v 1.1.2.3 2001/04/18 12:05:47 cziegeler
Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -16,8 +16,8 @@
import org.apache.cocoon.*;
import org.apache.cocoon.util.Tokenizer;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
-import javax.servlet.http.HttpSession;
/**
* This is the action used to validate HTTP session parameters.
@@ -38,7 +38,7 @@
* all validated parameters to the sitemap via {name} expression.
*
* @author Martin Man <[EMAIL PROTECTED]>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/17 18:18:12 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/18 12:05:47 $
*/
public class SessionValidatorAction extends AbstractValidatorAction
{
@@ -47,14 +47,14 @@
*/
public Map act (EntityResolver resolver, Map objectModel, String src,
Parameters parameters) throws Exception {
- Request req = (Request)
+ Request req = (Request)
objectModel.get (Constants.REQUEST_OBJECT);
- if (req == null)
+ if (req == null)
return null;
/* check session validity */
- HttpSession session = req.getSession (false);
+ Session session = req.getSession (false);
if (session == null)
return null;
@@ -72,7 +72,7 @@
Object result;
for (int i = 0; i < rparams.length; i ++) {
rparams[i] = rparams[i].trim ();
- result = validateParameter (rparams[i], desc,
+ result = validateParameter (rparams[i], desc,
session.getAttribute (rparams[i]), false);
if (result == null) {
return null;
@@ -89,5 +89,5 @@
}
}
-// $Id: SessionValidatorAction.java,v 1.1.2.2 2001/04/17 18:18:12 dims Exp $
+// $Id: SessionValidatorAction.java,v 1.1.2.3 2001/04/18 12:05:47 cziegeler
Exp $
// vim: set et ts=4 sw=4:
No revision
No revision
1.1.2.2 +446 -447
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPCookieHelper.java
Index: XSPCookieHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPCookieHelper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- XSPCookieHelper.java 2001/04/09 20:36:51 1.1.2.1
+++ XSPCookieHelper.java 2001/04/18 12:05:49 1.1.2.2
@@ -1,39 +1,39 @@
/**
- This class is a helper class used by Cookie logicsheet
+ This class is a helper class used by Cookie logicsheet
This class contains following methods,
- * public static void addCookie(Map , String , String , String , String ,
- int ,
String , String , int)
+ * public static void addCookie(Map , String , String , String ,
String ,
+ int , String , String , int)
- * public static Cookie[] getCookies(Map)
+ * public static Cookie[] getCookies(Map)
- * public static void getCookies(Map , ContentHandler)
-
throws SAXException
+ * public static void getCookies(Map , ContentHandler)
+ throws
SAXException
- * public static Cookie getCookie(Map , String ,int )
-
throws SAXException
+ * public static Cookie getCookie(Map , String ,int )
+ throws
SAXException
- * public static void getCookie(Map ,String ,int ,
ContentHandler)
-
throws
SAXException
+ * public static void getCookie(Map ,String ,int , ContentHandler)
+
throws SAXException
- * public static String getComment(Map ,String , int)
+ * public static String getComment(Map ,String , int)
- * public static String getDomain(Map , String , int)
+ * public static String getDomain(Map , String , int)
- * public static String getMaxAge(Map ,String , int)
+ * public static String getMaxAge(Map ,String , int)
- * public static String getName(Map ,String , int)
+ * public static String getName(Map ,String , int)
- * public static String getPath(Map , String , int)
+ * public static String getPath(Map , String , int)
- * public static String getSecure(Map , String , int)
+ * public static String getSecure(Map , String , int)
- * public static String getValue(Map , String , int)
+ * public static String getValue(Map , String , int)
- * public static String getVersion(Map , String , int)
+ * public static String getVersion(Map , String , int)
- * private static String returnCookieProperty(Map ,String ,int
,String )
+ * private static String returnCookieProperty(Map ,String ,int
,String )
*/
@@ -43,14 +43,13 @@
import java.util.Hashtable;
import java.util.Map;
-import javax.servlet.http.Cookie;
-
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
-import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.environment.Request;
import org.apache.cocoon.Constants;
@@ -65,633 +64,633 @@
*/
/**
- This method will set a new cookie with values that are passed
through paramaters
+ This method will set a new cookie with values that are passed
through paramaters
- @param objectModel
+ @param objectModel
- @param name name to be set for the cookie
+ @param name name to be set for the cookie
- @param value value to be set for the cookie
+ @param value value to be set for the cookie
- @param comment comment to be set for the cookie
+ @param comment comment to be set for the cookie
- @param domain domain to be set for the cookie
+ @param domain domain to be set for the cookie
- @param maxage maxage to be set for the cookie
+ @param maxage maxage to be set for the cookie
- @param path path to be set for the cookie
+ @param path path to be set for the cookie
- @param secure secure property to be set for the cookie
+ @param secure secure property to be set for the cookie
- @param version version to be set for the cookie
+ @param version version to be set for the cookie
*/
- public static void addCookie(Map objectModel, String name, String value,
- String
comment, String domain, int maxage, String path,
- String
secure, int version)
- {
+ public static void addCookie(Map objectModel, String name, String value,
+ String comment, String domain, int
maxage, String path,
+ String secure, int version)
+ {
- Response response =
(Response)objectModel.get(Constants.RESPONSE_OBJECT);
+ Response response =
(Response)objectModel.get(Constants.RESPONSE_OBJECT);
- Cookie cookieToSet = new Cookie(name,value);
+ Cookie cookieToSet = response.createCookie(name,value);
- if ((comment.trim()).length() > 0)
- cookieToSet.setComment(comment);
+ if ((comment.trim()).length() > 0)
+ cookieToSet.setComment(comment);
- if ((domain.trim()).length() > 0)
- cookieToSet.setDomain(domain);
+ if ((domain.trim()).length() > 0)
+ cookieToSet.setDomain(domain);
- if (maxage > 0)
- cookieToSet.setMaxAge(maxage);
+ if (maxage > 0)
+ cookieToSet.setMaxAge(maxage);
- if ((path.trim()).length() > 0)
- cookieToSet.setPath("/");
+ if ((path.trim()).length() > 0)
+ cookieToSet.setPath("/");
- if (secure == "true" || secure == "false")
- cookieToSet.setSecure(true);
+ if (secure == "true" || secure == "false")
+ cookieToSet.setSecure(true);
- cookieToSet.setVersion(version);
- response.addCookie(cookieToSet);
- }
+ cookieToSet.setVersion(version);
+ response.addCookie(cookieToSet);
+ }
/**
- This method is used to return all the cookies that present in the
passed request object
+ This method is used to return all the cookies that present in the passed
request object
- @param objectModel
+ @param objectModel
- @return an array of Cookie is returned
+ @return an array of Cookie is returned
*/
- public static Cookie[] getCookies(Map objectModel)
- {
- Request request =
(Request)objectModel.get(Constants.REQUEST_OBJECT);
- return request.getCookies();
- }
+ public static Cookie[] getCookies(Map objectModel)
+ {
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
+ return request.getCookies();
+ }
/**
- This method is used to write the values of all the cookies in the
resulting XML tree
- The structure that will be added to the XML tree will be
- <cookies>
- <cookie>
- <name>......</name>
- <value>.....</value>
- <comment>...</comment>
- <domain>....</domain>
- <maxage>....</maxage>
- <path>......</path>
- <secure>....</secure>
- <version>...</version>
- </cookie>
- <cookie>
- .
- .
- .
- </cookie>
- .
- .
- .
- </cookies>
+ This method is used to write the values of all the cookies in the
resulting XML tree
+ The structure that will be added to the XML tree will be
+ <cookies>
+ <cookie>
+ <name>......</name>
+ <value>.....</value>
+ <comment>...</comment>
+ <domain>....</domain>
+ <maxage>....</maxage>
+ <path>......</path>
+ <secure>....</secure>
+ <version>...</version>
+ </cookie>
+ <cookie>
+ .
+ .
+ .
+ </cookie>
+ .
+ .
+ .
+ </cookies>
- If the values of any of these is not present those tags will not be
present.
+ If the values of any of these is not present those tags will not be
present.
- @param objectModel
+ @param objectModel
- @param contentHandler
+ @param contentHandler
- @exception SAXException
+ @exception SAXException
*/
- public static void getCookies(Map objectModel ,
-
ContentHandler contentHandler)
-
throws SAXException
- {
+ public static void getCookies(Map objectModel ,
+ ContentHandler contentHandler)
+ throws
SAXException
+ {
- Request request =
(Request)objectModel.get(Constants.REQUEST_OBJECT);
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- Cookie[] cookies = request.getCookies();
+ Cookie[] cookies = request.getCookies();
- int count = 0;
+ int count = 0;
- String tempStr = null;
+ String tempStr = null;
- Hashtable nodeTable = new Hashtable();
+ Hashtable nodeTable = new Hashtable();
- if(cookies.length > 0)
- {
- start(contentHandler, "cookies");
+ if(cookies.length > 0)
+ {
+ start(contentHandler, "cookies");
- for(count=0; count<cookies.length; count++)
- {
- start(contentHandler, "cookie");
+ for(count=0; count<cookies.length; count++)
+ {
+ start(contentHandler, "cookie");
- if ((tempStr = getName(objectModel , null ,
count)) != null)
- nodeTable.put("name", tempStr);
+ if ((tempStr = getName(objectModel , null , count)) != null)
+ nodeTable.put("name", tempStr);
- if((tempStr = getValue(objectModel , null ,
count))!=null)
- nodeTable.put("value", tempStr);
+ if((tempStr = getValue(objectModel , null , count))!=null)
+ nodeTable.put("value", tempStr);
- if((tempStr = getComment(objectModel , null ,
count))!=null)
- nodeTable.put("comment", tempStr);
+ if((tempStr = getComment(objectModel , null , count))!=null)
+ nodeTable.put("comment", tempStr);
- if((tempStr = getDomain(objectModel , null ,
count))!= null)
- nodeTable.put("domain", tempStr);
+ if((tempStr = getDomain(objectModel , null , count))!= null)
+ nodeTable.put("domain", tempStr);
- if((tempStr = getMaxAge(objectModel , null ,
count))!=null)
- nodeTable.put("maxage", tempStr);
+ if((tempStr = getMaxAge(objectModel , null , count))!=null)
+ nodeTable.put("maxage", tempStr);
- if((tempStr = getPath(objectModel , null ,
count)) != null)
- nodeTable.put("path", tempStr);
+ if((tempStr = getPath(objectModel , null , count)) != null)
+ nodeTable.put("path", tempStr);
- if((tempStr = getSecure(objectModel , null ,
count)) !=null)
- nodeTable.put("secure", tempStr);
+ if((tempStr = getSecure(objectModel , null , count)) !=null)
+ nodeTable.put("secure", tempStr);
- if((tempStr = getVersion(objectModel , null ,
count)) != null)
- nodeTable.put("version", tempStr);
+ if((tempStr = getVersion(objectModel , null , count)) !=
null)
+ nodeTable.put("version", tempStr);
- Enumeration keys = nodeTable.keys();
- while (keys.hasMoreElements())
- {
- String nodeName =
(String)keys.nextElement();
- String nodeValue =
(String)nodeTable.get(nodeName);
- elementData(contentHandler, nodeName,
nodeValue);
- }
+ Enumeration keys = nodeTable.keys();
+ while (keys.hasMoreElements())
+ {
+ String nodeName = (String)keys.nextElement();
+ String nodeValue = (String)nodeTable.get(nodeName);
+ elementData(contentHandler, nodeName, nodeValue);
+ }
- end(contentHandler, "cookie");
- }
+ end(contentHandler, "cookie");
+ }
- end(contentHandler, "cookies");
- }
+ end(contentHandler, "cookies");
+ }
- }
+ }
/**
- Method used to return a cookie object based on the name or the index
that was passed
+ Method used to return a cookie object based on the name or the index
that was passed
- If both name and index of cookie to be extracted is passed in, name
will take
- precedence. Basic thing followed is that, when name is passed, index
should be -1 and
- when index is passed name should null
+ If both name and index of cookie to be extracted is passed in, name will
take
+ precedence. Basic thing followed is that, when name is passed, index
should be -1 and
+ when index is passed name should null
- @param objectModel
+ @param objectModel
- @param cookieName Name of the cookie which is to be found and returned
back
+ @param cookieName Name of the cookie which is to be found and returned
back
- @param cookieIndex Index of the cookie which is to be found and returned
+ @param cookieIndex Index of the cookie which is to be found and returned
- @return cookie object is returned
+ @return cookie object is returned
- @exception SAXException
+ @exception SAXException
*/
- public static Cookie getCookie(Map objectModel ,
-
String cookieName ,
-
int cookieIndex) throws SAXException
- {
- boolean retrieveByName = false;
- boolean retrieveByIndex = false;
- boolean matchFound = false;
+ public static Cookie getCookie(Map objectModel ,
+ String cookieName ,
+ int cookieIndex) throws SAXException
+ {
+ boolean retrieveByName = false;
+ boolean retrieveByIndex = false;
+ boolean matchFound = false;
- int count = 0;
+ int count = 0;
- Request request =
(Request)objectModel.get(Constants.REQUEST_OBJECT);
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- Cookie currentCookie = null;
+ Cookie currentCookie = null;
- if (cookieName != null)
- retrieveByName = true;
- else
- {
- if (cookieIndex >=0)
- retrieveByIndex = true;
- }
+ if (cookieName != null)
+ retrieveByName = true;
+ else
+ {
+ if (cookieIndex >=0)
+ retrieveByIndex = true;
+ }
- Cookie[] cookies = request.getCookies();
+ Cookie[] cookies = request.getCookies();
- if (retrieveByName)
- {
- for(count=0; count<cookies.length; count++)
- {
- currentCookie = cookies[count];
+ if (retrieveByName)
+ {
+ for(count=0; count<cookies.length; count++)
+ {
+ currentCookie = cookies[count];
- if (currentCookie.getName().equals(cookieName))
- matchFound = true;
- }
- }
- else if(retrieveByIndex)
- {
- if(cookies.length > cookieIndex)
- {
- currentCookie = cookies[cookieIndex];
- matchFound = true;
- }
- }
+ if (currentCookie.getName().equals(cookieName))
+ matchFound = true;
+ }
+ }
+ else if(retrieveByIndex)
+ {
+ if(cookies.length > cookieIndex)
+ {
+ currentCookie = cookies[cookieIndex];
+ matchFound = true;
+ }
+ }
- if (matchFound)
- return currentCookie;
- else
- return null;
+ if (matchFound)
+ return currentCookie;
+ else
+ return null;
- }
+ }
/**
- This method is used to find a cookie by it's name or index and place it
in
- the XML resulting tree
+ This method is used to find a cookie by it's name or index and place it
in
+ the XML resulting tree
- The xml structure that will be inserted will be,
- <cookie>
- <name>......</name>
- <value>.....</value>
- <comment>...</comment>
- <domain>....</domain>
- <maxage>....</maxage>
- <path>......</path>
- <secure>....</secure>
- <version>...</version>
- </cookie>
+ The xml structure that will be inserted will be,
+ <cookie>
+ <name>......</name>
+ <value>.....</value>
+ <comment>...</comment>
+ <domain>....</domain>
+ <maxage>....</maxage>
+ <path>......</path>
+ <secure>....</secure>
+ <version>...</version>
+ </cookie>
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie which is to be found
+ @param cookieName name of the cookie which is to be found
- @param cookieIndex index of the cookie which is to be found
+ @param cookieIndex index of the cookie which is to be found
- @param ContentHandler
+ @param ContentHandler
- @exception SAXException
+ @exception SAXException
*/
- public static void getCookie(Map objectModel ,
-
String cookieName ,
-
int cookieIndex ,
-
ContentHandler contentHandler)
-
throws SAXException
- {
- boolean retrieveByName = false;
- boolean retrieveByIndex = false;
+ public static void getCookie(Map objectModel ,
+ String cookieName ,
+ int cookieIndex ,
+ ContentHandler
contentHandler)
+ throws
SAXException
+ {
+ boolean retrieveByName = false;
+ boolean retrieveByIndex = false;
- String tempStr = null;
+ String tempStr = null;
- Hashtable nodeTable = new Hashtable();
+ Hashtable nodeTable = new Hashtable();
- Request request =
(Request)objectModel.get(Constants.REQUEST_OBJECT);
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- if (cookieName != null)
- retrieveByName = true;
- else
- {
- if (cookieIndex >=0)
- retrieveByIndex = true;
- }
+ if (cookieName != null)
+ retrieveByName = true;
+ else
+ {
+ if (cookieIndex >=0)
+ retrieveByIndex = true;
+ }
- if (retrieveByName || retrieveByIndex)
- tempStr = getName(objectModel , cookieName ,
cookieIndex);
+ if (retrieveByName || retrieveByIndex)
+ tempStr = getName(objectModel , cookieName , cookieIndex);
- if (tempStr !=null)
- {
- start(contentHandler, "cookie");
+ if (tempStr !=null)
+ {
+ start(contentHandler, "cookie");
- // name
- nodeTable.put("name", tempStr);
+ // name
+ nodeTable.put("name", tempStr);
- // value
- if ((tempStr = getValue(objectModel , cookieName ,
cookieIndex)) != null)
- nodeTable.put("value", tempStr);
+ // value
+ if ((tempStr = getValue(objectModel , cookieName , cookieIndex))
!= null)
+ nodeTable.put("value", tempStr);
- //comment
- if ((tempStr = getComment(objectModel , cookieName ,
cookieIndex)) != null)
- nodeTable.put("comment", tempStr);
+ //comment
+ if ((tempStr = getComment(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("comment", tempStr);
- //value
- if ((tempStr = getDomain(objectModel , cookieName ,
cookieIndex)) != null)
- nodeTable.put("domain", tempStr);
+ //value
+ if ((tempStr = getDomain(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("domain", tempStr);
- // maxage
- if((tempStr = getMaxAge(objectModel ,
cookieName , cookieIndex)) != null)
- nodeTable.put("maxage",
tempStr);
+ // maxage
+ if((tempStr = getMaxAge(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("maxage", tempStr);
- // path
- if((tempStr = getPath(objectModel , cookieName
, cookieIndex)) != null)
- nodeTable.put("path", tempStr);
+ // path
+ if((tempStr = getPath(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("path", tempStr);
- // secure
- if((tempStr = getSecure(objectModel ,
cookieName , cookieIndex)) != null)
- nodeTable.put("secure", tempStr);
+ // secure
+ if((tempStr = getSecure(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("secure", tempStr);
- // version
- if((tempStr = getVersion(objectModel , cookieName ,
cookieIndex)) != null)
- nodeTable.put("version", tempStr);
+ // version
+ if((tempStr = getVersion(objectModel , cookieName ,
cookieIndex)) != null)
+ nodeTable.put("version", tempStr);
- Enumeration keys = nodeTable.keys();
- while (keys.hasMoreElements())
- {
- String nodeName = (String)keys.nextElement();
- String nodeValue =
(String)nodeTable.get(nodeName);
- elementData(contentHandler, nodeName,
nodeValue);
- }
+ Enumeration keys = nodeTable.keys();
+ while (keys.hasMoreElements())
+ {
+ String nodeName = (String)keys.nextElement();
+ String nodeValue = (String)nodeTable.get(nodeName);
+ elementData(contentHandler, nodeName, nodeValue);
+ }
- end(contentHandler, "cookie");
+ end(contentHandler, "cookie");
- }
- }
+ }
+ }
/**
- Method to return the value of comment for a particular cookie based
- on it's name or index
+ Method to return the value of comment for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose comment is to be passed
+ @param cookieName name of the cookie whose comment is to be passed
- @param cookieIndex index of the cookie whose comment is to be passed
+ @param cookieIndex index of the cookie whose comment is to be passed
- @return a string is returned containing the comment of the cookie, if
not found
- then null is returned
+ @return a string is returned containing the comment of the cookie, if
not found
+ then null is returned
*/
- public static String getComment(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "C");
+ public static String getComment(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"C");
- }
+ }
/**
- Method to return the value of domain for a particular cookie based
- on it's name or index
+ Method to return the value of domain for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose domain is to be passed
+ @param cookieName name of the cookie whose domain is to be passed
- @param cookieIndex index of the cookie whose domain is to be passed
+ @param cookieIndex index of the cookie whose domain is to be passed
- @return a string is returned containing the domain of the cookie, if
not found
- then null is returned
+ @return a string is returned containing the domain of the cookie, if not
found
+ then null is returned
*/
- public static String getDomain(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "D");
- }
+ public static String getDomain(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"D");
+ }
/**
- Method to return the value of maxage for a particular cookie based
- on it's name or index
+ Method to return the value of maxage for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose maxage is to be passed
+ @param cookieName name of the cookie whose maxage is to be passed
- @param cookieIndex index of the cookie whose maxage is to be passed
+ @param cookieIndex index of the cookie whose maxage is to be passed
- @return a string is returned containing the maxage of the cookie, if
not found
- then null is returned
+ @return a string is returned containing the maxage of the cookie, if not
found
+ then null is returned
*/
- public static String getMaxAge(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "M");
- }
+ public static String getMaxAge(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"M");
+ }
/**
- Method to return the value of name for a particular cookie based
- on it's name or index
+ Method to return the value of name for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose name is to be passed
+ @param cookieName name of the cookie whose name is to be passed
- @param cookieIndex index of the cookie whose name is to be passed
+ @param cookieIndex index of the cookie whose name is to be passed
- @return a string is returned containing the name of the cookie, if not
found
- then null is returned
+ @return a string is returned containing the name of the cookie, if not
found
+ then null is returned
*/
- public static String getName(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "N");
- }
+ public static String getName(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"N");
+ }
/**
- Method to return the value of path for a particular cookie based
- on it's name or index
+ Method to return the value of path for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose path is to be passed
+ @param cookieName name of the cookie whose path is to be passed
- @param cookieIndex index of the cookie whose path is to be passed
+ @param cookieIndex index of the cookie whose path is to be passed
- @return a string is returned containing the path of the cookie, if not
found
- then null is returned
+ @return a string is returned containing the path of the cookie, if not
found
+ then null is returned
*/
- public static String getPath(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "P");
- }
+ public static String getPath(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"P");
+ }
/**
- Method to return the value of secure property for a particular cookie
based
- on it's name or index
+ Method to return the value of secure property for a particular cookie
based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose secure property is to be
passed
+ @param cookieName name of the cookie whose secure property is to be
passed
- @param cookieIndex index of the cookie whose secure property is to be
passed
+ @param cookieIndex index of the cookie whose secure property is to be
passed
- @return a string is returned containing the secure property of the
cookie, if not found
- then null is returned
+ @return a string is returned containing the secure property of the
cookie, if not found
+ then null is returned
*/
- public static String getSecure(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "S");
- }
+ public static String getSecure(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"S");
+ }
/**
- Method to return the value for a particular cookie based on it's name
or index
+ Method to return the value for a particular cookie based on it's name or
index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose value is to be passed
+ @param cookieName name of the cookie whose value is to be passed
- @param cookieIndex index of the cookie whose value
+ @param cookieIndex index of the cookie whose value
- @return a string is returned containing the value of the cookie, if not
found
- then null is returned
+ @return a string is returned containing the value of the cookie, if not
found
+ then null is returned
*/
- public static String getValue(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "V");
- }
+ public static String getValue(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"V");
+ }
/**
- Method to return the version of comment for a particular cookie based
- on it's name or index
+ Method to return the version of comment for a particular cookie based
+ on it's name or index
- Rule for passing name and index of the cookie remains same as specified
in
- previous method(s)
+ Rule for passing name and index of the cookie remains same as specified
in
+ previous method(s)
- @param objectModel
+ @param objectModel
- @param cookieName name of the cookie whose version is to be passed
+ @param cookieName name of the cookie whose version is to be passed
- @param cookieIndex index of the cookie whose version is to be passed
+ @param cookieIndex index of the cookie whose version is to be passed
- @return a string is returned containing the version of the cookie, if
not found
- then null is returned
+ @return a string is returned containing the version of the cookie, if
not found
+ then null is returned
*/
- public static String getVersion(Map objectModel,
-
String cookieName , int cookieIndex)
- {
- return returnCookieProperty(objectModel , cookieName ,
cookieIndex , "Ve");
- }
+ public static String getVersion(Map objectModel,
+ String cookieName , int
cookieIndex)
+ {
+ return returnCookieProperty(objectModel , cookieName , cookieIndex ,
"Ve");
+ }
/**
- Method returnCookieProperty will be used to retrieve the property
- value of cookie. This method will return the value based on the name
- or the index of the cookie that is passed.
+ Method returnCookieProperty will be used to retrieve the property
+ value of cookie. This method will return the value based on the name
+ or the index of the cookie that is passed.
- Cookie properties,
- comment = "C"
- domain = "D"
- maxage = "M"
- name = "N"
- path = "P"
- secure = "S"
- value = "V"
- version = "Ve"
+ Cookie properties,
+ comment = "C"
+ domain = "D"
+ maxage = "M"
+ name = "N"
+ path = "P"
+ secure = "S"
+ value = "V"
+ version = "Ve"
- @param objectModel
+ @param objectModel
- @param cookieName Name of the cookie whose property is to be returned.
- This value will be null if cookie
index is specified
+ @param cookieName Name of the cookie whose property is to be returned.
+ This value will be null if cookie index is specified
- @param cookieIndex Index of the cookie whose property is to be returned.
- This property will be -1 if cookie
name is specified.
- If both name and index are
specified, name will take
- preference.
+ @param cookieIndex Index of the cookie whose property is to be returned.
+ This property will be -1 if cookie name is specified.
+ If both name and index are specified, name will take
+ preference.
- @param valueOf Specifies the property whose value if to be
retrieved.
- Properties have been specifed above
+ @param valueOf Specifies the property whose value if to be
retrieved.
+ Properties have been specifed above
- @return If the name or index that is passed is improper then a
null value
- will be returned, otherwise whatever will be
the extracted value of
- the property will be returned.
+ @return If the name or index that is passed is improper then a null
value
+ will be returned, otherwise whatever will be the extracted
value of
+ the property will be returned.
*/
- private static String returnCookieProperty(Map objectModel ,
-
String cookieName ,
-
int cookieIndex ,
-
String propertyPrefix)
- {
- boolean retrieveByName = false;
- boolean retrieveByIndex = false;
- boolean matchFound = false;
+ private static String returnCookieProperty(Map objectModel ,
+ String cookieName ,
+ int cookieIndex ,
+ String propertyPrefix)
+ {
+ boolean retrieveByName = false;
+ boolean retrieveByIndex = false;
+ boolean matchFound = false;
- Cookie currentCookie = null;
+ Cookie currentCookie = null;
- Request request =
(Request)objectModel.get(Constants.REQUEST_OBJECT);
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- int count = 0;
+ int count = 0;
- String returnValue = null;
+ String returnValue = null;
- if (cookieName != null)
- retrieveByName = true;
- else
- {
- if (cookieIndex >=0)
- retrieveByIndex = true;
- }
+ if (cookieName != null)
+ retrieveByName = true;
+ else
+ {
+ if (cookieIndex >=0)
+ retrieveByIndex = true;
+ }
- Cookie[] cookies = request.getCookies();
+ Cookie[] cookies = request.getCookies();
- if (cookies.length > 0)
- {
- if (retrieveByName)
- {
- for(count=0; count<cookies.length; count++)
- {
- currentCookie = cookies[count];
+ if (cookies.length > 0)
+ {
+ if (retrieveByName)
+ {
+ for(count=0; count<cookies.length; count++)
+ {
+ currentCookie = cookies[count];
- if
(currentCookie.getName().equals(cookieName))
- matchFound = true;
- }
- }
- else if (retrieveByIndex)
- {
- if(cookies.length > cookieIndex)
- {
- currentCookie = cookies[cookieIndex];
- matchFound = true;
- }
- }
+ if (currentCookie.getName().equals(cookieName))
+ matchFound = true;
+ }
+ }
+ else if (retrieveByIndex)
+ {
+ if(cookies.length > cookieIndex)
+ {
+ currentCookie = cookies[cookieIndex];
+ matchFound = true;
+ }
+ }
- if (matchFound)
- {
- if(propertyPrefix.equals("C"))
- returnValue =
currentCookie.getComment();
- else if(propertyPrefix.equals("D"))
- returnValue = currentCookie.getDomain();
- else if(propertyPrefix.equals("M"))
- returnValue =
Integer.toString(currentCookie.getMaxAge());
- else if(propertyPrefix.equals("N"))
- returnValue = currentCookie.getName();
- else if(propertyPrefix.equals("P"))
- returnValue = currentCookie.getPath();
- else if(propertyPrefix.equals("S"))
- returnValue =
returnValue.valueOf(currentCookie.getSecure());
- else if(propertyPrefix.equals("V"))
- returnValue = currentCookie.getValue();
- else if(propertyPrefix.equals("Ve"))
- returnValue =
Integer.toString(currentCookie.getVersion());
- }
- }
+ if (matchFound)
+ {
+ if(propertyPrefix.equals("C"))
+ returnValue = currentCookie.getComment();
+ else if(propertyPrefix.equals("D"))
+ returnValue = currentCookie.getDomain();
+ else if(propertyPrefix.equals("M"))
+ returnValue =
Integer.toString(currentCookie.getMaxAge());
+ else if(propertyPrefix.equals("N"))
+ returnValue = currentCookie.getName();
+ else if(propertyPrefix.equals("P"))
+ returnValue = currentCookie.getPath();
+ else if(propertyPrefix.equals("S"))
+ returnValue =
returnValue.valueOf(currentCookie.getSecure());
+ else if(propertyPrefix.equals("V"))
+ returnValue = currentCookie.getValue();
+ else if(propertyPrefix.equals("Ve"))
+ returnValue =
Integer.toString(currentCookie.getVersion());
+ }
+ }
- return returnValue;
- }
+ return returnValue;
+ }
}
1.1.2.15 +4 -4
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java
Index: XSPRequestHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -r1.1.2.14 -r1.1.2.15
--- XSPRequestHelper.java 2001/04/17 18:18:32 1.1.2.14
+++ XSPRequestHelper.java 2001/04/18 12:05:49 1.1.2.15
@@ -10,7 +10,7 @@
import java.util.Enumeration;
import org.apache.cocoon.environment.Request;
-import javax.servlet.http.HttpSession;
+import org.apache.cocoon.environment.Session;
import java.util.Map;
import java.util.Vector;
@@ -24,7 +24,7 @@
* The <code>Request</code> object helper
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/04/17 18:18:32 $
+ * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/04/18 12:05:49 $
*/
public class XSPRequestHelper extends XSPObjectHelper {
/**
@@ -258,7 +258,7 @@
String name) {
Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- HttpSession session = request.getSession(false);
+ Session session = request.getSession(false);
return session.getAttribute(name);
}
@@ -276,7 +276,7 @@
String defaultValue) {
Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
- HttpSession session = request.getSession(false);
+ Session session = request.getSession(false);
Object value = null;
if (session != null) {
1.1.2.12 +5 -5
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPResponseHelper.java
Index: XSPResponseHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPResponseHelper.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- XSPResponseHelper.java 2001/03/30 17:14:19 1.1.2.11
+++ XSPResponseHelper.java 2001/04/18 12:05:49 1.1.2.12
@@ -25,7 +25,7 @@
* The XSP <code>Response</code> object helper
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/30 17:14:19 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/04/18 12:05:49 $
*/
public class XSPResponseHelper extends XSPObjectHelper {
/**
@@ -70,25 +70,25 @@
* @param objectModel The Map objectModel
* @param type The content type
*/
- public static void setContentType(Map objectModel, String type) {
+/* public static void setContentType(Map objectModel, String type) {
Response response = (Response)objectModel.get(Constants.RESPONSE_OBJECT);
response.setContentType(type);
}
-
+*/
/**
* Send an HTTP redirect
*
* @param objectModel The Map objectModel
* @param location The location URL
*/
- public static void sendRedirect(Map objectModel, String location) {
+/* public static void sendRedirect(Map objectModel, String location) {
try {
Response response =
(Response)objectModel.get(Constants.RESPONSE_OBJECT);
response.sendRedirect(response.encodeRedirectURL(location));
}
catch (IOException e)
{LogKit.getLoggerFor("cocoon").warn("XSPResponseHelper.sendRedirect", e);}
}
-
+*/
/**
* Encode the URL
*
1.1.2.11 +4 -5
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java
Index: XSPUtil.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- XSPUtil.java 2001/03/30 17:14:21 1.1.2.10
+++ XSPUtil.java 2001/04/18 12:05:49 1.1.2.11
@@ -9,8 +9,6 @@
package org.apache.cocoon.components.language.markup.xsp;
-import javax.servlet.http.HttpSession;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
@@ -35,6 +33,7 @@
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.components.parser.Parser;
import org.apache.cocoon.environment.Context;
+import org.apache.cocoon.environment.Session;
import org.apache.cocoon.util.IOUtils;
import org.apache.cocoon.util.NetUtils;
import org.apache.cocoon.util.Tokenizer;
@@ -47,7 +46,7 @@
* The XSP <code>Utility</code> object helper
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]>Berin Loritsch</a>
- * @version $Revision: 1.1.2.10 $ $Date: 2001/03/30 17:14:21 $
+ * @version $Revision: 1.1.2.11 $ $Date: 2001/04/18 12:05:49 $
*/
public class XSPUtil {
public static String pathComponent(String filename) {
@@ -98,7 +97,7 @@
return buffer.toString();
}
- public static String relativeFilename(String filename, Map objectModel)
+ public static String relativeFilename(String filename, Map objectModel)
throws IOException {
File file = new File(filename);
if (file.isAbsolute()) {
@@ -265,7 +264,7 @@
return ++count;
}
- public static synchronized int getSessionCount(HttpSession session) {
+ public static synchronized int getSessionCount(Session session) {
Integer integer = (Integer)session.getAttribute("util.counter");
if (integer == null) {
integer = new Integer(0);
No revision
No revision
1.1.2.11 +3 -3
xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/response.xsl
Index: response.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/response.xsl,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- response.xsl 2001/03/25 22:21:43 1.1.2.10
+++ response.xsl 2001/04/18 12:05:51 1.1.2.11
@@ -11,7 +11,7 @@
<!--
* @author <a href="mailto:[EMAIL PROTECTED]>Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/25 22:21:43 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/04/18 12:05:51 $
-->
<!-- XSP Response logicsheet for the Java language -->
@@ -50,7 +50,7 @@
XSPResponseHelper.setHeader(objectModel, <xsl:value-of
select="$name"/>, <xsl:value-of select="$value"/>);
</xsp:logic>
</xsl:template>
-
+<!--
<xsl:template match="xsp-response:set-content-type">
<xsl:variable name="type">
<xsl:choose>
@@ -83,7 +83,7 @@
XSPResponseHelper.sendRedirect(objectModel, <xsl:value-of
select="$location"/>);
</xsp:logic>
</xsl:template>
-
+-->
<xsl:template name="get-nested-content">
<xsl:param name="content"/>
<xsl:choose>
No revision
No revision
1.1.2.2 +5 -2
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractStreamPipeline.java
Index: AbstractStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractStreamPipeline.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- AbstractStreamPipeline.java 2001/04/17 10:33:09 1.1.2.1
+++ AbstractStreamPipeline.java 2001/04/18 12:05:52 1.1.2.2
@@ -38,7 +38,7 @@
* resource
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/04/17 10:33:09 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/18 12:05:52 $
*/
public abstract class AbstractStreamPipeline extends AbstractLoggable
implements StreamPipeline, Disposable {
protected EventPipeline eventPipeline;
@@ -173,7 +173,10 @@
environment.setContentType(this.sitemapReaderMimeType);
}
this.reader.setOutputStream(environment.getOutputStream());
- this.reader.generate();
+ int length = this.reader.generate();
+ if (length != 0) {
+ environment.setContentLength(length);
+ }
} catch ( Exception e ) {
throw new ProcessingException("Error reading resource",e);
}
No revision
No revision
1.1.2.2 +4 -4
xml-cocoon/src/org/apache/cocoon/environment/Attic/Context.java
Index: Context.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Context.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Context.java 2001/03/30 17:14:24 1.1.2.1
+++ Context.java 2001/04/18 12:05:53 1.1.2.2
@@ -15,16 +15,16 @@
* Defines an interface to provide client context information .
*
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/03/30 17:14:24 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/18 12:05:53 $
*
*/
public interface Context {
- public Object getAttribute(String name);
+ Object getAttribute(String name);
- public URL getResource(String path) throws MalformedURLException;
+ URL getResource(String path) throws MalformedURLException;
- public java.lang.String getMimeType(String file);
+ String getMimeType(String file);
}
1.1.2.16 +6 -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.15
retrieving revision 1.1.2.16
diff -u -r1.1.2.15 -r1.1.2.16
--- Environment.java 2001/02/21 12:17:06 1.1.2.15
+++ Environment.java 2001/04/18 12:05:54 1.1.2.16
@@ -20,7 +20,7 @@
* Base interface for an environment abstraction
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/21 12:17:06 $
+ * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/04/18 12:05:54 $
*/
public interface Environment extends EntityResolver {
@@ -54,6 +54,11 @@
* Set the content type of the generated resource
*/
void setContentType(String mimeType);
+
+ /**
+ * Set the length of the generated content
+ */
+ void setContentLength(int length);
/**
* Set the response status code
1.1.2.3 +152 -154
xml-cocoon/src/org/apache/cocoon/environment/Attic/Request.java
Index: Request.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Request.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Request.java 2001/04/09 11:15:47 1.1.2.2
+++ Request.java 2001/04/18 12:05:54 1.1.2.3
@@ -14,14 +14,12 @@
import java.util.Enumeration;
import java.util.Locale;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpSession;
-
/**
- * Defines an interface to provide client request information .
- *
+ * Defines an interface to provide client request information .
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/09 11:15:47 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/18 12:05:54 $
*
*/
@@ -30,217 +28,217 @@
/**
*
* Returns the value of the named attribute as an <code>Object</code>,
- * or <code>null</code> if no attribute of the given name exists.
+ * or <code>null</code> if no attribute of the given name exists.
*
- * @param name a <code>String</code> specifying the name of
+ * @param name a <code>String</code> specifying the name of
* the attribute
*
- * @return an <code>Object</code> containing the value
+ * @return an <code>Object</code> containing the value
* of the attribute, or <code>null</code> if
* the attribute does not exist
*
*/
- public Object get(String name);
+ Object get(String name);
/**
*
* Returns the value of the named attribute as an <code>Object</code>,
- * or <code>null</code> if no attribute of the given name exists.
+ * or <code>null</code> if no attribute of the given name exists.
*
- * @param name a <code>String</code> specifying the name of
+ * @param name a <code>String</code> specifying the name of
* the attribute
*
- * @return an <code>Object</code> containing the value
+ * @return an <code>Object</code> containing the value
* of the attribute, or <code>null</code> if
* the attribute does not exist
*
*/
- public Object getAttribute(String name);
-
+ Object getAttribute(String name);
+
/**
* Returns an <code>Enumeration</code> containing the
- * names of the attributes available to this request.
+ * names of the attributes available to this request.
* This method returns an empty <code>Enumeration</code>
* if the request has no attributes available to it.
- *
+ *
*
- * @return an <code>Enumeration</code> of strings
- * containing the names
+ * @return an <code>Enumeration</code> of strings
+ * containing the names
* of the request's attributes
*
*/
- public Enumeration getAttributeNames();
-
+ Enumeration getAttributeNames();
+
/**
* Returns the name of the character encoding used in the body of this
* request. This method returns <code>null</code> if the request
* does not specify a character encoding
- *
+ *
*
- * @return a <code>String</code> containing the name of
+ * @return a <code>String</code> containing the name of
* the chararacter encoding, or <code>null</code>
* if the request does not specify a character
encoding
*
*/
+
+ String getCharacterEncoding();
- public String getCharacterEncoding();
-
/**
- * Returns the length, in bytes, of the request body
+ * Returns the length, in bytes, of the request body
*
- * @return an integer containing the length of the
+ * @return an integer containing the length of the
* request body or -1 if the length is not known
*
*/
- public int getContentLength();
-
+ int getContentLength();
+
/**
* Returns the MIME type of the body of the request
*
- * @return a <code>String</code> containing the name
- * of the MIME type of
+ * @return a <code>String</code> containing the name
+ * of the MIME type of
* the request, or -1 if the type is not known
*
*/
+
+ String getContentType();
- public String getContentType();
-
/**
* Returns the value of a request parameter as a <code>String</code>,
*
- * @param name a <code>String</code> specifying the
+ * @param name a <code>String</code> specifying the
* name of the parameter
*
- * @return a <code>String</code> representing the
+ * @return a <code>String</code> representing the
* single value of the parameter
*
* @see #getParameterValues
*
*/
+
+ String getParameter(String name);
- public String getParameter(String name);
-
/**
*
* Returns an <code>Enumeration</code> of <code>String</code>
* objects containing the names of the parameters contained
- * in this request. If the request has
- * no parameters, the method returns an
- * empty <code>Enumeration</code>.
+ * in this request. If the request has
+ * no parameters, the method returns an
+ * empty <code>Enumeration</code>.
*
* @return an <code>Enumeration</code> of
<code>String</code>
* objects, each <code>String</code> containing
- * the name of a request parameter; or an
+ * the name of a request parameter; or an
* empty <code>Enumeration</code> if the
* request has no parameters
*
*/
-
- public Enumeration getParameterNames();
-
+
+ Enumeration getParameterNames();
+
/**
- * Returns an array of <code>String</code> objects containing
- * all of the values the given request parameter has, or
+ * Returns an array of <code>String</code> objects containing
+ * all of the values the given request parameter has, or
* <code>null</code> if the parameter does not exist.
*
* <p>If the parameter has a single value, the array has a length
* of 1.
*
- * @param name a <code>String</code> containing the name of
+ * @param name a <code>String</code> containing the name of
* the parameter whose value is requested
*
- * @return an array of <code>String</code> objects
+ * @return an array of <code>String</code> objects
* containing the parameter's values
*
* @see #getParameter
*
*/
+
+ String[] getParameterValues(String name);
- public String[] getParameterValues(String name);
-
-
+
/**
* Returns the name and version of the protocol the request uses
- * in the form <i>protocol/majorVersion.minorVersion</i>, for
+ * in the form <i>protocol/majorVersion.minorVersion</i>, for
* example, HTTP/1.1. For HTTP servlets, the value
- * returned is the same as the value of the CGI variable
+ * returned is the same as the value of the CGI variable
* <code>SERVER_PROTOCOL</code>.
*
- * @return a <code>String</code> containing the protocol
+ * @return a <code>String</code> containing the protocol
* name and version number
*
*/
-
- public String getProtocol();
-
+
+ String getProtocol();
+
/**
- * Returns the name of the scheme used to make this request,
+ * Returns the name of the scheme used to make this request,
* for example,
* <code>http</code>, <code>https</code>, or <code>ftp</code>.
* Different schemes have different rules for constructing URLs,
* as noted in RFC 1738.
*
- * @return a <code>String</code> containing the name
+ * @return a <code>String</code> containing the name
* of the scheme used to make this request
*
*/
+
+ String getScheme();
- public String getScheme();
-
/**
* Returns the host name of the server that received the request.
- * For HTTP servlets, same as the value of the CGI variable
+ * For HTTP servlets, same as the value of the CGI variable
* <code>SERVER_NAME</code>.
*
- * @return a <code>String</code> containing the name
+ * @return a <code>String</code> containing the name
* of the server to which the request was sent
*/
- public String getServerName();
-
+ String getServerName();
+
/**
* Returns the port number on which this request was received.
- * For HTTP servlets, same as the value of the CGI variable
+ * For HTTP servlets, same as the value of the CGI variable
* <code>SERVER_PORT</code>.
*
* @return an integer specifying the port number
*
*/
+
+ int getServerPort();
- public int getServerPort();
-
/**
- * Returns the Internet Protocol (IP) address of the client
- * that sent the request. For HTTP servlets, same as the value of the
+ * Returns the Internet Protocol (IP) address of the client
+ * that sent the request. For HTTP servlets, same as the value of the
* CGI variable <code>REMOTE_ADDR</code>.
*
- * @return a <code>String</code> containing the
+ * @return a <code>String</code> containing the
* IP address of the client that sent the request
*
*/
-
- public String getRemoteAddr();
-
+
+ String getRemoteAddr();
+
/**
* Returns the fully qualified name of the client that sent the
* request, or the IP address of the client if the name cannot be
- * determined. For HTTP servlets, same as the value of the CGI variable
+ * determined. For HTTP servlets, same as the value of the CGI variable
* <code>REMOTE_HOST</code>.
*
- * @return a <code>String</code> containing the fully
qualified name
+ * @return a <code>String</code> containing the fully
qualified name
* of the client
*
*/
+
+ String getRemoteHost();
- public String getRemoteHost();
-
/**
*
* Stores an attribute in this request.
- * Attributes are reset between requests.
+ * Attributes are reset between requests.
*
* <p>Attribute names should follow the same conventions as
* package names. Names beginning with <code>java.*</code>,
@@ -248,15 +246,15 @@
* reserved for use by Sun Microsystems.
*
*
- * @param name a <code>String</code> specifying
+ * @param name a <code>String</code> specifying
* the name of the attribute
*
* @param o the <code>Object</code> to be
stored
*
*/
+
+ void setAttribute(String name, Object o);
- public void setAttribute(String name, Object o);
-
/**
*
* Removes an attribute from this request. This method is not
@@ -269,16 +267,16 @@
* reserved for use by Sun Microsystems.
*
*
- * @param name a <code>String</code> specifying
+ * @param name a <code>String</code> specifying
* the name of the attribute to
remove
*
*/
- public void removeAttribute(String name);
-
+ void removeAttribute(String name);
+
/**
*
- * Returns the preferred <code>Locale</code> that the client will
+ * Returns the preferred <code>Locale</code> that the client will
* accept content in, based on the Accept-Language header.
* If the client request doesn't provide an Accept-Language header,
* this method returns the default locale for the server.
@@ -287,9 +285,9 @@
* @return the preferred <code>Locale</code> for the client
*
*/
+
+ Locale getLocale();
- public Locale getLocale();
-
/**
*
* Returns an <code>Enumeration</code> of <code>Locale</code> objects
@@ -297,17 +295,17 @@
* locales that are acceptable to the client based on the Accept-Language
* header.
* If the client request doesn't provide an Accept-Language header,
- * this method returns an <code>Enumeration</code> containing one
+ * this method returns an <code>Enumeration</code> containing one
* <code>Locale</code>, the default locale for the server.
*
*
- * @return an <code>Enumeration</code> of preferred
+ * @return an <code>Enumeration</code> of preferred
* <code>Locale</code> objects for the client
*
*/
+
+ Enumeration getLocales();
- public Enumeration getLocales();
-
/**
*
* Returns a boolean indicating whether this request was made using a
@@ -319,8 +317,8 @@
*
*/
- public boolean isSecure();
-
+ boolean isSecure();
+
/**
*
* Returns an array containing all of the <code>Cookie</code>
@@ -333,16 +331,16 @@
*
*
*/
+
+ Cookie[] getCookies();
- public Cookie[] getCookies();
-
/**
*
* Returns the value of the specified request header
- * as a <code>long</code> value that represents a
+ * as a <code>long</code> value that represents a
* <code>Date</code> object. Use this method with
* headers that contain dates, such as
- * <code>If-Modified-Since</code>.
+ * <code>If-Modified-Since</code>.
*
* <p>The date is returned as
* the number of milliseconds since January 1, 1970 GMT.
@@ -371,8 +369,8 @@
*
*/
- public long getDateHeader(String name);
-
+ long getDateHeader(String name);
+
/**
*
* Returns the value of the specified request header
@@ -390,9 +388,9 @@
* if the request does not
* have a header of that name
*
- */
+ */
- public String getHeader(String name);
+ String getHeader(String name);
/**
*
@@ -418,10 +416,10 @@
* if the request does not
* have any headers of that name
*
- */
+ */
+
+ Enumeration getHeaders(String name);
- public Enumeration getHeaders(String name);
-
/**
*
* Returns an enumeration of all the header names
@@ -441,24 +439,24 @@
* <code>null</code>
*
*/
+
+ Enumeration getHeaderNames();
- public Enumeration getHeaderNames();
-
/**
*
- * Returns the name of the HTTP method with which this
+ * Returns the name of the HTTP method with which this
* request was made, for example, GET, POST, or PUT.
* Same as the value of the CGI variable REQUEST_METHOD.
*
- * @return a <code>String</code>
+ * @return a <code>String</code>
* specifying the name
* of the method with which
* this request was made
*
*/
-
- public String getMethod();
-
+
+ String getMethod();
+
/**
*
* Returns any extra path information associated with
@@ -471,7 +469,7 @@
* <p>Same as the value of the CGI variable PATH_INFO.
*
*
- * @return a <code>String</code> specifying
+ * @return a <code>String</code> specifying
* extra path information that comes
* after the servlet path but before
* the query string in the request URL;
@@ -479,9 +477,9 @@
* any extra path information
*
*/
-
- public String getPathInfo();
-
+
+ String getPathInfo();
+
/**
*
* Returns any extra path information after the servlet name
@@ -499,9 +497,9 @@
*
*
*/
+
+ String getPathTranslated();
- public String getPathTranslated();
-
/**
*
* Returns the portion of the request URI that indicates the context
@@ -517,9 +515,9 @@
*
*
*/
+
+ String getContextPath();
- public String getContextPath();
-
/**
*
* Returns the query string that is contained in the request
@@ -528,20 +526,20 @@
* of the CGI variable QUERY_STRING.
*
* @return a <code>String</code> containing the query
- * string or <code>null</code> if the URL
+ * string or <code>null</code> if the URL
* contains no query string
*
*/
- public String getQueryString();
-
+ String getQueryString();
+
/**
*
* Returns the login of the user making this request, if the
- * user has been authenticated, or <code>null</code> if the user
+ * user has been authenticated, or <code>null</code> if the user
* has not been authenticated.
* Whether the user name is sent with each subsequent request
- * depends on the browser and type of authentication. Same as the
+ * depends on the browser and type of authentication. Same as the
* value of the CGI variable REMOTE_USER.
*
* @return a <code>String</code> specifying the login
@@ -549,9 +547,9 @@
* if the user login is not known
*
*/
+
+ String getRemoteUser();
- public String getRemoteUser();
-
/**
*
* Returns the session ID specified by the client. This may
@@ -571,8 +569,8 @@
*
*/
- public String getRequestedSessionId();
-
+ String getRequestedSessionId();
+
/**
*
* Returns the part of this request's URL from the protocol
@@ -591,37 +589,37 @@
* </blockquote>
*
* @return a <code>String</code> containing
- * the part of the URL from the
+ * the part of the URL from the
* protocol name up to the query string
*
*
*/
+
+ String getRequestURI();
- public String getRequestURI();
-
/**
*
* Returns the part of this request's URL that calls
* the servlet. This includes either the servlet name or
* a path to the servlet, but does not include any extra
- * path information or a query string. Same as the value
+ * path information or a query string. Same as the value
* of the CGI variable SCRIPT_NAME.
*
*
* @return a <code>String</code> containing
* the name or path of the servlet being
- * called, as specified in the request URL
+ * called, as specified in the request URL
*
*
*/
- public String getServletPath();
-
+ String getServletPath();
+
/**
*
* Returns the current <code>HttpSession</code>
* associated with this request or, if if there is no
- * current session and <code>create</code> is true, returns
+ * current session and <code>create</code> is true, returns
* a new session.
*
* <p>If <code>create</code> is <code>false</code>
@@ -629,19 +627,19 @@
* this method returns <code>null</code>.
*
* <p>To make sure the session is properly maintained,
- * you must call this method before
+ * you must call this method before
* the response is committed.
*
*
*
*
* @param <code>true</code> to create
- * a new session for this request if necessary;
+ * a new session for this request if necessary;
* <code>false</code> to return <code>null</code>
* if there's no current session
- *
+ *
*
- * @return the <code>HttpSession</code> associated
+ * @return the <code>HttpSession</code> associated
* with this request or <code>null</code> if
* <code>create</code> is <code>false</code>
* and the request has no valid session
@@ -650,23 +648,23 @@
*
*
*/
+
+ Session getSession(boolean create);
- public HttpSession getSession(boolean create);
-
/**
*
* Returns the current session associated with this request,
* or if the request does not have a session, creates one.
- *
+ *
* @return the <code>HttpSession</code> associated
* with this request
*
* @see #getSession(boolean)
*
*/
+
+ Session getSession();
- public HttpSession getSession();
-
/**
*
* Checks whether the requested session ID is still valid.
@@ -680,9 +678,9 @@
* @see #getSession
*
*/
+
+ boolean isRequestedSessionIdValid();
- public boolean isRequestedSessionIdValid();
-
/**
*
* Checks whether the requested session ID came in as a cookie.
@@ -694,13 +692,13 @@
*
* @see #getSession
*
- */
+ */
+
+ boolean isRequestedSessionIdFromCookie();
- public boolean isRequestedSessionIdFromCookie();
-
/**
*
- * Checks whether the requested session ID came in as part of the
+ * Checks whether the requested session ID came in as part of the
* request URL.
*
* @return <code>true</code> if the session ID
@@ -711,6 +709,6 @@
* @see #getSession
*
*/
-
- public boolean isRequestedSessionIdFromURL();
+
+ boolean isRequestedSessionIdFromURL();
}
1.1.2.4 +67 -117
xml-cocoon/src/org/apache/cocoon/environment/Attic/Response.java
Index: Response.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Response.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- Response.java 2001/04/17 18:18:44 1.1.2.3
+++ Response.java 2001/04/18 12:05:54 1.1.2.4
@@ -11,14 +11,12 @@
import java.util.Locale;
import java.io.IOException;
-import javax.servlet.http.Cookie;
-
-
/**
- * Defines an interface to provide client response information .
- *
+ * Defines an interface to provide client response information .
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/17 18:18:44 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/18 12:05:54 $
*
*/
@@ -39,59 +37,65 @@
* example, <code>ISO-8859-1</code>
*
*/
-
- public String getCharacterEncoding();
-
- /**
- * Sets the length of the content body in the response
- * In HTTP servlets, this method sets the HTTP Content-Length header.
- *
- *
- * @param len an integer specifying the length of the
- * content being returned to the client; sets
- * the Content-Length header
- *
- */
- public void setContentLength(int len);
-
- /**
- * Sets the content type of the response being sent to
- * the client. The content type may include the type of character
- * encoding used, for example, <code>text/html;
charset=ISO-8859-4</code>.
- *
- *
- * @param type a <code>String</code> specifying the MIME
- * type of the content
- *
- */
+ String getCharacterEncoding();
- public void setContentType(String type);
-
/**
* Sets the locale of the response, setting the headers (including the
* Content-Type's charset) as appropriate. By default, the response
locale
* is the default locale for the server.
- *
+ *
* @param loc the locale of the response
*
* @see #getLocale
*
*/
+
+ void setLocale(Locale loc);
- public void setLocale(Locale loc);
-
/**
* Returns the locale assigned to the response.
- *
- *
+ *
+ *
* @see #setLocale
*
*/
- public Locale getLocale();
+ Locale getLocale();
/**
+ * Constructs a cookie with a specified name and value.
+ *
+ * <p>The name must conform to RFC 2109. That means it can contain
+ * only ASCII alphanumeric characters and cannot contain commas,
+ * semicolons, or white space or begin with a $ character. The cookie's
+ * name cannot be changed after creation.
+ *
+ * <p>The value can be anything the server chooses to send. Its
+ * value is probably of interest only to the server. The cookie's
+ * value can be changed after creation with the
+ * <code>setValue</code> method.
+ *
+ * <p>By default, cookies are created according to the Netscape
+ * cookie specification. The version can be changed with the
+ * <code>setVersion</code> method.
+ *
+ *
+ * @param name a <code>String</code> specifying the
name of the cookie
+ *
+ * @param value a <code>String</code> specifying the
value of the cookie
+ *
+ * @throws IllegalArgumentException if the cookie name contains
illegal characters
+ * (for example, a comma, space,
or semicolon)
+ * or it is one of the tokens
reserved for use
+ * by the cookie protocol
+ * @see #setValue
+ * @see #setVersion
+ *
+ */
+ Cookie createCookie(String name, String value);
+
+ /**
* Adds the specified cookie to the response. This method can be called
* multiple times to set more than one cookie.
*
@@ -99,19 +103,19 @@
*
*/
- public void addCookie(Cookie cookie);
+ void addCookie(Cookie cookie);
/**
- * Returns a boolean indicating whether the named response header
+ * Returns a boolean indicating whether the named response header
* has already been set.
- *
+ *
* @param name the header name
- * @return <code>true</code> if the named response header
- * has already been set;
+ * @return <code>true</code> if the named response header
+ * has already been set;
* <code>false</code> otherwise
*/
- public boolean containsHeader(String name);
+ boolean containsHeader(String name);
/**
* Encodes the specified URL by including the session ID in it,
@@ -120,8 +124,8 @@
* determine whether the session ID needs to be encoded in the URL.
* For example, if the browser supports cookies, or session
* tracking is turned off, URL encoding is unnecessary.
- *
- * <p>For robust session tracking, all URLs emitted by a servlet
+ *
+ * <p>For robust session tracking, all URLs emitted by a servlet
* should be run through this
* method. Otherwise, URL rewriting cannot be used with browsers
* which do not support cookies.
@@ -131,83 +135,41 @@
* the unchanged URL otherwise.
*/
- public String encodeURL(String url);
+ String encodeURL(String url);
/**
- * Encodes the specified URL for use in the
- * <code>sendRedirect</code> method or, if encoding is not needed,
- * returns the URL unchanged. The implementation of this method
- * includes the logic to determine whether the session ID
- * needs to be encoded in the URL. Because the rules for making
- * this determination can differ from those used to decide whether to
- * encode a normal link, this method is seperate from the
- * <code>encodeURL</code> method.
- *
- * <p>All URLs sent to the <code>Response.sendRedirect</code>
- * method should be run through this method. Otherwise, URL
- * rewriting cannot be used with browsers which do not support
- * cookies.
*
- * @param url the url to be encoded.
- * @return the encoded URL if encoding is needed;
- * the unchanged URL otherwise.
- *
- * @see #sendRedirect
- */
-
- public String encodeRedirectURL(String url);
-
- /**
- * Sends a temporary redirect response to the client using the
- * specified redirect location URL. This method can accept relative
URLs;
- * the servlet container will convert the relative URL to an absolute URL
- * before sending the response to the client.
- *
- * <p>If the response has already been committed, this method throws
- * an IllegalStateException.
- * After using this method, the response should be considered
- * to be committed and should not be written to.
- *
- * @param location the redirect location URL
- * @exception IOException If an input or output exception occurs
- * @exception IllegalStateException If the response was committed
- */
-
- public void sendRedirect(String location) throws IOException;
-
- /**
- *
* Sets a response header with the given name and
* date-value. The date is specified in terms of
* milliseconds since the epoch. If the header had already
* been set, the new value overwrites the previous one. The
* <code>containsHeader</code> method can be used to test for the
* presence of a header before setting its value.
- *
+ *
* @param name the name of the header to set
* @param value the assigned date value
- *
+ *
* @see #containsHeader
* @see #addDateHeader
*/
- public void setDateHeader(String name, long date);
-
+ void setDateHeader(String name, long date);
+
/**
- *
+ *
* Adds a response header with the given name and
* date-value. The date is specified in terms of
- * milliseconds since the epoch. This method allows response headers
+ * milliseconds since the epoch. This method allows response headers
* to have multiple values.
- *
+ *
* @param name the name of the header to set
* @param value the additional date value
- *
+ *
* @see #setDateHeader
*/
- public void addDateHeader(String name, long date);
-
+ void addDateHeader(String name, long date);
+
/**
*
* Sets a response header with the given name and value.
@@ -215,39 +177,27 @@
* previous one. The <code>containsHeader</code> method can be
* used to test for the presence of a header before setting its
* value.
- *
+ *
* @param name the name of the header
* @param value the header value
*
* @see #containsHeader
* @see #addHeader
*/
+
+ void setHeader(String name, String value);
- public void setHeader(String name, String value);
-
/**
* Adds a response header with the given name and value.
* This method allows response headers to have multiple values.
- *
+ *
* @param name the name of the header
* @param value the additional header value
*
* @see #setHeader
*/
-
- public void addHeader(String name, String value);
-
- /**
- * Sets the status code for this response. This method is used to
- * set the return status code when there is no error (for example,
- * for the status codes SC_OK or SC_MOVED_TEMPORARILY).
- *
- * @param sc the status code
- *
- */
- public void setStatus(int sc);
-
+ void addHeader(String name, String value);
}
No revision
No revision
1.1.2.1 +356 -0
xml-cocoon/src/org/apache/cocoon/environment/Attic/Cookie.java
1.1.2.1 +222 -0
xml-cocoon/src/org/apache/cocoon/environment/Attic/Session.java
No revision
No revision
1.1.2.3 +11 -3
xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/AbstractCommandLineEnvironment.java
Index: AbstractCommandLineEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/AbstractCommandLineEnvironment.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- AbstractCommandLineEnvironment.java 2001/02/21 12:17:10 1.1.2.2
+++ AbstractCommandLineEnvironment.java 2001/04/18 12:05:56 1.1.2.3
@@ -20,14 +20,15 @@
* This environment is used to save the requested file to disk.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/21 12:17:10 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/18 12:05:56 $
*/
public abstract class AbstractCommandLineEnvironment extends
AbstractEnvironment {
protected String contentType;
protected OutputStream stream;
-
+ protected int contentLength;
+
public AbstractCommandLineEnvironment(String uri, String view, File
context, OutputStream stream)
throws MalformedURLException {
super(uri, view, context);
@@ -40,12 +41,19 @@
public void redirect(boolean sessionmode, String newURL) throws
IOException {
throw new RuntimeException (this.getClass().getName() +
".redirect(String url) method not yet implemented!");
}
-
+
/**
* Set the ContentType
*/
public void setContentType(String contentType) {
this.contentType = contentType;
+ }
+
+ /**
+ * Set the ContentLength
+ */
+ public void setContentLength(int contentLength) {
+ this.contentLength = contentLength;
}
/**
1.1.2.12 +6 -12
xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- CommandLineRequest.java 2001/04/12 06:32:56 1.1.2.11
+++ CommandLineRequest.java 2001/04/18 12:05:56 1.1.2.12
@@ -18,16 +18,15 @@
import java.util.Map;
import java.util.Iterator;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpSession;
-
+import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
/**
* Creates a specific servlet request simulation from command line usage.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/04/12 06:32:56 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/04/18 12:05:56 $
*/
/*
@@ -152,7 +151,6 @@
return new EmptyEnumeration();
}
- public BufferedReader getReader() throws IOException { return null; }
public String getCharacterEncoding() { return characterEncoding; }
public int getContentLength() { return -1; }
@@ -167,8 +165,8 @@
public String getRemoteUser() { return System.getProperty("user.name"); }
public Cookie[] getCookies() { return null; }
- public HttpSession getSession() { return null; }
- public HttpSession getSession(boolean create) { return null; }
+ public Session getSession() { return null; }
+ public Session getSession(boolean create) { return null; }
public String getRequestedSessionId() { return null; }
public boolean isRequestedSessionIdValid() { return false; }
public boolean isRequestedSessionIdFromCookie() { return false; }
@@ -184,12 +182,8 @@
public boolean isUserInRole(String role) { return false; }
public java.security.Principal getUserPrincipal() { return null; }
- /** @deprecated */
- public String getRealPath(String path) { return null; }
- /** @deprecated */
- public boolean isRequestedSessionIdFromUrl() { return false; }
public java.util.Map getParameterMap() { return parameters; }
public void setCharacterEncoding(java.lang.String env)
throws java.io.UnsupportedEncodingException {
characterEncoding = env; }
- public java.lang.StringBuffer getRequestURL() { return null; }
+ public StringBuffer getRequestURL() { return null; }
}
1.1.2.7 +3 -27
xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineResponse.java
Index: CommandLineResponse.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineResponse.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- CommandLineResponse.java 2001/03/30 17:14:27 1.1.2.6
+++ CommandLineResponse.java 2001/04/18 12:05:56 1.1.2.7
@@ -13,54 +13,30 @@
import java.io.UnsupportedEncodingException;
import java.util.Locale;
-import javax.servlet.http.Cookie;
+import org.apache.cocoon.environment.Cookie;
import org.apache.cocoon.environment.Response;
/**
* Creates a specific servlet response simulation from command line usage.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/03/30 17:14:27 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/04/18 12:05:56 $
*/
public class CommandLineResponse implements Response {
-
- public PrintWriter getWriter() throws IOException {
- throw new IllegalStateException ("you are not a serializer or
reader");
- }
- public void setContentLength(int len) {}
- public void setContentType(String type) {}
public String getCharacterEncoding() { return null; }
+ public Cookie createCookie(String name, String value) { return null; }
public void addCookie(Cookie cookie) {}
public boolean containsHeader(String name) { return false; }
- public void setStatus(int sc) {}
public void setHeader(String name, String value) {}
public void setIntHeader(String name, int value) {}
public void setDateHeader(String name, long date) {}
- public void sendError(int sc, String msg) throws IOException {}
- public void sendError(int sc) throws IOException {}
- public void sendRedirect(String location) throws IOException {}
public String encodeURL (String url) { return url; }
- public String encodeRedirectURL (String url) { return url; }
- public void setBufferSize(int size) { }
- public int getBufferSize() { return 0; }
- public void flushBuffer() { }
- public boolean isCommitted() { return false; }
- public void reset() { }
public void setLocale(Locale locale) { }
public Locale getLocale() { return null; }
public void addDateHeader(String name, long date) { }
public void addHeader(String name, String value) { }
public void addIntHeader(String name, int value) { }
-
- /** @deprecated */
- public void setStatus(int sc, String sm) {}
- /** @deprecated */
- public String encodeUrl(String url) { return url; }
- /** @deprecated */
- public String encodeRedirectUrl(String url) { return url; }
-
- public void resetBuffer() {};
}
1.1.2.13 +1 -1
xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java
Index: FileSavingEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- FileSavingEnvironment.java 2001/02/23 14:01:26 1.1.2.12
+++ FileSavingEnvironment.java 2001/04/18 12:05:57 1.1.2.13
@@ -26,7 +26,7 @@
* This environment is used to save the requested file to disk.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/23 14:01:26 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/04/18 12:05:57 $
*/
public class FileSavingEnvironment extends AbstractCommandLineEnvironment {
1.1.2.13 +1 -1
xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java
Index: LinkSamplingEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- LinkSamplingEnvironment.java 2001/02/23 14:01:26 1.1.2.12
+++ LinkSamplingEnvironment.java 2001/04/18 12:05:57 1.1.2.13
@@ -35,7 +35,7 @@
* This environment is sample the links of the resource.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/23 14:01:26 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/04/18 12:05:57 $
*/
public class LinkSamplingEnvironment extends AbstractCommandLineEnvironment {
No revision
No revision
1.1.2.23 +13 -6
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.22
retrieving revision 1.1.2.23
diff -u -r1.1.2.22 -r1.1.2.23
--- HttpEnvironment.java 2001/03/30 17:14:28 1.1.2.22
+++ HttpEnvironment.java 2001/04/18 12:05:59 1.1.2.23
@@ -18,10 +18,10 @@
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.AbstractEnvironment;
+import org.apache.cocoon.environment.Session;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -50,9 +50,9 @@
throws MalformedURLException, IOException {
super(uri, req.getParameter(Constants.VIEW_PARAM),
servletContext.getRealPath("/"), req.getParameter(Constants.ACTION_PARAM));
- this.request = new HttpRequest (req, this);
- this.response = new HttpResponse (res);
- this.context = new HttpContext (servletContext);
+ this.request = new HttpRequest (req, this);
+ this.response = new HttpResponse (res);
+ this.context = new HttpContext (servletContext);
this.outputStream = response.getOutputStream();
this.objectModel.put(Constants.REQUEST_OBJECT, this.request);
this.objectModel.put(Constants.RESPONSE_OBJECT, this.response);
@@ -69,8 +69,8 @@
}
// check if session mode shall be activated
if (sessionmode) {
- // The session
- HttpSession session = null;
+ // The session
+ Session session = null;
getLogger().debug("redirect: entering session mode");
String s = request.getRequestedSessionId();
if (s != null) {
@@ -109,6 +109,13 @@
*/
public void setContentType(String contentType) {
this.response.setContentType(contentType);
+ }
+
+ /**
+ * Set the length of the generated content
+ */
+ public void setContentLength(int length) {
+ this.response.setContentLength(length);
}
/**
1.1.2.8 +26 -9
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest22.java
Index: HttpRequest22.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest22.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- HttpRequest22.java 2001/04/12 06:33:31 1.1.2.7
+++ HttpRequest22.java 2001/04/18 12:05:59 1.1.2.8
@@ -17,21 +17,21 @@
import javax.servlet.ServletInputStream;
import javax.servlet.RequestDispatcher;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Cookie;
+import org.apache.cocoon.environment.Session;
/**
* Implements the [EMAIL PROTECTED] javax.servlet.http.HttpServletRequest}
interface
* to provide request information for HTTP servlets.
*
* @author <a href="mailto:[EMAIL PROTECTED],org">Giacomo Pati</a>
- * @version CVS $Id: HttpRequest22.java,v 1.1.2.7 2001/04/12 06:33:31
giacomo Exp $
+ * @version CVS $Id: HttpRequest22.java,v 1.1.2.8 2001/04/18 12:05:59
cziegeler Exp $
*/
-public class HttpRequest implements HttpServletRequest, Request {
+public class HttpRequest implements Request {
/** The real HttpServletRequest object */
private HttpServletRequest req = null;
@@ -80,8 +80,18 @@
return this.req.getAuthType();
}
+ private Cookie[] wrappedCookies = null;
public Cookie[] getCookies() {
- return this.req.getCookies();
+ if (this.wrappedCookies == null) {
+ javax.servlet.http.Cookie[] cookies = this.req.getCookies();
+ if (cookies != null) {
+ this.wrappedCookies = new Cookie[cookies.length];
+ for(int i=0; i<cookies.length;i++) {
+ this.wrappedCookies[i] = new HttpCookie(cookies[i]);
+ }
+ }
+ }
+ return this.wrappedCookies;
}
public long getDateHeader(String name) {
@@ -148,12 +158,19 @@
return this.req.getServletPath();
}
- public HttpSession getSession(boolean create) {
- return this.req.getSession(create);
+ private HttpSession cachedSession = null;
+ public Session getSession(boolean create) {
+ if (this.cachedSession == null) {
+ javax.servlet.http.HttpSession session =
this.req.getSession(create);
+ if (session != null) {
+ this.cachedSession = new HttpSession(session);
+ }
+ }
+ return this.cachedSession;
}
- public HttpSession getSession() {
- return this.req.getSession();
+ public Session getSession() {
+ return this.getSession(true);
}
public boolean isRequestedSessionIdValid() {
1.1.2.7 +1 -1
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest23.java
Index: HttpRequest23.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest23.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- HttpRequest23.java 2001/04/12 06:33:31 1.1.2.6
+++ HttpRequest23.java 2001/04/18 12:05:59 1.1.2.7
@@ -19,7 +19,7 @@
* to provide request information for HTTP servlets.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: HttpRequest23.java,v 1.1.2.6 2001/04/12 06:33:31
giacomo Exp $
+ * @version CVS $Id: HttpRequest23.java,v 1.1.2.7 2001/04/18 12:05:59
cziegeler Exp $
*/
public class HttpRequest extends HttpServletRequestWrapper implements
Request {
1.1.2.4 +21 -4
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpResponse22.java
Index: HttpResponse22.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpResponse22.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- HttpResponse22.java 2001/03/30 17:14:29 1.1.2.3
+++ HttpResponse22.java 2001/04/18 12:05:59 1.1.2.4
@@ -13,11 +13,11 @@
import java.util.Locale;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.Cookie;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.environment.Cookie;
/**
*
@@ -26,7 +26,7 @@
* to access HTTP headers and cookies.
*/
-public class HttpResponse implements HttpServletResponse, Response {
+public class HttpResponse implements Response {
/** The real HttpServletResponse object */
private HttpServletResponse res = null;
@@ -39,10 +39,27 @@
this.res = res;
}
- /* The HttpServletResponse interface methods */
+ /**
+ * Create a new cookie which is not added to the response
+ */
+ public Cookie createCookie(String name, String value) {
+ return new HttpCookie(name, value);
+ }
public void addCookie(Cookie cookie) {
- this.res.addCookie(cookie);
+ if (cookie instanceof HttpCookie) {
+ this.res.addCookie(((HttpCookie)cookie).getServletCookie());
+ } else {
+ javax.servlet.http.Cookie newCookie;
+ newCookie = new javax.servlet.http.Cookie(cookie.getName(),
cookie.getValue());
+ newCookie.setComment(cookie.getComment());
+ newCookie.setDomain(cookie.getDomain());
+ newCookie.setMaxAge(cookie.getMaxAge());
+ newCookie.setPath(cookie.getPath());
+ newCookie.setSecure(cookie.getSecure());
+ newCookie.setVersion(cookie.getVersion());
+ this.res.addCookie(newCookie);
+ }
}
public boolean containsHeader(String name) {
1.1.2.4 +1 -1
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper22.java
Index: RequestWrapper22.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper22.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- RequestWrapper22.java 2001/03/30 17:14:29 1.1.2.3
+++ RequestWrapper22.java 2001/04/18 12:05:59 1.1.2.4
@@ -30,7 +30,7 @@
* to provide request information for HTTP servlets.
*/
-public class RequestWrapper extends MaybeUploadRequestWrapper implements
HttpServletRequest, Request {
+public class RequestWrapper extends MaybeUploadRequestWrapper {
public RequestWrapper(HttpServletRequest httpservletrequest, File file,
boolean flag, boolean flag1)
throws Exception {
1.1.2.4 +1 -1
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper23.java
Index: RequestWrapper23.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper23.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- RequestWrapper23.java 2001/03/30 17:14:29 1.1.2.3
+++ RequestWrapper23.java 2001/04/18 12:05:59 1.1.2.4
@@ -30,7 +30,7 @@
* to provide request information for HTTP servlets.
*/
-public class RequestWrapper extends MaybeUploadRequestWrapper implements
HttpServletRequest, Request {
+public class RequestWrapper extends MaybeUploadRequestWrapper implements
HttpServletRequest {
public RequestWrapper(HttpServletRequest httpservletrequest, File file,
boolean flag, boolean flag1)
throws Exception {
No revision
No revision
1.1.2.1 +465 -0
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpCookie.java
1.1.2.1 +255 -0
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpSession.java
No revision
No revision
1.1.2.14 +2 -3
xml-cocoon/src/org/apache/cocoon/reading/Attic/AbstractReader.java
Index: AbstractReader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/AbstractReader.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- AbstractReader.java 2001/03/19 21:20:37 1.1.2.13
+++ AbstractReader.java 2001/04/18 12:06:01 1.1.2.14
@@ -15,15 +15,14 @@
import org.apache.avalon.configuration.Parameters;
import org.apache.avalon.AbstractLoggable;
-import org.apache.avalon.Poolable;
import org.apache.avalon.Recyclable;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/03/19 21:20:37 $
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/04/18 12:06:01 $
*/
-public abstract class AbstractReader extends AbstractLoggable implements
Poolable, Reader, Recyclable {
+public abstract class AbstractReader extends AbstractLoggable implements
Reader, Recyclable {
/** The current <code>EntityResolver</code>. */
protected EntityResolver resolver=null;
/** The current <code>Map</code> of the object model. */
1.1.2.12 +13 -5
xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java
Index: DatabaseReader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- DatabaseReader.java 2001/04/17 03:55:16 1.1.2.11
+++ DatabaseReader.java 2001/04/18 12:06:01 1.1.2.12
@@ -95,9 +95,10 @@
* Lastly, the <code>key</code> value is derived from the value of
* the <code>source</code> string.
*/
- public void generate() throws ProcessingException, SAXException,
IOException {
+ public int generate() throws ProcessingException, SAXException,
IOException {
DataSourceComponent datasource = null;
Connection con = null;
+ int contentLength = 0;
try {
datasource = (DataSourceComponent) dbselector.select(dsn);
@@ -122,8 +123,7 @@
throw new ResourceNotFoundException("There is no image
with that key");
}
-
response.setContentType(this.parameters.getParameter("content-type", ""));
- this.serialize(object, response);
+ contentLength = this.serialize(object, response);
}
con.commit();
@@ -148,6 +148,7 @@
if (datasource != null) this.dbselector.release((Component)
datasource);
}
+ return contentLength; // length is unknown
}
/**
@@ -211,7 +212,7 @@
/**
* This method actually performs the serialization.
*/
- public void serialize(Blob object, Response response)
+ public int serialize(Blob object, Response response)
throws IOException, SQLException {
if (object == null) {
throw new SQLException("The Blob is empty!");
@@ -219,7 +220,7 @@
InputStream is = new BufferedInputStream(object.getBinaryStream());
- response.setContentLength((int) object.length());
+ int contentLength = (int) object.length();
long expires = parameters.getParameterAsInteger("expires", -1);
if (expires > 0) {
@@ -236,6 +237,8 @@
}
is.close();
out.flush();
+
+ return contentLength;
}
/**
@@ -245,4 +248,9 @@
{
if (this.dbselector != null)
this.manager.release((Component)this.dbselector);
}
+
+ public String getMimeType() {
+ return this.parameters.getParameter("content-type",
super.getMimeType());
+ }
+
}
1.1.2.5 +8 -2
xml-cocoon/src/org/apache/cocoon/reading/Attic/Reader.java
Index: Reader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/Reader.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Reader.java 2000/12/11 16:06:52 1.1.2.4
+++ Reader.java 2001/04/18 12:06:01 1.1.2.5
@@ -18,10 +18,16 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/12/11 16:06:52 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/18 12:06:01 $
*/
public interface Reader extends SitemapModelComponent,
SitemapOutputComponent {
- void generate()
+ /**
+ * Generate the response.
+ * @return The length of the response or <code>0</code> if the length
+ * is unknown.
+ */
+ int generate()
throws IOException, SAXException, ProcessingException;
+
}
1.1.2.27 +10 -13
xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
Index: ResourceReader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
retrieving revision 1.1.2.26
retrieving revision 1.1.2.27
diff -u -r1.1.2.26 -r1.1.2.27
--- ResourceReader.java 2001/04/12 12:30:35 1.1.2.26
+++ ResourceReader.java 2001/04/18 12:06:02 1.1.2.27
@@ -37,7 +37,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.26 $ $Date: 2001/04/12 12:30:35 $
+ * @version CVS $Revision: 1.1.2.27 $ $Date: 2001/04/18 12:06:02 $
*
* The <code>ResourceReader</code> component is used to serve binary data
* in a sitemap pipeline. It makes use of HTTP Headers to determine if
@@ -64,7 +64,7 @@
/**
* Generates the requested resource.
*/
- public void generate() throws IOException, ProcessingException {
+ public int generate() throws IOException, ProcessingException {
Request request = (Request)
objectModel.get(Constants.REQUEST_OBJECT);
Response response = (Response)
objectModel.get(Constants.RESPONSE_OBJECT);
@@ -97,7 +97,7 @@
conn = url.openConnection();
if (!modified (conn.getLastModified(), request, response)) {
- return;
+ return 0;
}
len = conn.getContentLength();
@@ -108,7 +108,7 @@
file = new File (url.getFile());
if (!modified (file.lastModified(), request, response)) {
- return;
+ return 0;
}
len = file.length();
@@ -127,12 +127,6 @@
}
try {
- String mimeType = this.getMimeType();
- if (mimeType != null) {
- response.setContentType(mimeType);
- }
-
- response.setContentLength((int) len);
long expires = parameters.getParameterAsInteger("expires", -1);
if (expires > 0) {
@@ -152,6 +146,7 @@
} catch (IOException ioe) {
getLogger().debug("Received an IOException, assuming client
severed connection on purpose");
}
+ return (int)len;
}
/**
@@ -160,13 +155,15 @@
private boolean modified (long lastModified, Request request, Response
response) {
response.setDateHeader("Last-Modified", lastModified);
long if_modified_since = request.getDateHeader("if-modified-since");
+ boolean isHttpResponse = response instanceof
org.apache.cocoon.environment.http.HttpResponse;
- if (if_modified_since >= lastModified) {
-
response.setStatus(org.apache.cocoon.environment.http.HttpResponse.SC_NOT_MODIFIED);
+ if (if_modified_since >= lastModified && isHttpResponse == true) {
+
((org.apache.cocoon.environment.http.HttpResponse)response).setStatus(
+ javax.servlet.http.HttpServletResponse.SC_NOT_MODIFIED);
}
getLogger().debug("ResourceReader: resource has " +
((if_modified_since < lastModified) ? "" : "not ") + "been modified");
- return (if_modified_since < lastModified);
+ return (if_modified_since < lastModified || isHttpResponse == false);
}
/**
No revision
No revision
1.1.2.6 +3 -4
xml-cocoon/src/org/apache/cocoon/selection/helpers/Attic/CodedSelectorHelper.java
Index: CodedSelectorHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/selection/helpers/Attic/CodedSelectorHelper.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- CodedSelectorHelper.java 2001/03/30 17:14:37 1.1.2.5
+++ CodedSelectorHelper.java 2001/04/18 12:06:04 1.1.2.6
@@ -11,11 +11,10 @@
import java.util.Map;
-import javax.servlet.http.HttpSession;
-
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.Response;
import org.apache.cocoon.environment.Context;
+import org.apache.cocoon.environment.Session;
/**
* This abstract class provides the basis for testing the environment with
@@ -24,7 +23,7 @@
* variables for developer ease.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marcus Crafter</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/03/30 17:14:37 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/18 12:06:04 $
*/
public abstract class CodedSelectorHelper
{
@@ -46,5 +45,5 @@
protected Context context;
protected Request request;
protected Response response;
- protected HttpSession session;
+ protected Session session;
}
No revision
No revision
1.1.2.2 +1 -1 xml-cocoon/webapp/docs/samples/xsp/Attic/cookie.xsp
Index: cookie.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon/webapp/docs/samples/xsp/Attic/cookie.xsp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- cookie.xsp 2001/04/09 20:36:53 1.1.2.1
+++ cookie.xsp 2001/04/18 12:06:05 1.1.2.2
@@ -8,7 +8,7 @@
>
<xsp:structure>
- <xsp:include>javax.servlet.http.Cookie</xsp:include>
+ <xsp:include>org.apache.cocoon.environment.Cookie</xsp:include>
</xsp:structure>
<page>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]