org.apache.commons.latka.jelly
Class RequestTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by org.apache.commons.latka.jelly.RequestTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag

public class RequestTag
extends org.apache.commons.jelly.TagSupport

Author:
Morgan Delagrange

Field Summary
protected  boolean _followRedirects
           
protected  String _host
           
protected  String _httpVersion
           
protected  String _label
           
protected static org.apache.log4j.Category _log
           
protected  int _method
           
protected  String _path
           
protected  int _port
           
protected  String _proxyHost
           
protected  int _proxyPort
           
protected  Request _request
           
protected  boolean _requestExecuted
           
protected  Response _response
           
protected  boolean _secure
           
protected  Session _session
           
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
RequestTag()
           
 
Method Summary
 void doTag(org.apache.commons.jelly.XMLOutput xmlOutput)
          Wraps Latka tests, provides some defaults for host, port etc.
protected  Session findSession()
           
 Request getRequest()
           
 boolean getRequestExecuted()
           
 Response getResponse()
          The first time this method is called, a live HTTP call will be made to the server, returning null if the response cannot be obtained.
protected  SuiteSettings getSuiteSettings()
          get the suite settings from SuiteTag
 void setFollowRedirects(String followRedirects)
          Sets whether or not to transmit the request over SSL.
 void setHost(String host)
          Setter for host
 void setLabel(String label)
          Set the label for this suite
 void setMethod(String method)
          Sets the HTTP method to use.
 void setPath(String path)
          Sets the path of the document on the server, combined with the host and port
 void setPort(int port)
          Setter for port
 void setProxyHost(String host)
          Setter for defaultProxyHost
 void setProxyPort(int port)
          Setter for defaultProxyPort
 void setSecure(String secure)
          Sets whether or not to transmit the request over SSL.
 void setVersion(String version)
          HTTP version to use.
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_host

protected String _host

_port

protected int _port

_proxyHost

protected String _proxyHost

_proxyPort

protected int _proxyPort

_label

protected String _label

_method

protected int _method

_path

protected String _path

_secure

protected boolean _secure

_followRedirects

protected boolean _followRedirects

_httpVersion

protected String _httpVersion

_request

protected Request _request

_response

protected Response _response

_session

protected Session _session

_requestExecuted

protected boolean _requestExecuted

_log

protected static final org.apache.log4j.Category _log
Constructor Detail

RequestTag

public RequestTag()
Method Detail

doTag

public void doTag(org.apache.commons.jelly.XMLOutput xmlOutput)
           throws org.apache.commons.jelly.JellyTagException
Wraps Latka tests, provides some defaults for host, port etc.

Parameters:
xmlOutput - a place to write output
Throws:
org.apache.commons.jelly.JellyTagException - if an HTTP request could not be created

getRequest

public Request getRequest()

findSession

protected Session findSession()

getRequestExecuted

public boolean getRequestExecuted()

getResponse

public Response getResponse()
                     throws LatkaException
The first time this method is called, a live HTTP call will be made to the server, returning null if the response cannot be obtained. Subsequent calls return a cached response.

Returns:
Response for the request specified by the Latka script
Throws:
LatkaException - error creating the Request (unrecoverable)

getSuiteSettings

protected SuiteSettings getSuiteSettings()
get the suite settings from SuiteTag

Returns:
SuiteSettings object

setHost

public void setHost(String host)
Setter for host

Parameters:
host - host for the request

setPort

public void setPort(int port)
Setter for port

Parameters:
port - port for all requests

setProxyHost

public void setProxyHost(String host)
Setter for defaultProxyHost

Parameters:
defaultHost - defaultProxyHost for all requests

setProxyPort

public void setProxyPort(int port)
Setter for defaultProxyPort

Parameters:
defaultPort - defaultProxyPort for all requests

setLabel

public void setLabel(String label)
Set the label for this suite

Parameters:
label - suite label

setMethod

public void setMethod(String method)
               throws UnsupportedOperationException
Sets the HTTP method to use. Supports post, get, and head. Default is "get".

Parameters:
method - set method to post, get or head
Throws:
UnsupportedOperationException - if an unsupported HTTP method is set

setPath

public void setPath(String path)
Sets the path of the document on the server, combined with the host and port

Parameters:
path - Path to the document on the server

setSecure

public void setSecure(String secure)
Sets whether or not to transmit the request over SSL.

Parameters:
secure - whether or not this request is SSL

setFollowRedirects

public void setFollowRedirects(String followRedirects)
Sets whether or not to transmit the request over SSL.

Parameters:
secure - whether or not this request is SSL

setVersion

public void setVersion(String version)
HTTP version to use. Legal values are 1.0 and 1.1. 1.1 is the default.

Parameters:
version - HTTP specification version


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.