<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,6 +21,8 @@ This file documents the revision history for Perl extension Mojo.
         - Added support for MOJO_CHUNK_SIZE=1. (melo)
         - Added not_found.html.* templates.
         - Added input streaming support to Mojo::Content.
+        - Added client, pause, redirect_to and resume to
+          Mojolicious::Controller.
         - Updated Mojolicious lite_app generator to use .ep templates.
         - Fixed many bugs in the HTTP 1.1 state machine and added the ability
           to pause transactions.</diff>
      <filename>Changes</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,9 @@ sub new {
     $self-&gt;static-&gt;root($self-&gt;home-&gt;rel_dir('public'));
 
     # Hide our methods
-    $self-&gt;routes-&gt;hide(qw/render_inner render_partial render_text url_for/);
+    $self-&gt;routes-&gt;hide(qw/client pause redirect_to render_json/);
+    $self-&gt;routes-&gt;hide(qw/render_inner render_partial render_text resume/);
+    $self-&gt;routes-&gt;hide('url_for');
 
     # Mode
     my $mode = $self-&gt;mode;</diff>
      <filename>lib/Mojolicious.pm</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,39 @@ use warnings;
 
 use base 'MojoX::Dispatcher::Routes::Controller';
 
+use Mojo::URL;
+
 # Space: It seems to go on and on forever...
 # but then you get to the end and a gorilla starts throwing barrels at you.
+sub client { shift-&gt;app-&gt;client }
+
+sub pause { shift-&gt;tx-&gt;pause }
+
+sub redirect_to {
+    my ($self, $target) = @_;
+
+    # Prepare location
+    my $base     = $self-&gt;req-&gt;url-&gt;base-&gt;clone;
+    my $location = Mojo::URL-&gt;new-&gt;base($base);
+
+    # Path
+    if ($target =~ /^\//) { $location-&gt;path($target) }
+
+    # URL
+    elsif ($target =~ /^\w+\:\/\//) { $location = $target }
+
+    # Named
+    else { $location = $self-&gt;url_for($target) }
+
+    # Code
+    $self-&gt;res-&gt;code(302);
+
+    # Location header
+    $self-&gt;res-&gt;headers-&gt;location($location);
+
+    return $self;
+}
+
 sub render {
     my $self = shift;
 
@@ -67,6 +98,8 @@ sub render_text {
     return $self-&gt;render(@_);
 }
 
+sub resume { shift-&gt;tx-&gt;resume }
+
 sub url_for {
     my $self = shift;
 
@@ -113,6 +146,20 @@ L&lt;Mojolicious::Controller&gt; inherits all methods from
 L&lt;MojoX::Dispatcher::Routes::Controller&gt; and implements the following new
 ones.
 
+=head2 C&lt;client&gt;
+
+    my $client = $c-&gt;client;
+
+=head2 C&lt;pause&gt;
+
+    $c-&gt;pause;
+
+=head2 C&lt;redirect_to&gt;
+
+    $c = $c-&gt;redirect_to('named');
+    $c = $c-&gt;redirect_to('/path');
+    $c = $c-&gt;redirect_to('http://127.0.0.1/foo/bar');
+
 =head2 C&lt;render&gt;
 
     $c-&gt;render;
@@ -146,6 +193,10 @@ ones.
     $c-&gt;render_text('Hello World!');
     $c-&gt;render_text('Hello World', layout =&gt; 'green');
 
+=head2 C&lt;resume&gt;
+
+    $c-&gt;resume;
+
 =head2 C&lt;url_for&gt;
 
     my $url = $c-&gt;url_for;</diff>
      <filename>lib/Mojolicious/Controller.pm</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ use warnings;
 
 use utf8;
 
-use Test::More tests =&gt; 98;
+use Test::More tests =&gt; 117;
 
 # Wait you're the only friend I have...
 # You really want a robot for a friend?
@@ -102,10 +102,39 @@ app-&gt;renderer-&gt;add_helper(
 # GET /eperror
 get '/eperror' =&gt; sub { shift-&gt;render(handler =&gt; 'ep') } =&gt; 'eperror';
 
+# GET /subrequest
+get '/subrequest' =&gt; sub {
+    my $self = shift;
+    $self-&gt;pause;
+    $self-&gt;client-&gt;post(
+        '/template' =&gt; sub {
+            my ($client, $tx) = @_;
+            $self-&gt;resume;
+            $self-&gt;render_text($tx-&gt;res-&gt;body);
+        }
+    )-&gt;process;
+};
+
+# GET /redirect_url
+get '/redirect_url' =&gt; sub {
+    shift-&gt;redirect_to('http://127.0.0.1/foo')-&gt;render_text('Redirecting!');
+};
+
+# GET /redirect_path
+get '/redirect_path' =&gt; sub {
+    shift-&gt;redirect_to('/foo/bar')-&gt;render_text('Redirecting!');
+};
+
+# GET /redirect_named
+get '/redirect_named' =&gt; sub {
+    shift-&gt;redirect_to('index')-&gt;render_text('Redirecting!');
+};
+
 # Oh Fry, I love you more than the moon, and the stars,
 # and the POETIC IMAGE NUMBER 137 NOT FOUND
 my $app = Mojolicious::Lite-&gt;new;
 my $client = Mojo::Client-&gt;new(app =&gt; $app);
+$app-&gt;client($client);
 
 # GET /outerlayout
 $client-&gt;get(
@@ -386,6 +415,53 @@ $client-&gt;get(
 )-&gt;process;
 $app-&gt;log-&gt;level($level);
 
+# GET /subrequest
+$client-&gt;get(
+    '/subrequest' =&gt; sub {
+        my ($self, $tx) = @_;
+        is($tx-&gt;res-&gt;code,                            200);
+        is($tx-&gt;res-&gt;headers-&gt;server,                 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;header('X-Powered-By'), 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;body,                            'Just works!');
+    }
+)-&gt;process;
+
+# GET /redirect_url
+$client-&gt;get(
+    '/redirect_url' =&gt; sub {
+        my ($self, $tx) = @_;
+        is($tx-&gt;res-&gt;code,                            302);
+        is($tx-&gt;res-&gt;headers-&gt;server,                 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;header('X-Powered-By'), 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;location,               'http://127.0.0.1/foo');
+        is($tx-&gt;res-&gt;body,                            'Redirecting!');
+    }
+)-&gt;process;
+
+# GET /redirect_path
+$client-&gt;get(
+    '/redirect_path' =&gt; sub {
+        my ($self, $tx) = @_;
+        is($tx-&gt;res-&gt;code,                            302);
+        is($tx-&gt;res-&gt;headers-&gt;server,                 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;header('X-Powered-By'), 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;location,               '/foo/bar');
+        is($tx-&gt;res-&gt;body,                            'Redirecting!');
+    }
+)-&gt;process;
+
+# GET /redirect_named
+$client-&gt;get(
+    '/redirect_named' =&gt; sub {
+        my ($self, $tx) = @_;
+        is($tx-&gt;res-&gt;code,                            302);
+        is($tx-&gt;res-&gt;headers-&gt;server,                 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;header('X-Powered-By'), 'Mojo (Perl)');
+        is($tx-&gt;res-&gt;headers-&gt;location,               '/template');
+        is($tx-&gt;res-&gt;body,                            'Redirecting!');
+    }
+)-&gt;process;
+
 __DATA__
 @@ outerlayout.html.ep
 Hello</diff>
      <filename>t/mojolicious/lite_app.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8f2fc4486b501451bfea284ccdb0b0631305eba0</id>
    </parent>
  </parents>
  <author>
    <name>Sebastian Riedel</name>
    <email>sri@labs.kraih.com</email>
  </author>
  <url>http://github.com/kraih/mojo/commit/ddb9060611d8928b077c17927f4c2d0e995a87d3</url>
  <id>ddb9060611d8928b077c17927f4c2d0e995a87d3</id>
  <committed-date>2009-11-07T11:39:42-08:00</committed-date>
  <authored-date>2009-11-07T11:39:42-08:00</authored-date>
  <message>added redirect_to to Mojolicious::Controller</message>
  <tree>22534a715098dd99ecaa534c5f8a98cbc0c0e3d5</tree>
  <committer>
    <name>Sebastian Riedel</name>
    <email>sri@labs.kraih.com</email>
  </committer>
</commit>
