[ic] IC5 -> IC6

William Carr bill at bottlenose-wine.com
Fri Apr 4 14:05:16 UTC 2014


On Apr 4, 2014, at 9:54 AM, Stefan Hornburg (Racke) <racke at linuxia.de> wrote:

> On 04/04/2014 03:41 PM, William Carr wrote:
>> 
>> On Apr 3, 2014, at 10:36 AM, William Carr <bill at bottlenose-wine.com> wrote:
>> 
>>> 
>>> On Apr 3, 2014, at 3:35 AM, Stefan Hornburg (Racke) <racke at linuxia.de> wrote:
>>> 
>>>> On 04/02/2014 08:35 PM, William Carr wrote:
>>>>> 
>>>>> On Apr 2, 2014, at 2:28 PM, Jon Jensen <jon at endpoint.com> wrote:
>>>>> 
>>>>>> On Wed, 2 Apr 2014, William Carr wrote:
>>>>>> 
>>>>>>> Is it possible to have a hybrid site where some of the pages are IC5 and some are IC6? What are the general things I'd have to do to make that happen?
>>>>>> 
>>>>>> Certainly.
>>>>>> 
>>>>>> You could have IC5 and IC6 integrate directly somehow, but a more general solution would apply to any two or more web app technologies living on the same virtual host (including PHP, Rails, or whatever): Use your web server to carve up the URL space such that e.g. /ic5 URLs go to your Interchange 5 app and /ic6 URLs go to your Interchange 6 app.
>>>>>> 
>>>>>> In practice, Interchange 5 typically expects to own the whole URL space, so it's easiest to map e.g. /ic6 to your new app and then default everything else to be served as static files if they exist, or by Interchange as a fallback.
>>>>>> 
>>>>>> For example, in Apache, you could do something like:
>>>>>> 
>>>>>> # Serve Interchange 6 URLs
>>>>>> RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
>>>>>> RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-l
>>>>>> RewriteRule ^/ic6(/.*) http://localhost:8443/$1 [P]
>>>>>> ProxyPassReverse /ic6/ http://www.your.domain/
>>>>>> 
>>>>>> # Let Apache handle URIs whose first directory component exists in the docroot
>>>>>> # This is a performance tweak to keep Interchange from handling *all* 404s
>>>>>> RewriteCond %{REQUEST_URI} ^(/[^/]+)
>>>>>> RewriteCond %{DOCUMENT_ROOT}%1 -d
>>>>>> RewriteRule ^ - [L]
>>>>>> 
>>>>>> # Everything else is handled by Interchange
>>>>>> RewriteRule ^/(.*) /cgi-bin/catalog/$1 [PT,L]
>>>>> 
>>>>> Cool, thanks. That helps.
>>>>> 
>>>>> What about session data? Could there be a notion of sharing session data between IC5 and IC6?
>>>>> 
>>>> 
>>>> We did a proof of concept for a client. This plugin read / writes IC5 session data from Dancer.
>>>> Please consider that this isn't tested very well and might not really reliable at this point.
>>>> 
>>>> https://gist.github.com/racke/9949856
>>>> 
>>>> Further enhancements are planned.
>>> I checked that out. Does that have anything to do with this http://search.cpan.org/~yanick/Dancer-1.3121/lib/Dancer/Session/Abstract.pm? I'm confused how to hookup up SessionCrossover.
>> I think I have this figured out.
>> 
>> I'm making Dancer::Session::Interchange5
>> 
>> Then in my Dancer App.pm I will say....
>> 
>> set 'session' => 'Interchange5'; 
>> 
>> Please stop me if you think I'm way off.
> 
> You need the following configuration:
> 
> plugins:
>  Database:
>    driver: 'mysql'
>    database: 'your_dbname'
>    username: 'innovator'
>    password: 'bonfire'
>  Interchange5::SessionCrossover:
>    table: sessions_mysql
> 
> your_dbname is the database you are using in IC5.
> 
> And in your Dancer code you can use
> 
> read_ic5_session
> write_ic5_session
> 
> etc, all at the bottom of the plugin.
Doesn't your way defeat the Dancer::Session::Abstract layer provided by Dancer? I'm very new to this but as I understand it Dancer gives us a way to create any kind of session backend via Dancer::Session::Abstract. If I create Dancer::Session::Interchange5 and use that as my session backend I would not have to use read_ic5_session, write_ic5_session in my Dancer code. I would be able to just use regular Dancer session code like so...


get '/set_session' => sub {
    session foo => 'bar';
    return 'Set foo => bar';
};

get '/get_session' => sub {
    my $foo = session 'foo';
    return qq{Get session foo: $foo};
};

Bill Carr, President at Bottlenose
(413) 584-0400 
http://www.bottlenose-wine.com 



More information about the interchange-users mailing list