In addition to the more standard CGI-like interface that Mod_Rexx supplies, an object interface is also available. The object interface is composed of three classes and their accompanying methods.
The file Apache.cls contains the class definitions for the object interface to Apache. To use it, just include a ::Requires directive in your Object Rexx program.
When using any of the classes to interface to Apache, you should only use the methods to accesss or set values. Using other external Rexx functions to access the Apache internal structures may cause subsequent problems in your program.
The classes and methods for the object interface are documented below.
The request record class (request_rec) supplies an interface to the Apache internal request record. There are methods for retrieving values from the internal request record and (in some cases) setting the value in the internal request record (which can then be used in a subsequent phase of the request processing). The methods supplied with the class enforce certian rules about how values are retrieved and set in the internal request record in order that the Apache server is always aware of any changes to the request record.
To instantiate a request_rec class use the arg(1) value passed to the Object Rexx program. The following is an example of how to create a request_rec object.
rxptr = arg(1) request = .request_rec~new(rxptr) |
The methods for the request_rec class are documented below.
This method can return a copy of bit vector that the handler or set a new value.
This is a example of how to retrieve a copy of the allowed bits.
allowed = request~allowed |
This is a example of how to set the allowed bits.
allowed = request~allowed(new_allowed) |
This method returns the args (the raw query string).
This is a example of how to retrieve the args field.
argspath = request~args |
None.
Retrieves auth_type field in the request record.
authorization_type = request~auth_type |
None
Retrieves the value to be used to create a connection object. See the documentation on the connection_rec class below.
cxptr = request~connection |
None
This method can return or set the content_encoding field.
This is a example of how to retrieve the content_encoding.
content_encoding = request~content_encoding |
This is a example of how to set the content_encoding field.
content_encoding = request~content_encoding(new_content_encoding) |
This method can return or add a new entry to the content_languages array.
This is a example of how to retrieve the list of content_languages. The list is a comma seperated.
content_languages = request~content_languages |
This is a example of how to add an entry the content_languages array.
content_languages = request~content_languages(new_entry) |
This method can return or set the content_type field.
This is a example of how to retrieve the content_type.
content_type = request~content_type |
This is a example of how to set the content_type field.
content_type = request~content_type(new_content_type) |
This method can return a copy of the outgoing HTTP error header.
This is a example of how to retrieve a copy of the err_header_out field.
err_header_out = request~err_header_out |
This is a example of how to set the headers_out field.
err_header_out = request~err_header_out(new_err_header_out) |
This method can return or set the filename field.
This is a example of how to retrieve the filename field.
filename = request~filename |
This is a example of how to set the filename field.
filename = request~filename(new_filename) |
This method returns the file status bits of the filename field as a hexadecimal string. You can use the Rexx builtin function x2b() to turn it into a bit string for easier examination.
This is a example of how to retrieve the file status bits.
status = request~finfo_stmode /* status = '81ed' */ status = request~finfo_stmode~x2b /* status = '1000000111101101' */ |
None.
This method can return or set the handler field.
This is a example of how to retrieve the handler name.
handler = request~handler |
This is a example of how to set the handler name field.
handler = request~handler(new_handler) |
Returns .true if the request should only return header information. Otherwise it returns .false.
if request~header_only = .true then do /* perform some processing */ end else do /* perform other procesing */ end |
None
This method can return a copy of the incoming HTTP headers.
This is a example of how to retrieve a copy of the headers_in field.
headers_in = request~headers_in |
This is a example of how to set the headers_in field.
headers_in = request~headers_in(new_headers_in) |
This method can return a copy of the outgoing HTTP headers.
This is a example of how to retrieve a copy of the headers_out field.
headers_out = request~headers_out |
This is a example of how to set the headers_out field.
headers_out = request~headers_out(new_headers_out) |
Returns .true if this is the main request object (the first object in a possible chain of request objects). Otherwise it returns .false.
Note: Because of a limitation in the Mod_Rexx package, this method will always return .true.
if request~main = .true then do /* perform some processing */ end else do /* perform other procesing */ end |
None
Retrieves the value to be used to create a request object. In some cases the Apache server can chain requests together. If the current request is a chained request then this method will return a valid pointer to the first request record.
rxptr = request~main |
None
This method can return a copy of the HTTP method name or set its value.
This is a example of how to retrieve a copy of the method name.
if request~method = 'POST' then do /* perform some processing */ end else do /* perform other procesing */ end |
This is a example of how to set the method name.
new_method = request~method('GET') |
This method can return a copy of the HTTP method_number or set its value.
This is a example of how to retrieve a copy of the method_number.
method_number = request~method_number |
This is a example of how to set the method_number.
method_number = request~method_number(new_method_number) |
Retrieves the value to be used to create a request object. In some cases the Apache server can chain requests together. If the current request is a chained request then this method will return a valid pointer to the next request record.
rxptr = request~next |
None
This method can return or the no_cache setting.
This is a example of how to retrieve the no_cache setting.
no_cache = request~no_cache |
None.
This method can return a copy of the notes table.
This is a example of how to retrieve a value in the notes table.
value = request~notes(key) |
This is a example of how to set a value in the notes table.
value = request~notes(key, new_value) |
This method can return or set the path_info field.
This is a example of how to retrieve the path_info field.
path_info = request~path_info |
This is a example of how to set the path_info field.
path_info = request~path_info(new_path_info) |
Retrieves the value to be used to create a request object. In some cases the Apache server can chain requests together. If the current request is a chained request then this method will return a valid pointer to the previous request record.
rxptr = request~prev |
None
Returns a copy of the request protocol name.
protocol = request~protocol if protocol = 'HTTP v1.0' then do /* perform some processing */ end else do /* perform other procesing */ end |
None
Returns .true if the request is a proxy request. Otherwise it returns .false.
if request~proxyreq = .true then do /* perform some processing */ end else do /* perform other procesing */ end |
None
Retrieves the value to be used to create a server object. See the documentation on the server_rec class below.
sxptr = request~server |
None
This method can return a copy of the status or set its value.
This is a example of how to retrieve a copy of the status.
status = request~status |
This is a example of how to set the status.
status = request~status(new_status) |
This method can return a copy of the status line or set its value.
This is a example of how to retrieve a copy of the status line.
status_line = request~status_line |
This is a example of how to set the status line.
status_line = request~status_line(new_status_line) |
This method can return a copy of the subprocess environment.
This is a example of how to retrieve a copy of the subprocess environment.
subprocess_env = request~subprocess_env |
This is a example of how to set the subprocess environment field.
subprocess_env = request~subprocess_env(new_subprocess_env) |
Returns a copy of the HTTP request.
http_request = request~the_request |
None
This method returns the path part of the URI.
This is a example of how to retrieve the uri field.
uripath = request~uri |
None.
Retrieves user field in the request record.
username = request~user |
None
The connection record class (connection_rec) supplies an interface to the Apache internal connection record. There are methods for retrieving values from the internal connection record. The methods supplied with the class enforce certian rules about how values are retrieved and set in the internal connection record in order that the Apache server is always aware of any changes to the connection record.
To instantiate a connection_rec class use the value returned from the request_rec method connection. The following is an example of how to create a connection_rec object.
/* establish the request record object */ rxptr = arg(1) request = .request_rec~new(rxptr) /* now establish the connection record object */ connx = .connection_rec~new(request) |
The methods for the connection_rec class are documented below.
Retrieves aborted field in the connection record.
abort = connx~aborted /* abort is now set to either .true or .false */ |
None
The server record class (connection_rec) supplies an interface to the Apache internal server record. There are methods for retrieving values from the internal server record. The methods supplied with the class enforce certian rules about how values are retrieved and set in the internal server record in order that the Apache server is always aware of any changes to the server record.
To instantiate a server_rec class use the value returned from the request_rec method server. The following is an example of how to create a server_rec object.
/* establish the request record object */ rxptr = arg(1) request = .request_rec~new(rxptr) /* now establish the server record object */ srvr = .server_rec~new(request) |
The methods for the server_rec class are documented below.
Retrieves admin field in the server record.
admin_email_addr = srvr~admin |
None
Retrieves hostname field in the server record.
srvr_host_name = srvr~hostname |
None
Retrieves is_virtual field in the server record.
virtual_srvr = srvr~is_virtual /* if virtual_srvr is set to .true then the request was to a virtual server */ /* if virtual_srvr is set to .false then the request was to the main server */ |
None
Retrieves port field in the server record.
port_num = srvr~port |
None
Copyright (C) W. David Ashley 2004. All Rights Reserved. |