Apache2-API
view release on metacpan or search on metacpan
lib/Apache2/API/Request.pm view on Meta::CPAN
This will throw an L<APR::Request::Error> object whenever L</body_status> returns a non-zero value.
Check L<Apache2::Request> and L<APR::Table> for more information.
=head2 body_status
my $int = $req->body_status; # should return 0
Returns the final status code of the body parser.
=head2 brigade_limit
my $int = $req->brigade_limit;
$req->brigade_limit( $int );
Get or set the brigade_limit for the current parser. This limit determines how many bytes of a file upload that the parser may spool into main memory. Uploads exceeding this limit are written directly to disk.
See also L</temp_dir>
=head2 call
Provided with an Apache2 API method name, and optionally with some additional arguments, and this will call that Apache2 method and return its result.
This is designed to allow you to call arbitrary Apache2 method that, possibly, are not covered here.
For example:
my $bitmask = $req->call( 'allow_override_opts' );
It returns whatever value this call returns.
=head2 charset
Returns the charset, if any, found in the HTTP request received and processed upon initialisation of this module object.
So for example, if the HTTP request C<Content-type> is
Content-Type: application/json; charset=utf-8
Then, L</charset> would return C<utf-8>
See also L</type> to retrieve only the content type, i.e without other information such as charset.
See also L</client_api_version> which would contain the requested api version, if any.
See also L<charset> for the charset provided, if any. For example C<utf-8>
=head2 checkonly
This is also an object initialisation property.
If true, this will discard the normal processing of incoming HTTP request under modperl.
This is useful and intended when testing this module offline.
=head2 child_terminate
Terminate the current worker process as soon as the current request is over, by calling L<Apache2::RequestRec/child_terminate>
This is not supported in threaded MPMs.
See L<Apache2::RequestUtil> for more information.
=head2 client_api_version
Returns the client api version requested, if provided. This is set during the object initialisation phase.
An example header to require api version C<1.0> would be:
Accept: application/json; version=1.0; charset=utf-8
In this case, this would return C<1.0>
=head2 close
This close the client connection, by calling L<Apache2::Connection/socket>, which returns a L<APR::Socket>
This is not implemented in by L<APR::Socket>, so this is an efficient work around.
If the socket is writable, it is closed and returns the value from closing it, otherwise returns C<0>
However, a word of caution, you most likely do not need or want to close manually the client connection and instea have your method return Apache2::Const::OK or any other constant matching the HTTP code you want to return.
=head2 code
Sets or gets the response status code, by calling L<Apache2::RequestRec/status>
From the L<Apache2::RequestRec> documentation:
Usually you will set this value indirectly by returning the status code as the handler's function result. However, there are rare instances when you want to trick Apache into thinking that the module returned an C<Apache2::Const::OK> status code, but...
$req->status( $some_code );
return( Apache2::Const::OK );
=head2 connection
Returns a L<Apache2::Connection> object.
=head2 connection_id
Returns the connection id; unique at any point in time by calling L<Apache2::Connection/id>.
See L<Apache2::Connection> for more information.
=head2 content
Returns the content of the file specified with C<< $req->filename >>. It calls L<Apache2::RequestRec/slurp_filename>, but instead of returning a scalar reference, which L<Apache2::RequestRec/slurp_filename> does, it returns the data itself.
See L</slurp_filename> to get a scalar reference instead.
=head2 content_encoding
Returns the value of the C<Content-Encoding> HTTP response header.
See also L</headers>
=head2 content_languages
my $array_ref = $req->content_languages();
my $array_ref = $req->content_languages( $array_reference );
( run in 0.605 second using v1.01-cache-2.11-cpan-56fb94df46f )