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.
<pre lang="Perl">
use Catalyst qw/
Configure the URI module so that it doesn't normally interfere. In your myapp.conf:
<pre lang="Apache configuration">
# ...
# 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:
<pre lang="Perl">
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:
<pre lang="JavaScript">
var swfu;
window.onload = function() {
var settings = {
upload_url: '< $c->uri_with_sessionid('/swfupload_receiver') >',
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.