You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/02/21 14:20:11 UTC
cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus WebRequest.java BaseWebRequest.java
vmassol 2003/02/21 05:20:11
Modified: framework/src/java/share/org/apache/cactus WebRequest.java
BaseWebRequest.java
Log:
Refactoring: Moved authentication to BaseWebRequest
Revision Changes Path
1.13 +4 -46 jakarta-cactus/framework/src/java/share/org/apache/cactus/WebRequest.java
Index: WebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/WebRequest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- WebRequest.java 21 Feb 2003 11:12:09 -0000 1.12
+++ WebRequest.java 21 Feb 2003 13:20:11 -0000 1.13
@@ -63,7 +63,6 @@
import org.apache.cactus.client.ConnectionHelper;
import org.apache.cactus.client.ConnectionHelperFactory;
import org.apache.cactus.client.WebResponseObjectFactory;
-import org.apache.cactus.client.authentication.AbstractAuthentication;
import org.apache.cactus.util.ChainedRuntimeException;
import org.apache.cactus.util.WebConfiguration;
@@ -89,34 +88,16 @@
private boolean isAutomaticSession = true;
/**
- * The Authentication Object that will configure the http request
- */
- private AbstractAuthentication authentication;
-
- /**
* Redirector Name. This is to let the user the possibility to override
* the default Redirector Name specified in <code>cactus.properties</code>.
*/
private String redirectorName;
/**
- * Cactus configuration
- */
- private WebConfiguration configuration;
-
- /**
* @param theConfiguration the Cactus configuration
*/
public WebRequest(WebConfiguration theConfiguration)
{
- super();
- this.configuration = theConfiguration;
- }
-
- /**
- * @return the Cactus configuration
*/
- protected WebConfiguration getConfiguration()
- {
- return this.configuration;
+ super(theConfiguration);
}
/**
@@ -141,30 +122,6 @@
}
/**
- * Sets the authentication object that will configure the http request
- *
- * @param theAuthenticationObject the authentication object
- */
- public void setAuthentication(
- AbstractAuthentication theAuthenticationObject)
- {
- this.authentication = theAuthenticationObject;
-
- // Sets the Cactus configuration. It is performed here so that
- // Cactus users do not have to bother with setting it on the
- // Authentication object they create.
- this.authentication.setConfiguration(getConfiguration());
- }
-
- /**
- * @return the authentication object that will configure the http request
- */
- public AbstractAuthentication getAuthentication()
- {
- return this.authentication;
- }
-
- /**
* @param isAutomaticSession whether the redirector servlet will
* automatically create the HTTP session or not. Default is true.
*/
@@ -310,7 +267,8 @@
((WebConfiguration) getConfiguration()).getRedirectorURL(this),
getConfiguration());
- WebRequest request = new WebRequest(getConfiguration());
+ WebRequest request = new WebRequest(
+ (WebConfiguration) getConfiguration());
request.addParameter(HttpServiceDefinition.SERVICE_NAME_PARAM,
ServiceEnumeration.CREATE_SESSION_SERVICE.toString(),
WebRequest.GET_METHOD);
1.2 +53 -1 jakarta-cactus/framework/src/java/share/org/apache/cactus/BaseWebRequest.java
Index: BaseWebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/BaseWebRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseWebRequest.java 21 Feb 2003 11:12:09 -0000 1.1
+++ BaseWebRequest.java 21 Feb 2003 13:20:11 -0000 1.2
@@ -62,7 +62,9 @@
import java.util.Hashtable;
import java.util.Vector;
+import org.apache.cactus.client.authentication.AbstractAuthentication;
import org.apache.cactus.util.ChainedRuntimeException;
+import org.apache.cactus.util.Configuration;
/**
* Contains all HTTP request data for a test case but independently of
@@ -87,6 +89,11 @@
public static final String POST_METHOD = "POST";
/**
+ * Cactus configuration
+ */
+ private Configuration configuration;
+
+ /**
* The request parameters that need to be sent in the body (POST)
*/
private Hashtable parametersPost = new Hashtable();
@@ -117,6 +124,27 @@
private String contentType = "application/x-www-form-urlencoded";
/**
+ * The Authentication Object that will configure the http request
+ */
+ private AbstractAuthentication authentication;
+
+ /**
+ * @param theConfiguration the Cactus configuration
+ */
+ public BaseWebRequest(Configuration theConfiguration)
+ {
+ this.configuration = theConfiguration;
+ }
+
+ /**
+ * @return the Cactus configuration
+ */
+ protected Configuration getConfiguration()
+ {
+ return this.configuration;
+ }
+
+ /**
* Sets the content type that will be set in the http request
*
* @param theContentType the content type
@@ -622,6 +650,30 @@
}
return buffer.toString();
+ }
+
+ /**
+ * Sets the authentication object that will configure the http request
+ *
+ * @param theAuthenticationObject the authentication object
+ */
+ public void setAuthentication(
+ AbstractAuthentication theAuthenticationObject)
+ {
+ this.authentication = theAuthenticationObject;
+
+ // Sets the Cactus configuration. It is performed here so that
+ // Cactus users do not have to bother with setting it on the
+ // Authentication object they create.
+ this.authentication.setConfiguration(getConfiguration());
+ }
+
+ /**
+ * @return the authentication object that will configure the http request
+ */
+ public AbstractAuthentication getAuthentication()
+ {
+ return this.authentication;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org