NAME

Lemonldap::NG::Common::PSGI::Request - HTTP request object for Lemonldap::NG PSGIs

SYNOPSIS

package My::PSGI;

use base Lemonldap::NG::Common::PSGI;

# See Lemonldap::NG::Common::PSGI
...

sub handler {
  my ( $self, $req ) = @_;
  # Do something and return a PSGI response
  # NB: $req is a Lemonldap::NG::Common::PSGI::Request object
  if ( $req->accept eq 'text/plain' ) { ... }
  
  return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Body lines' ] ];
}

DESCRIPTION

This package provides HTTP request objects used by Lemonldap::NG PSGIs. It contains common accessors to work with request

METHODS

Accessors

accept

'Accept' header content.

encodings

'Accept-Encoding' header content.

languages

'Accept-Language header content.

cookies

'Cookie' header content.

hostname

'Host' header content.

remote_ip

Client IP address.

port

Client TCP port.

method

HTTP method asked by client (GET/POST/PUT/DELETE).

scriptname

SCRIPT_NAME environment variable provided by HTTP server.

get_server_port

Server port.

path

PATH_INFO content which has been subtracted `scriptname`. So it's the relative path_info for REST calls.

uri

REQUEST_URI environment variable.

unparsed_uri

Same as `uri` but without decoding.

user

REMOTE_USER environment variable. It contains username when a server authentication is done.

userData

Hash reference to be used by Lemonldap::NG::Handler::PSGI. If a server authentication is done, it contains:

{ _whatToTrace => `user()` }

params

GET parameters.

body

Content of POST requests

error

Set if an error occurs

contentType

Content type of posted datas.

contentLength

Length of posted datas.

Private accessors

_psgixBuffered

PSGI psgix.input.buffered variable.

_psgiInput

PSGI psgix.input variable.

Methods

jsonBodyToObj()

Get the content of a JSON POST request as Perl object.

SEE ALSO

http://lemonldap-ng.org/, Lemonldap::NG::Portal, Lemonldap::NG::Handler, Plack, PSGI, Lemonldap::NG::Common::PSGI, Lemonldap::NG::Common::PSGI::Router, HTML::Template,

AUTHORS

Clement Oudot, <clem.oudot@gmail.com>
François-Xavier Deltombe, <fxdeltombe@gmail.com.>
Xavier Guimard, <x.guimard@free.fr>
Thomas Chemineau, <thomas.chemineau@gmail.com>

BUG REPORT

Use OW2 system to report bug or ask for features: http://jira.ow2.org

DOWNLOAD

Lemonldap::NG is available at http://forge.objectweb.org/project/showfiles.php?group_id=274

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.