You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by di...@apache.org on 2001/04/24 19:33:08 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/acting SessionPropagatorAction.java DatabaseAuthenticatorAction.java FormValidatorAction.java SessionInvalidatorAction.java
dims 01/04/24 10:33:07
Modified: src/org/apache/cocoon/acting Tag: xml-cocoon2
DatabaseAuthenticatorAction.java
FormValidatorAction.java
SessionInvalidatorAction.java
Added: src/org/apache/cocoon/acting Tag: xml-cocoon2
SessionPropagatorAction.java
Log:
Patches from Martin Man <Ma...@seznam.cz>
Revision Changes Path
No revision
No revision
1.1.2.6 +39 -13 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.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- DatabaseAuthenticatorAction.java 2001/04/20 20:49:44 1.1.2.5
+++ DatabaseAuthenticatorAction.java 2001/04/24 17:32:55 1.1.2.6
@@ -1,4 +1,4 @@
-// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.5 2001/04/20 20:49:44 bloritsch Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.6 2001/04/24 17:32:55 dims Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -51,9 +51,14 @@
* Additionally all parameters that are
* propagated to the session are made available to the sitemap via {name}
* expression.
+ *
+ * If there is no need to touch the session object, providing just one-time
+ * verification, you can specify action parameter "create-session" to "no" or
+ * "false". No values are then propagated to the sesion and session object is
+ * not verified.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/20 20:49:44 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/24 17:32:55 $
*/
public class DatabaseAuthenticatorAction extends AbstractDatabaseAction
{
@@ -68,17 +73,27 @@
try {
Configuration conf = this.getConfiguration (
parameters.getParameter ("descriptor", null));
+ boolean cs = true;
+ String create_session = parameters.getParameter ("create-session", null);
+ if (create_session != null &&
+ ("no".equals (create_session.trim ()) || "false".equals (create_session.trim ()))) {
+ cs = false;
+ }
+
datasource = this.getDataSource(conf);
conn = datasource.getConnection();
Request req = (Request) objectModel.get(Constants.REQUEST_OBJECT);
/* check request validity */
- if (req == null)
+ if (req == null) {
+ getLogger ().debug ("DBAUTH: no request object");
return null;
+ }
String query = this.getAuthQuery (conf, req);
if (query == null) {
+ getLogger ().debug ("DBAUTH: have not got query");
return null;
}
@@ -88,12 +103,18 @@
ResultSet rs = st.executeQuery (query);
if (rs.next ()) {
getLogger ().debug ("DBAUTH: authorized successfully");
- Session session = req.getSession (false);
- if (session != null)
- session.invalidate ();
- session = req.getSession (true);
- if (session == null)
- return null;
+ Session session = null;
+ if (cs) {
+ session = req.getSession (false);
+ if (session != null)
+ session.invalidate ();
+ session = req.getSession (true);
+ if (session == null)
+ return null;
+ getLogger ().debug ("DBAUTH: session created");
+ } else {
+ getLogger ().debug ("DBAUTH: leaving session untouched");
+ }
HashMap actionMap = this.propagateParameters (conf, rs,
session);
rs.close ();
@@ -139,6 +160,8 @@
request_value = req.getParameter (
request_param);
if (request_value == null || request_value.trim().equals ("")) {
+ getLogger ().debug ("DBAUTH: request-param "
+ + request_param + " does not exist");
return null;
}
if (!first_constraint)
@@ -152,6 +175,7 @@
queryBuffer.append (" WHERE ").append (queryBufferEnd);
return queryBuffer.toString ();
} catch (Exception e) {
+ getLogger ().debug ("DBAUTH: got exception: " + e);
return null;
}
}
@@ -170,8 +194,6 @@
if (session_param != null &&
!session_param.trim().equals ("")) {
String s = rs.getString (i + 1);
- getLogger ().debug ("DBAUTH: propagating param "
- + session_param + "=" + s);
/* propagate to session */
try {
type = select[i].getAttribute ("type");
@@ -190,8 +212,12 @@
} else if ("double".equals (type)) {
Double d = Double.valueOf (s);
o = d;
+ }
+ if (session != null) {
+ session.setAttribute (session_param, o);
+ getLogger ().debug ("DBAUTH: propagating param "
+ + session_param + "=" + s);
}
- session.setAttribute (session_param, o);
map.put (session_param, o);
}
} catch (Exception e) {
@@ -205,5 +231,5 @@
}
}
-// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.5 2001/04/20 20:49:44 bloritsch Exp $
+// $Id: DatabaseAuthenticatorAction.java,v 1.1.2.6 2001/04/24 17:32:55 dims Exp $
// vim: set et ts=4 sw=4:
1.1.2.4 +6 -4 xml-cocoon/src/org/apache/cocoon/acting/Attic/FormValidatorAction.java
Index: FormValidatorAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/FormValidatorAction.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- FormValidatorAction.java 2001/04/20 20:49:44 1.1.2.3
+++ FormValidatorAction.java 2001/04/24 17:32:57 1.1.2.4
@@ -1,4 +1,4 @@
-// $Id: FormValidatorAction.java,v 1.1.2.3 2001/04/20 20:49:44 bloritsch Exp $
+// $Id: FormValidatorAction.java,v 1.1.2.4 2001/04/24 17:32:57 dims Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -35,7 +35,7 @@
* all validated parameters to the sitemap via {name} expression.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/20 20:49:44 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/24 17:32:57 $
*/
public class FormValidatorAction extends AbstractValidatorAction
{
@@ -48,8 +48,10 @@
objectModel.get (Constants.REQUEST_OBJECT);
/* check request validity */
- if (req == null)
+ if (req == null) {
+ getLogger ().debug ("FORMVALIDATOR: no request object");
return null;
+ }
try {
Configuration conf = this.getConfiguration (
@@ -83,5 +85,5 @@
}
}
-// $Id: FormValidatorAction.java,v 1.1.2.3 2001/04/20 20:49:44 bloritsch Exp $
+// $Id: FormValidatorAction.java,v 1.1.2.4 2001/04/24 17:32:57 dims Exp $
// vim: set et ts=4 sw=4:
1.1.2.5 +11 -5 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.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- SessionInvalidatorAction.java 2001/04/20 20:49:45 1.1.2.4
+++ SessionInvalidatorAction.java 2001/04/24 17:32:59 1.1.2.5
@@ -1,4 +1,4 @@
-// $Id: SessionInvalidatorAction.java,v 1.1.2.4 2001/04/20 20:49:45 bloritsch Exp $
+// $Id: SessionInvalidatorAction.java,v 1.1.2.5 2001/04/24 17:32:59 dims Exp $
package org.apache.cocoon.acting;
import java.util.Map;
@@ -23,7 +23,7 @@
* empty map if everything is ok, null otherwise.
*
* @author Martin Man <Martin.Man@seznam.cz>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/20 20:49:45 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/24 17:32:59 $
*/
public class SessionInvalidatorAction extends AbstractAction
{
@@ -37,17 +37,23 @@
HashMap actionMap = new HashMap ();
/* check request validity */
- if (req == null)
+ if (req == null) {
+ getLogger ().debug ("SESSIONINVALIDATOR: no request object");
return null;
+ }
/* check session validity */
Session session = req.getSession (false);
- if (session != null)
+ if (session != null) {
session.invalidate ();
+ getLogger ().debug ("SESSIONINVALIDATOR: session invalidated");
+ } else {
+ getLogger ().debug ("SESSIONINVALIDATOR: no session object");
+ }
return Collections.unmodifiableMap (actionMap);
}
}
-// $Id: SessionInvalidatorAction.java,v 1.1.2.4 2001/04/20 20:49:45 bloritsch Exp $
+// $Id: SessionInvalidatorAction.java,v 1.1.2.5 2001/04/24 17:32:59 dims Exp $
// vim: set et ts=4 sw=4:
No revision
No revision
1.1.2.1 +88 -0 xml-cocoon/src/org/apache/cocoon/acting/Attic/SessionPropagatorAction.java
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org