vgritsenko 01/08/20 09:31:49
Modified: src/org/apache/cocoon/environment/commandline
CommandLineRequest.java
Added: src/org/apache/cocoon/environment/commandline
CommandLineSession.java
Log:
Add session to CLI
Revision Changes Path
1.6 +5 -2
xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineRequest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CommandLineRequest.java 2001/08/20 13:55:14 1.5
+++ CommandLineRequest.java 2001/08/20 16:31:49 1.6
@@ -25,7 +25,7 @@
* Creates a specific servlet request simulation from command line usage.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/08/20 13:55:14 $
+ * @version CVS $Revision: 1.6 $ $Date: 2001/08/20 16:31:49 $
*/
/*
@@ -64,6 +64,7 @@
private Map parameters;
private Map headers;
private String characterEncoding = null;
+ private CommandLineSession session = new CommandLineSession();
public CommandLineRequest(Environment env, String contextPath, String
servletPath, String pathInfo) {
this(env, contextPath, servletPath, pathInfo, null, null, null);
@@ -173,7 +174,9 @@
public Map getCookieMap() {
return Collections.unmodifiableMap(new HashMap());
}
- public Session getSession() { return null; }
+ public Session getSession() {
+ return session;
+ }
public Session getSession(boolean create) { return null; }
public String getRequestedSessionId() { return null; }
public boolean isRequestedSessionIdValid() { return false; }
1.1
xml-cocoon2/src/org/apache/cocoon/environment/commandline/CommandLineSession.java
Index: CommandLineSession.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.cocoon.environment.commandline;
import org.apache.cocoon.environment.Session;
import java.util.Enumeration;
import java.util.Hashtable;
/**
*
* Command-line version of Http Session.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
* @version CVS $Revision: 1.1 $ $Date: 2001/08/20 16:31:49 $
*/
public final class CommandLineSession
implements Session {
private long creationTime = System.currentTimeMillis();
private Hashtable attributes = new Hashtable();
public CommandLineSession() {
}
public long getCreationTime() {
return this.creationTime;
}
public String getId() {
return "1";
}
public long getLastAccessedTime() {
return this.creationTime;
}
public void setMaxInactiveInterval(int interval) {
// ignored
}
public int getMaxInactiveInterval() {
return -1;
}
public Object getAttribute(String name) {
return this.attributes.get(name);
}
public Enumeration getAttributeNames() {
return this.attributes.keys();
}
public void setAttribute(String name, Object value) {
this.attributes.put(name, value);
}
public void removeAttribute(String name) {
this.attributes.remove(name);
}
public void invalidate() {
this.attributes.clear();
}
public boolean isNew() {
return false;
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]