<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -45,3 +45,11 @@ and, run following command.
     vi config.ini # edit configuration file for your environemnt
     ./mobirc
 
+How to support HTTP::Engine's middleware?
+------------------------------------------------------
+
+    [Component::HTTPD]
+    middlewares=[&quot;HTTP::Engine::Middleware::ModuleReload&quot;]
+
+please write the middleware name &amp; configuration by the JSON form.
+</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,10 @@ use App::Mobirc::Util;
 use App::Mobirc::Web::Handler;
 
 use HTTP::Engine;
+use HTTP::Engine::Middleware;
+
+use Mouse::Util::TypeConstraints;
+use JSON ();
 
 use UNIVERSAL::require;
 
@@ -22,20 +26,28 @@ has port =&gt; (
     default =&gt; 80,
 );
 
+subtype 'Middlewares',
+    as 'ArrayRef';
+
+coerce 'Middlewares',
+    from 'Str',
+    via { JSON::from_json($_) };
+
 has middlewares =&gt; (
     is      =&gt; 'ro',
-    isa     =&gt; 'ArrayRef',
-    default =&gt; sub { [] },
+    isa     =&gt; 'Middlewares',
+    coerce  =&gt; 1,
+    default =&gt; sub { +[] },
 );
 
 hook run_component =&gt; sub {
     my ( $self, $global_context ) = @_;
 
     my $request_handler = \&amp;App::Mobirc::Web::Handler::handler;
-    for my $mw ( @{ $self-&gt;middlewares } ) {
-      $mw-&gt;require or die $@;
-      $request_handler = $mw-&gt;wrap($request_handler);
-    }
+
+    my $mw = HTTP::Engine::Middleware-&gt;new();
+    $mw-&gt;install(@{ $self-&gt;middlewares });
+    $request_handler = $mw-&gt;handler( $request_handler );
 
     HTTP::Engine-&gt;new(
         interface =&gt; {</diff>
      <filename>lib/App/Mobirc/Plugin/Component/HTTPD.pm</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>56432bcb7674a332acbedfcd68968c31f644dcc3</id>
    </parent>
  </parents>
  <author>
    <name>Tokuhiro Matsuno</name>
    <email>tokuhirom@gmail.com</email>
  </author>
  <url>http://github.com/tokuhirom/mobirc/commit/0c42d3e9279352d391f5f5a783742388c9d0b551</url>
  <id>0c42d3e9279352d391f5f5a783742388c9d0b551</id>
  <committed-date>2009-02-10T05:42:22-08:00</committed-date>
  <authored-date>2009-02-10T05:42:22-08:00</authored-date>
  <message>added middleware support</message>
  <tree>16ee460ae22b47ea08ca7b831067ecbc132ec0a2</tree>
  <committer>
    <name>Tokuhiro Matsuno</name>
    <email>tokuhirom@gmail.com</email>
  </committer>
</commit>
