Kawa, the Java-based Scheme system

Node:HTTP requests, Next:HTTP response, Previous:CGI scripts, Up:XML tools

### Functions for accessing HTTP requests

The following functions are useful for accessing properties of a HTTP request, in a Kawa program that is run either as a servlet or a CGI script. These functions can be used from plain Scheme, from KRL (whether in BRL-compatible mode or not), and from XQuery.

If using plain Scheme, you need to do the following before using these functions.

         (require 'http)

This is not needed for KRL or XQuery.

request-method | Function

Returns the method of the HTTP request, usually `"GET"` or `"POST"`. Corresponds to the CGI variable `REQUEST_METHOD`.

request-path-info | Function

Corresponds to the CGI variable `PATH_INFO`.

request-path-translated | Function

Corresponds to the CGI variable `PATH_TRANSLATED`.

request-uri | Function

Returns the URI of the request, not including the query string, or server specification. The is the combination of CGI variables `SCRIPT_NAME` and `PATH_INFO`.

request-url | Function

Returns the complete URL of the request, except the query string.

request-query-string | Function

Returns the query string from an HTTP request. The query string is the part of the request URL after a quetion mark. Returns false if there was no query string. Corresponds to the CGI variable `QUERY_STRING`.