NAME

Egg::Response - It processes it concerning the response of Egg.

SYNOPSIS

# Access from Egg to this object.
$e->response;  or $e->res;

# Content-Type is set.
$responce->content_type('image/png');

# Contents are output.
$responce->body('Hello, world!');

# An original header is set.
$responce->header( 'X-Orign' => 'foooo' );
  or
$responce->push_header( 'X-Orign' => 'foooo' );

# Redirect
$response->redirect('http://domainname/', 307);

etc..

DESCRIPTION

It is a module that takes charge of the contents output of Egg. 

METHODS

$response->content_type([content type]);

* output content type is set. * Please set $e->config->{content_type}. default is 'text/html'.

$response->no_cache([1 or 0]);

* We will cast a spell so that a browser of the client should not cache it.

$response->set_cache([1 or 0]);

* We will cast a spell so that a browser of the client may cache it.

$response->body([content]); or $response->output([content]);

* It keeps it temporarily until contents are output. * It maintains it internally by the Scalar reference.

$response->create_header( $response->body );

* Response header is assembled and it returns it.

$response->cookie([KEY NAME], [VALUE]);

* Cookie is set with each key.

$response->cookies;

* Set cookie is returned by HASH reference.

$response->clear_cookies;

* All set cookie is canceled.

$response->create_cookies;

* Set-Cookie header is assembled and it returns it.

$response->redirect([URL], [status code]);

* Screen is forward to passed URL. * Status code can be set by the second argument. default is 302.

$response->redirect_page([URL], [MESSAGE], [OPTION]);

* Screen is output and when changing, the fixed form contents are output once. * URL and message and option in argument. * Please pass the option by HASH reference. * Following values can be specified for option.

- wait      = Time until changing the screen every second. default is 0
- alert     = Message is output with alert of JAVA script.
- body_style= style of <body> is defined.
- div_style = style of container is defined.
- h1_style  = background of message and style of frame line are defined.

* Configuration can do default.

In the name of key, it is redirect_page and the content is HAHS reference.
- default_url = Default when URL is not passed.
- default_msg = Default when message is not passed.
- default_wait= Time until changing the screen every second. default is 0
- body_style, div_style, h1_style, etc.

* Setting example.

redirect_page=> {
  default_url => '/',
  default_msg => 'Please wait.',
  default_wait=> 1,
  body_style  => 'background:#FFEDBB; text-align:center;',
  div_style   => 'font-size:12px; border:#D15C24 solid 3px;',
  h1_style    => 'font:bold 20px sans-serif;',
  },

$response->status([status code]);

* HTTP status code that wants to be returned at the end of processing is set. (200, 404, 403, 500 etc..)

$response->headers;

* Accessor to HTTP::Headers object.

SEE ALSO

HTTP::Headers, Egg::Request

AUTHOR

Masatoshi Mizuno, <lt>mizuno@bomcity.com<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2006 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.