cfservlet

Description

Executes a Java servlet on a JRun engine. This tag is used in conjunction with the cfserletparam tag, which passes data to the servlet.

Category

Java servlet and Java object tags

Syntax


<cfservlet code = "class name of servlet"

  jrunProxy = "proxy server"

  timeout = "timeout in seconds"

  writeOutput = "Yes" or "No"

  debug = "Yes" or "No">

    <cfservletparam name = "parameter name" 

      value = "value"> 

  ...

</cfservlet> 

See also

cfobject, cfservletparam

Attributes

Attribute
Description
code
Required. The class name of the Java servlet to execute.
jrunProxy
Optional. A remote computer where the JRun engine is executing. By default, the JRun engine is assumed to be on the host running ColdFusion. To indicate the name of a remote host, specify the IP address of the remote host followed by a colon and the port number at which JRun is listening. By default, for the JCP server, JRun 2.3.3 listens at port 8081; JRun 3.0 listens at port 51000.
timeout
Optional. Specifies how many seconds JRun waits for the servlet to complete before timing out.
writeOutput
Optional. Boolean specifying whether the text output of the tag should appear as inline text on the generated page or returned inside a ColdFusion variable for further processing . The default value, Yes, means output is returned as text to appear inline on the generated page.
Setting it to No means no visible text is returned but, instead, the text is returned as the value of the cfservlet.output variable. See the Usage section for more information.
debug
Optional. Boolean specifying whether additional information about the JRun connection status and activity is to be written to the JRun error log. For JRun 2.3.3, the error log is in:

jrunhomedir/jsm-default/logs/stderr.log 

For JRun 3.0, the error log is in:

jrunhomedir/logs/jrunservername_event.log 

Where jrunservername can be default, admin, or the name of another JRun server that you are running on.
Reading the log file is helpful for debugging server-side problems. The default is No.

Usage

The syntax of the cfservlet tag is consistent with the HTML markup servlet and param tags used by some Web servers to invoke Java servlets from .shtml pages in Server-Side Includes (SSI).
Variable Name
Description
cfservlet.output
Inline text output of the servlet is directed to this structure if the writeOutput attribute is set to No.
cfservlet.servletResponseHeaderName
The cfservlet return structure also contains the values of any response headers returned by the servlet. To access a response header, specify its name in servletResponseHeaderName.

The servlet must exist somewhere in the class path of the JRun engine executing the servlet. For JRun 2.3.3, the JRun servlets subdirectory is a good location, because it is already in the JRun class path, and because classes in this directory are automatically reloaded by JRun if they change.

For JRun 3.0, you can store store servlets in the servlets subdirectory, or in jrun/servers/default/default-app/WEB-INF/classes.

Example

<cfservlet code = "myservletname" 

  jrunProxy = "236.3.3.4:8083" 

  timeout = "300"

  writeOutput = "yes">

  <cfservletparam name = "param1" value = "value1"> 

  <cfservletparam name = "param2" value = "value2">

  <cfservletparam name = "attribute1" variable = "cfvar1">

  <cfservletparam name = "attribute2" variable = "cfvar2">

</cfservlet>



Banner.Novgorod.Ru