Generates an HTTP request and handles the response from the server. Internet protocol tags. Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. Three attributes added - authType, domain, and workstation.
|Published (Last):||7 January 2013|
|PDF File Size:||3.97 Mb|
|ePub File Size:||10.9 Mb|
|Price:||Free* [*Free Regsitration Required]|
Generates an HTTP request and handles the response from the server. Internet protocol tags. Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. Three attributes added - authType, domain, and workstation. ColdFusion MX 7. Uses the http protocol. Address of the resource on the server that handles the request.
If you specify a port number in this attribute, it overrides any port attribute value. The character encoding of the request, including the URL query string and form or file data, and the response. The following list includes commonly used values:. The target webserver's compression status. The only supported value is none.
Combined with username to form a base64 encoded string that is passed in the Authenticate header. Does not provide support for Integrated Windows or Kerebos authentication. Port number on the server to which to send the request.
A port value in the url attribute overrides this value. Host name or IP address of a proxy server to which to send the request. User name to provide to the proxy server. If the response header includes a Location field AND ColdFusion receives a series redirection status code, specifies whether to redirect execution to the URL specified in the field:. Value, in seconds, that is the maximum time the request can take.
If the time-out passes without a response, ColdFusion considers the request to have failed. If the client specifies a time-out in the URL search parameter for example,? If the URL does not specify a time-out, ColdFusion uses the lesser of the Administrator time-out and the timeout attribute value. If the time-out is not set in any of these, ColdFusion waits indefinitely for the cfhttp request to process.
Text to put in the user agent request header. Used to identify the request client software. Can make the ColdFusion application appear to be a browser. Combined with password to form a base64 encoded string that is passed in the Authenticate header.
Does not provide support for Integrated Windows or Kerberos authentication. If yes, ColdFusion also sends the request's charset in each Content-Type description. Some http parsers, including the one used by previous versions of ColdFusion, ignore the multipart form field character encoding description. The following attribute sets a multipart header field and is used, for example, for uploading videos on YouTube. Allows you to set the multipart header field to related or form-data.
By default, the value is form-data. The following attribute allows you to specify the name of the variable in which you would like the results of the operation returned. Name of the file in which to store the response body. Do not specify the path to the directory in this attribute; use the path attribute. Contains the absolute path to the directory in which to store the file. In-memory files speed processing of transient data. Create the directories in the path before you can use them.
The column names for the query, separated by commas, with no spaces. Column names must start with a letter. If there are no column name headers in the response, specify this attribute to identify the column names.
If you specify this attribute, and the firstrowasHeader attribute is True the default , the column names specified by this attribute replace the first line of the response. You can use this behavior to replace the column names retrieved by the request with your own names.
If a duplicate column heading is encountered in either this attribute or in the column names from the response, ColdFusion appends an underscore to the name to make it unique. If the number of columns specified by this attribute does not equal the number of columns in the HTTP response body, ColdFusion generates an error. A character that separates query columns.
The response body must use this character to separate the query columns. A character that, optionally, specifies the start and end of a text column. This character must surround any text fields in the response body that contain the delimiter character as part of the field value.
To include this character in column text, escape it by using two characters in place of one. For example, if the qualifier is a double-quotation mark, escape it as "". It enables you to generate most standard HTTP request types. If the body text is structured as a result set, ColdFusion can put the body text in query object. You can also access the values of all returned headers and specify how to handle error status and redirections, and specify a time-out to prevent requests from hanging.
Possible uses include:. Run the following command in the same directory keytool. Response character character set character encoding specified by the response Content-Type header. If the connection to the HTTP server fails, contains details about the failure. For instance: "Unknown host: my. Response body; for example, the contents of an html page retrieved by a GET operation.
Empty if you save the response in a file. Raw response header containing all header information in a single string. Contains the same information as the cfhttp. The response headers formatted into a structure. If there is more than one instance of a header type, the type values are put in an array.
One common technique is to dynamically access the cfhttp. Boolean; true if the response body content type is text. ColdFusion recognizes the response body as text in the following situations:.
To do so, the response body must consist of lines of text, with each line having fields that are delimited by a character that identifies the column breaks. The default delimiter is a comma ,. The response data can also use a text qualifier; the default is a double-quotation mark ".
If you surround a string field in the text qualifier, the field can contain the delimiter character. To include the text qualifier in field text, escape it by using a double character. The following line shows a two-line request body that is converted into a query. It has three comma-delimited fields:.
Select an article: Select an article:. Applies to: ColdFusion. ColdFusion MX 6. Modified response body content types considered to be text. Changed behavior for multiple headers: multiple headers of the same type are returned in an array. Fixed bugs in code and documentation. ColdFusion recognizes the response body as text if: the header does not specify a content type.
If ColdFusion does not recognize the body as text and converts it to an object, but the body consists of text, the cfoutput tag can display it. The cfoutput tag cannot display Binary type data. To convert binary data to text, use the ToString function.
POST: sends information to the server for processing. Requires one or more cfhttpparam tags. Often used for submitting form-like data. Use this method to send files to the server. Use this method for testing hypertext links for validity and accessibility, determining the type or modification time of a document, or determining the type of server. Trace requests cannot have bodies. This method enables the ColdFusion application to see what is being received at the server, and use that data for testing or diagnostic information.
This method enables the ColdFusion application to determine the options and requirements associated with a URL, or the capabilities of a server, without requesting any additional activity by the server.
Use this method to modify parts of the resource whereas use PUT method to completely replace the resource at the specified URL. The cfhttp. Location variable contains the redirection path.
Putting cfhttp to Use
Using cfhttp to interact with the web
Using cfhttp, you can execute standard GET operations and create a query object from a text file. The workstation the authentication request is originating from. Essentially, the computer name for this machine. This attribute is only used when authentication type is "NTLM". Boolean indicating whether to throw an exception that can be caught by using the cftry and cfcatch tags.
Subscribe to RSS
The first example demonstrates a simple GET operation. Listing This example fetches the index page from www. Figure Results from the main index page being pulled from the Wired site.
Practical Uses of HTTP in ColdFusion
Generates an HTTP request and parses the response from the server into a structure. Usually a string, but could also be a Byte Array. Address of the resource on the server which will handle the request. If you specify a port number in this attribute, it overrides any port attribute value.