API:EPrints/Apache/AnApache: Difference between revisions
No edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<!-- Pod2Wiki=_preamble_ | <!-- Pod2Wiki=_preamble_ | ||
This page has been automatically generated from the EPrints 3. | This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. | ||
-->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Apache/AnApache.pm|package_name=EPrints::Apache::AnApache}}[[Category:API|ANAPACHE]][[Category:API:EPrints/Apache|ANAPACHE]]<div><!-- Edit below this comment --> | -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Apache/AnApache.pm|package_name=EPrints::Apache::AnApache}}[[Category:API|ANAPACHE]][[Category:API:EPrints/Apache|ANAPACHE]]<div><!-- Edit below this comment --> | ||
| Line 18: | Line 18: | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
This module provides a number of utility methods for interacting with the request object. | This module provides a number of utility methods for interacting with the request object. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |||
<span style='display:none'>User Comments</span> | |||
<!-- Edit below this comment --> | |||
<!-- Pod2Wiki= --> | |||
</div> | |||
<!-- Pod2Wiki=head_constants --> | |||
==CONSTANTS== | |||
For backwards compatibility - use <tt>HTTP_</tt> constants instead of <tt>:common</tt> constants. | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |||
<span style='display:none'>User Comments</span> | |||
<!-- Edit below this comment --> | |||
<!-- Pod2Wiki= --> | |||
</div> | |||
<!-- Pod2Wiki=item_auth_required --> | |||
===AUTH_REQUIRED=== | |||
Maps to <tt>EPrints::Const::HTTP_UNAUTHORIZED</tt>. Authorization is required to access the requested resource. | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |||
<span style='display:none'>User Comments</span> | |||
<!-- Edit below this comment --> | |||
<!-- Pod2Wiki= --> | |||
</div> | |||
<!-- Pod2Wiki=item_forbidden --> | |||
===FORBIDDEN === | |||
Maps to <tt>EPrints::Const::HTTP_FORBIDDEN</tt>. Access to the requested resource is forbidden. | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |||
<span style='display:none'>User Comments</span> | |||
<!-- Edit below this comment --> | |||
<!-- Pod2Wiki= --> | |||
</div> | |||
<!-- Pod2Wiki=item_server_error --> | |||
===SERVER_ERROR=== | |||
Maps to <tt>EPrints::Const::HTTP_INTERNAL_SERVER_ERROR</tt>. Requesting the resource has caused an internal server error. | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 41: | Line 88: | ||
Send the HTTP header, if needed. | Send the HTTP header, if needed. | ||
$request is the current Apache request. | <tt>$request</tt> is the current Apache request. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 54: | Line 101: | ||
EPrints::Apache::AnApache::header_out( $request, $header, $value ) | EPrints::Apache::AnApache::header_out( $request, $header, $value ) | ||
Set a value in the HTTP headers of the response. $request is the apache request object, $header is the name of the header and $value is the value to give that header. | Set a value in the HTTP headers of the response. <tt>$request</tt> is the apache request object, <tt>$header</tt> is the name of the header and <tt>$value</tt> is the value to give that header. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 108: | Line 155: | ||
EPrints::Apache::AnApache::upload_doc_file( $session, $document, $paramid ); | EPrints::Apache::AnApache::upload_doc_file( $session, $document, $paramid ); | ||
Collect a file named $paramid uploaded via HTTP and add it to the specified $document. | Collect a file named $paramid uploaded via HTTP and add it to the specified <tt>$document</tt>. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 134: | Line 181: | ||
EPrints::Apache::AnApache::send_status_line( $request, $code, $message ) | EPrints::Apache::AnApache::send_status_line( $request, $code, $message ) | ||
Send a HTTP status to the client with $code and $message. | Send a HTTP status to the client with <tt>$code</tt> and <tt>$message</tt>. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | |||
<span style='display:none'>User Comments</span> | |||
<!-- Edit below this comment --> | |||
<!-- Pod2Wiki= --> | |||
</div> | |||
<!-- Pod2Wiki=item_send_hidden_status_line --> | |||
===send_hidden_status_line=== | |||
EPrints::Apache::AnApache::send_hidden_status_line( $request, $code ) | |||
Send a hidden HTTP status to the client with $code. | |||
This is intended for where EPrints already displays a useful error message but a 200 HTTP status code is otherwise logged. | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 149: | Line 211: | ||
Populates the byte-ranges in $chunks requested by the client. | Populates the byte-ranges in $chunks requested by the client. | ||
$maxlength is the length, in bytes, of the resource. | <tt>$maxlength</tt> is the length, in bytes, of the resource. | ||
Returns the appropriate byte-range result code or OK if no | Returns the appropriate byte-range result code or <tt>OK</tt> if no <tt>Range</tt> header is set. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
| Line 162: | Line 224: | ||
<!-- Pod2Wiki=head_copyright --> | <!-- Pod2Wiki=head_copyright --> | ||
==COPYRIGHT== | ==COPYRIGHT== | ||
{{API:Copyright}} | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
<span style='display:none'>User Comments</span> | <span style='display:none'>User Comments</span> | ||
Latest revision as of 12:33, 15 March 2023
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
NAME
EPrints::Apache::AnApache - Utility methods for talking to mod_perl
DESCRIPTION
This module provides a number of utility methods for interacting with the request object.
CONSTANTS
For backwards compatibility - use HTTP_ constants instead of :common constants.
AUTH_REQUIRED
Maps to EPrints::Const::HTTP_UNAUTHORIZED. Authorization is required to access the requested resource.
FORBIDDEN
Maps to EPrints::Const::HTTP_FORBIDDEN. Access to the requested resource is forbidden.
SERVER_ERROR
Maps to EPrints::Const::HTTP_INTERNAL_SERVER_ERROR. Requesting the resource has caused an internal server error.
METHODS
send_http_header
EPrints::Apache::AnApache::send_http_header( $request )
Send the HTTP header, if needed.
$request is the current Apache request.
header_out
EPrints::Apache::AnApache::header_out( $request, $header, $value )
Set a value in the HTTP headers of the response. $request is the apache request object, $header is the name of the header and $value is the value to give that header.
header_in
$value = EPrints::Apache::AnApache::header_in( $request, $header )
Return the specified HTTP header from the current request.
$request
$request = EPrints::Apache::AnApache::get_request
Return the current Apache request object.
cookie
$value = EPrints::Apache::AnApache::cookie( $request, $cookieid )
Return the value of the named cookie, or undef if it is not set.
This avoids using CGI, so does not consume the POST data.
upload_doc_file
EPrints::Apache::AnApache::upload_doc_file( $session, $document, $paramid );
Collect a file named $paramid uploaded via HTTP and add it to the specified $document.
upload_doc_archive
EPrints::Apache::AnApache::upload_doc_archive( $session, $document, $paramid, $archive_format );
Collect an archive file (.ZIP, .tar.gz, etc.) uploaded via HTTP and unpack it then add it to the specified document.
send_status_line
EPrints::Apache::AnApache::send_status_line( $request, $code, $message )
Send a HTTP status to the client with $code and $message.
EPrints::Apache::AnApache::send_hidden_status_line( $request, $code )
Send a hidden HTTP status to the client with $code.
This is intended for where EPrints already displays a useful error message but a 200 HTTP status code is otherwise logged.
ranges
$rc = EPrints::Apache::AnApache::ranges( $r, $maxlength, $chunks )
Populates the byte-ranges in $chunks requested by the client.
$maxlength is the length, in bytes, of the resource.
Returns the appropriate byte-range result code or OK if no Range header is set.
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.