[Catalyst] A suitable method to redraw a page

Dermot paikkos at googlemail.com
Wed Sep 24 09:20:43 BST 2008


2008/9/24 J. Shirley <jshirley at gmail.com>:
> On Tue, Sep 23, 2008 at 4:30 PM, Dermot <paikkos at googlemail.com> wrote:

>
> Plugin::XMLRPC is -not- a controller, as such, you probably do want to use it.

Do you mean do or 'do not' want to use it.

>
> If you use Catalyst::Controller::REST handles serialization based on
> the Content-type header, with built-in support for JSON, YAML, XML and
> quite a few other formats.  It also isn't intrusive to your other code
> (like a Plugin is).


I installed this module and am trying to connect to it. Perhaps I
should start a new thread but I ask anyway.


If my the root of my app is /myapp. I have installed a the REST
Controller as lib/MyApp/Controller/REST.pm

The Controller has this for now.

sub files : Local : ActionClass('REST') {
  my ($self, $c) = @_;
  $c->log->debug("Hello from REST Controller");
}

sub files_GET {
  my ($self, $c) = @_;
  $self->status_ok(
        $c,
        entity => {
                result => 'acceptable',
        },
  );
}


My remote LWP client reads

...
 my $server = 'http://server.mydomain.com:3000'
 my $url = $server."/myapp/rest";

 my $req = HTTP::Request->new(GET => $url);
 $req->content('files');
 my $ua = LWP::UserAgent->new();
 $ua->timeout(5);
 my $res = $ua->request($req);

 if ($res->is_success) {
        print "Content type=",$res->content_type,"\n";
        print $res->decoded_content;
 }
 else {
        $res->status_line;
 }

But the result is alway not found.

.-------------------------------------+--------------------------------------.
| Path                                | Private                              |
+-------------------------------------+--------------------------------------+
| /rest/files                         | /rest/files
..
[info] *** Request 7 (0.019/s) [16196] [Wed Sep 24 09:12:33 2008] ***
[debug] "GET" request for "motion/rest" from "x.x.x.x"
[debug] Arguments are "myapp/rest"


The whole thing needs fleshing out but I can't seems to get a basic
connection established. Any tips?



More information about the Catalyst mailing list