You can use Catalyst::Plugin::Session::State::Cookie as your primary session state storage and still use Catalyst::Plugin::Session::State::URI on a need-to basis.

Together in the same app!

This helps you in having proper sessions even with Adobe Flash plugin, notably swfupload. (See Cookie issue in known issues in SWFUpload v2 Documentation for background.)

Just use two State plugins and a storage plugin at the same time. Load Cookie first and URI second.

 use Catalyst qw/

Configure the URI module so that it doesn't normally interfere. In your myapp.conf:

 # ...
 # Catalyst::Plugin::Session::State::URI related conf
 rewrite_body 0
 rewrite_redirect 0

You can now use the URI based session anywhere you especially need it:

  my $adobe_rules
    = $c->uri_with_sessionid('/swfupload_receiver');

Otherwise it will use the Cookie based session.

Finally, configure swfupload to post to an URL with the sessionid. The example is in Mason-produced JavaScript:

var swfu;
  window.onload = function() {
    var settings = {
      upload_url: '<% $c->uri_with_sessionid('/swfupload_receiver') %>',
      flash_url: '/static/swf/swfupload.swf',
      button_placeholder_id: 'swfUpload',
      button_text: 'Upload',
      button_width: '65',
      button_height: '29'
    swfu = new SWFUpload(settings);

Authentication will just work out of the box.

My tags:
Popular tags:
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker