morgand 2002/10/11 14:15:01
Modified: latka/src/java/org/apache/commons/latka/jelly
RequestTag.java ValidateTag.java
Log:
simplified request generation
Revision Changes Path
1.7 +13 -12
jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java
Index: RequestTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RequestTag.java 10 Oct 2002 19:35:43 -0000 1.6
+++ RequestTag.java 11 Oct 2002 21:15:01 -0000 1.7
@@ -115,19 +115,18 @@
* @throws Exception when any error occurs
*/
public void doTag(XMLOutput xmlOutput) throws Exception {
-
- // may set headers and such
- invokeBody(xmlOutput);
+ _request = createRequest();
LatkaEventInfo listener =
JellyUtils.getInstance().getLatkaEventInfo(getContext());
if (listener.didSessionSucceed(findSession()) == false) {
- if (_requestExecuted == false) {
- listener.requestSkipped(new
RequestSkippedEvent(createRequest(),null));
- }
+ listener.requestSkipped(new RequestSkippedEvent(_request,null));
return;
}
+ // may set headers and such
+ invokeBody(xmlOutput);
+
// even when there are no validations, we execute the request
// to make sure the URL is accessible
@@ -149,7 +148,7 @@
* Error creating the request (unrecoverable, the script
* must fail)
*/
- public Request createRequest() throws LatkaException {
+ private Request createRequest() throws LatkaException {
String host = _host;
int port = _port;
String proxyHost = _proxyHost;
@@ -187,6 +186,10 @@
return
session.createRequest(_label,url,_method,_httpVersion,_followRedirects,proxy);
}
+ public Request getRequest() {
+ return _request;
+ }
+
protected Session findSession() {
if (_session == null) {
SessionTag tag = (SessionTag) findAncestorWithClass(SessionTag.class);
@@ -217,8 +220,6 @@
public Response getResponse() throws LatkaException {
if (_requestExecuted == false) {
_requestExecuted = true;
-
- _request = createRequest();
LatkaEventInfo listener =
JellyUtils.getInstance().getLatkaEventInfo(getContext());
1.4 +3 -12
jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java
Index: ValidateTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValidateTag.java 10 Oct 2002 19:35:43 -0000 1.3
+++ ValidateTag.java 11 Oct 2002 21:15:01 -0000 1.4
@@ -84,15 +84,6 @@
*/
public void doTag(XMLOutput xmlOutput) throws Exception {
- RequestTag tag = (RequestTag) findAncestorWithClass(RequestTag.class);
- LatkaEventInfo info =
- JellyUtils.getInstance().getLatkaEventInfo(getContext());
- if (info.didSessionSucceed(tag.findSession()) == false) {
- // the session is invalid, so return to the request tag,
- // which will issue a RequestSkipped event
- return;
- }
-
// execute the request
Response response = getResponse();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>