Processing requests

Implementing a Java CFX tag requires interaction with the Request and Response objects passed to the processRequest method. In addition, CFX tags that need to work with ColdFusion queries also interface with the Query object. The com.allaire.cfx package, located in the WEB-INF/lib/cfx.jar archive, contains the Request, Response, and Query objects.

This section provides an overview of these object types. For a complete description of these object types, see ColdFusion Java CFX Reference in CFML Reference.

For a complete example Java CFX tag that uses Request, Response, and Query objects, see ZipBrowser example.

Request object

The Request object is passed to the processRequest method of the CustomTag interface. The following table lists the methods of the Request object for retrieving attributes, including queries, passed to the tag and for reading global tag settings:

Method Description

attributeExists

Checks whether the attribute was passed to this tag.

debug

Checks whether the tag contains the debug attribute.

getAttribute

Retrieves the value of the passed attribute.

getAttributeList

Retrieves a list of all attributes passed to the tag.

getIntAttribute

Retrieves the value of the passed attribute as an integer.

getQuery

Retrieves the query that was passed to this tag, if any.

getSetting

Retrieves the value of a global custom tag setting.

For detailed reference information on each of these interfaces, see CFML Reference.

Response object

The Response object is passed to the processRequest method of the CustomTag interface. The following table lists the methods of the Response object for writing output, generating queries, and setting variables within the calling page:

Method Description

write

Outputs text to the calling page.

setVariable

Sets a variable in the calling page.

addQuery

Adds a query to the calling page.

writeDebug

Outputs text to the debug stream.

For detailed reference information on each of these interfaces, see CFML Reference.

Query object

The Query object provides an interface for working with ColdFusion queries. The following table lists the methods of the Query object for retrieving name, row count, and column names and methods for getting and setting data elements:

Method Description

getName

Retrieves the name of the query.

getRowCount

Retrieves the number of rows in the query.

getColumnIndex

Retrieves the index of a query column.

getColumns

Retrieves the names of the query columns.

getData

Retrieves a data element from the query.

addRow

Adds a new row to the query.

setData

Sets a data element within the query.

For detailed reference information on each of these interfaces, see CFML Reference.


View comments in LiveDocs