Home | Wiki | OI 1.x Docs | OI 2.x Docs OI logo

NAME

OpenInteract2::Response - Information about and actions on an HTTP response

SYNOPSIS

 # Normal usage
 use HTTP::Status qw( RC_OK );
 my $response = OpenInteract2::Response->get_current;
 $response->status( RC_OK );                 # default
 $response->content_type( 'text/html' )      # default
 $response->header( 'X-Powered-By' => 'OpenInteract 2.0' );
 my $cookie = CTX->cookie->create({ name    => 'session',
                                    expires => '+3d',
                                    value   => 'ISDFUASDFHSDAFUE' });
 $response->cookie( 'session', $cookie );
 # Sends the header (including cookies) and content to client
 $response->send;

DESCRIPTION

METHODS

Class Methods

get_current()

set_implementation_type( $type )

get_implementation_type()

new()

Object Methods

content_type( [ $content_type ] )

header( [ $name, $value ] )

remove_header( $name )

cookie( [ $cookie ] )

remove_cookie( $name )

send()

redirect()

Methods for Subclasses

set_file_info()

init()

clear_current()

PROPERTIES

All of the properties can be get and set by their name. For example:

 my $status = $response->status;          # Get the current status
 $response->status( RC_MAN_OVERBOARD );   # Set a new status

status - HTTP status of this response. If not set it will be set to RC_OK (from HTTP::Status) in the controller.

controller - The controller assigned to this response. This is useful for modifying the default template layout, setting the page title, etc. See OpenInteract2::Controller for more information.

return_url - A URL to which the user should return. This is useful for login boxes or other links that you don't want pointing to a particular place without first going through the correct path. For instance, returning from a '/Foo/edit/' you may want to set the return URL to '/Foo/show/' or something else harmless so you don't accidentally submit a new 'edit'. (Redirects are good for this, too.)

When set the response object ensures the given URL is located under the server context; therefore, the value returned from this property is always located under the server context.

send_file - Filename of file to send directly to the user. It is generally a good idea to set the 'Content-Type' header (via add_header()) when doing this.

content - Set the content for this response. Can be a scalar or a reference to a scalar, so the following will wind up displaying the same information:

 my $foo = "Fourscore and seven years ago...";
 $response->content( $foo );
 $response->content( \$foo );

SUBCLASSING

The actual work to send the correct data to the client is accomplished by a subclass of this class. Subclasses must do the following:

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

Class::Factory

OpenInteract2::Response::Apache

OpenInteract2::Response::CGI

OpenInteract2::Response::LWP

OpenInteract2::Response::Standalone

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>

Generated from the OpenInteract 1.99_03 source.


Home | Wiki | OI 1.x Docs | OI 2.x Docs
SourceForge Logo