railo.runtime.tag
Class Http4

java.lang.Object
  extended by railo.runtime.ext.tag.TagImpl
      extended by railo.runtime.ext.tag.BodyTagImpl
          extended by railo.runtime.tag.Http4
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, Http

public final class Http4
extends BodyTagImpl
implements Http

Lets you execute HTTP POST and GET operations on files. Using cfhttp, you can execute standard GET operations and create a query object from a text file. POST operations lets you upload MIME file types to a server, or post cookie, formfield, URL, file, or CGI variables directly to a specified server.


Field Summary
static short MAX_REDIRECT
          Maximum redirect count (5)
static String MULTIPART_FORM_DATA
           
static String MULTIPART_RELATED
           
static int STATUS_REDIRECT_FOUND
          Constant value for HTTP Status Code "Found 302"
static int STATUS_REDIRECT_MOVED_PERMANENTLY
          Constant value for HTTP Status Code "moved Permanently 301"
static int STATUS_REDIRECT_SEE_OTHER
          Constant value for HTTP Status Code "see other 303"
static int STATUS_REDIRECT_TEMPORARY_REDIRECT
           
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
Http4()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 void doInitBody()
           
 int doStartTag()
           
static Object getOutput(InputStream is, String contentType, String contentEncoding, boolean closeIS)
           
 void hasBody(boolean hasBody)
          sets if has body or not
static boolean isGzipEncoded(String contentEncoding)
           
static boolean isStatusOK(int statusCode)
           
static URL locationURL(org.apache.http.client.methods.HttpUriRequest req, org.apache.http.HttpResponse rsp)
           
static String mergePath(String current, String realPath)
          merge to pathes to one
 void release()
           
 void setAddtoken(boolean addtoken)
           
 void setAuthtype(String strAuthType)
           
 void setCharset(String charset)
          set the value charset set the charset for the call.
 void setColumns(String columns)
          set the value columns
 void setDelimiter(String delimiter)
          set the value delimiter Required for creating a query.
 void setDomain(String domain)
           
 void setFile(String file)
          set the value file The filename to be used for the file that is accessed.
 void setFirstrowasheaders(boolean firstrowasheaders)
           
 void setGetasbinary(String getAsBinary)
           
 void setMethod(String method)
          set the value method GET or POST.
 void setMultipart(boolean multiPart)
           
 void setMultiparttype(String multiPartType)
           
 void setName(String name)
          set the value name The name to assign to a query if the a query is constructed from a file.
 void setParam(HttpParamBean param)
           
 void setPassword(String password)
          set the value password When required by a server, a valid password.
 void setPath(String path)
          set the value path The path to the directory in which a file is to be stored.
 void setPort(double port)
          set the value port The port number on the server from which the object is requested.
 void setPreauth(boolean preauth)
           
 void setProxypassword(String proxypassword)
          set the value password When required by a proxy server, a valid password.
 void setProxyport(double proxyport)
          set the value proxyport The port number on the proxy server from which the object is requested.
 void setProxyserver(String proxyserver)
          set the value proxyserver Host name or IP address of a proxy server.
 void setProxyuser(String proxyuser)
          set the value username When required by a proxy server, a valid username.
 void setRedirect(boolean redirect)
          set the value redirect
 void setResolveurl(boolean resolveurl)
          set the value resolveurl Yes or No.
 void setResult(String result)
           
 void setTextqualifier(String textqualifier)
          set the value textqualifier Required for creating a query.
 void setThrowonerror(boolean throwonerror)
          set the value throwonerror Boolean indicating whether to throw an exception that can be caught by using the cftry and cfcatch tags.
 void setTimeout(double timeout)
          set the value timeout
 void setUrl(String url)
          set the value url Full URL of the host name or IP address of the server on which the file resides.
 void setUseragent(String useragent)
          set the value useragent User agent request header.
 void setUsername(String username)
          set the value username When required by a server, a valid username.
 void setWorkstation(String workStation)
           
 
Methods inherited from class railo.runtime.ext.tag.BodyTagImpl
setBodyContent
 
Methods inherited from class railo.runtime.ext.tag.TagImpl
getParent, required, required, required, required, setPageContext, setPageContext, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

MULTIPART_RELATED

public static final String MULTIPART_RELATED
See Also:
Constant Field Values

MULTIPART_FORM_DATA

public static final String MULTIPART_FORM_DATA
See Also:
Constant Field Values

MAX_REDIRECT

public static final short MAX_REDIRECT
Maximum redirect count (5)

See Also:
Constant Field Values

STATUS_REDIRECT_MOVED_PERMANENTLY

public static final int STATUS_REDIRECT_MOVED_PERMANENTLY
Constant value for HTTP Status Code "moved Permanently 301"

See Also:
Constant Field Values

STATUS_REDIRECT_FOUND

public static final int STATUS_REDIRECT_FOUND
Constant value for HTTP Status Code "Found 302"

See Also:
Constant Field Values

STATUS_REDIRECT_SEE_OTHER

public static final int STATUS_REDIRECT_SEE_OTHER
Constant value for HTTP Status Code "see other 303"

See Also:
Constant Field Values

STATUS_REDIRECT_TEMPORARY_REDIRECT

public static final int STATUS_REDIRECT_TEMPORARY_REDIRECT
See Also:
Constant Field Values
Constructor Detail

Http4

public Http4()
Method Detail

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class BodyTagImpl

setFirstrowasheaders

public void setFirstrowasheaders(boolean firstrowasheaders)
Parameters:
firstrowasheaders -

setPassword

public void setPassword(String password)
set the value password When required by a server, a valid password.

Parameters:
password - value to set

setProxypassword

public void setProxypassword(String proxypassword)
set the value password When required by a proxy server, a valid password.

Parameters:
proxypassword - value to set

setDelimiter

public void setDelimiter(String delimiter)
set the value delimiter Required for creating a query. Options are a tab or comma. Default is a comma.

Parameters:
delimiter - value to set

setResolveurl

public void setResolveurl(boolean resolveurl)
set the value resolveurl Yes or No. Default is No. For GET and POST operations, if Yes, page reference returned into the fileContent internal variable has its internal URLs fully resolved, including port number, so that links remain intact.

Parameters:
resolveurl - value to set

setPreauth

public void setPreauth(boolean preauth)

setTimeout

public void setTimeout(double timeout)
                throws ExpressionException
set the value timeout

Parameters:
timeout - value to set
Throws:
ExpressionException

setProxyserver

public void setProxyserver(String proxyserver)
set the value proxyserver Host name or IP address of a proxy server.

Parameters:
proxyserver - value to set

setProxyport

public void setProxyport(double proxyport)
set the value proxyport The port number on the proxy server from which the object is requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document.

Parameters:
proxyport - value to set

setFile

public void setFile(String file)
set the value file The filename to be used for the file that is accessed. For GET operations, defaults to the name pecified in url. Enter path information in the path attribute.

Parameters:
file - value to set

setThrowonerror

public void setThrowonerror(boolean throwonerror)
set the value throwonerror Boolean indicating whether to throw an exception that can be caught by using the cftry and cfcatch tags. The default is NO.

Parameters:
throwonerror - value to set

setCharset

public void setCharset(String charset)
set the value charset set the charset for the call.

Parameters:
charset - value to set

setColumns

public void setColumns(String columns)
                throws PageException
set the value columns

Parameters:
columns - value to set
Throws:
PageException

setPort

public void setPort(double port)
set the value port The port number on the server from which the object is requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. If a port number is specified in the url attribute, the port value overrides the value of the port attribute.

Parameters:
port - value to set

setUseragent

public void setUseragent(String useragent)
set the value useragent User agent request header.

Parameters:
useragent - value to set

setTextqualifier

public void setTextqualifier(String textqualifier)
set the value textqualifier Required for creating a query. Indicates the start and finish of a column. Should be appropriately escaped when embedded in a column. For example, if the qualifier is a double quotation mark, it should be escaped as """". If there is no text qualifier in the file, specify it as " ". Default is the double quotation mark (").

Parameters:
textqualifier - value to set

setProxyuser

public void setProxyuser(String proxyuser)
set the value username When required by a proxy server, a valid username.

Parameters:
proxyuser - value to set

setUsername

public void setUsername(String username)
set the value username When required by a server, a valid username.

Parameters:
username - value to set

setUrl

public void setUrl(String url)
set the value url Full URL of the host name or IP address of the server on which the file resides. The URL must be an absolute URL, including the protocol (http or https) and hostname. It may optionally contain a port number. Port numbers specified in the url attribute override the port attribute.

Parameters:
url - value to set

setRedirect

public void setRedirect(boolean redirect)
set the value redirect

Parameters:
redirect - value to set

setPath

public void setPath(String path)
set the value path The path to the directory in which a file is to be stored. If a path is not specified in a POST or GET operation, a variable is created (cfhttp.fileContent) that you can use to display the results of the POST operation in a cfoutput.

Parameters:
path - value to set

setName

public void setName(String name)
set the value name The name to assign to a query if the a query is constructed from a file.

Parameters:
name - value to set

setAuthtype

public void setAuthtype(String strAuthType)
                 throws ExpressionException
Throws:
ExpressionException

setWorkstation

public void setWorkstation(String workStation)

setDomain

public void setDomain(String domain)

setMethod

public void setMethod(String method)
               throws ApplicationException
set the value method GET or POST. Use GET to download a text or binary file or to create a query from the contents of a text file. Use POST to send information to a server page or a CGI program for processing. POST requires the use of a cfhttpparam tag.

Parameters:
method - value to set
Throws:
ApplicationException

doStartTag

public int doStartTag()
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class TagImpl

doEndTag

public int doEndTag()
             throws PageException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class TagImpl
Throws:
PageException

isStatusOK

public static boolean isStatusOK(int statusCode)

doInitBody

public void doInitBody()
Specified by:
doInitBody in interface javax.servlet.jsp.tagext.BodyTag
Overrides:
doInitBody in class BodyTagImpl

doAfterBody

public int doAfterBody()
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class BodyTagImpl

hasBody

public void hasBody(boolean hasBody)
sets if has body or not

Parameters:
hasBody -

setParam

public void setParam(HttpParamBean param)
Specified by:
setParam in interface Http
Parameters:
param -

setGetasbinary

public void setGetasbinary(String getAsBinary)
Parameters:
getAsBinary - The getasbinary to set.

setMultipart

public void setMultipart(boolean multiPart)
Parameters:
multipart - The multipart to set.

setMultiparttype

public void setMultiparttype(String multiPartType)
                      throws ApplicationException
Parameters:
multipart - The multipart to set.
Throws:
ApplicationException

setResult

public void setResult(String result)
Parameters:
result - The result to set.

setAddtoken

public void setAddtoken(boolean addtoken)
Parameters:
addtoken - the addtoken to set

mergePath

public static String mergePath(String current,
                               String realPath)
                        throws MalformedURLException
merge to pathes to one

Parameters:
current -
realPath -
Returns:
Throws:
MalformedURLException

isGzipEncoded

public static boolean isGzipEncoded(String contentEncoding)

getOutput

public static Object getOutput(InputStream is,
                               String contentType,
                               String contentEncoding,
                               boolean closeIS)

locationURL

public static URL locationURL(org.apache.http.client.methods.HttpUriRequest req,
                              org.apache.http.HttpResponse rsp)


Copyright © 2012 Railo