-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ogden wrote:
> We have these real URLs:
> http://site.com/
> http://site.com/shop/
> http://site.com/about/
> These work fine and the autohandler does it's job.
> 
> Now, we want a dhandler in there so:
> http://site.com/45
> will pull up something from Postgres with an id of 45.
> 
> I am confused as to how to approach this. No matter what I put in
> dhandler, a blank page is returned.
> Any idea as to what I may be doing wrong?
I cannot see any obvious reason for "getting a blank page", at least not
without seeing some code. Anyway, you will fix it in no time thinking
about "dhandlers" as "fall back components". So, your "execution path"
for "/45" would be:
  /autohandler -> /dhandler

For handling the "45" argument, you could use a variation upon
"$m->dhandler_arg" (or "$r->uri" if your prefer).

Remember to not blindly forward such requests. Validate them, croaking
some error on failure.

Here's a dummy dhandler example:

<%init>
  # does the request look like "/[ID]"?
  if ($m->dhandler_arg =~ /^(\d+)/) {
    # ("your_id_handler" should handle "invalid ID" errors)
    return $m->comp('your_id_handler', %ARGS, id => $1);
  }

  # call 911 or something
  $m->auto_send_headers(0);
  $m->clear_buffer;
  $r->status(404);
  $r->content_type('text/plain');
  $r->send_http_header;
  $m->print('Are you lost?');
  $m->abort;
</%init>

cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----

iD8DBQFE5HEOtZHp/AYZiNkRAh7aAKDtJs7MGGfDEtZjCDCLCDZmpiqeGgCgpBGf
HIYwaBMOGqLMe5sj2xde2eg=
=4Jr0
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to