You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ivelin Ivanov <iv...@apache.org> on 2002/06/13 05:35:42 UTC

Re: Session support implemented

Rock and Roll Jeff !

I'll try it out.

Thanks !


A quick question of low priority. Is https supported at this point?



Ivelin


Jeff Turner wrote:
> Hi,
> 
> I've implemented minimal session support. To test it, run 'ant', then
> './runtests.sh'. The 'session' target in test.xml will run,
> demonstrating session support:
> 
>     <http description="Tests session support">
>       <httpRequest useTidy="false" port="${localport}" path="${ctx}/setname.jsp" debug="${debug}">
>         <parameter name="name" value="Joe Bloggs"/>
>         <session id="mySession" debug="${debug}"/>
>         <match/>
>       </httpRequest>
>       <httpRequest useTidy="false" port="${localport}" path="${ctx}/getname.jsp" debug="${debug}">
>         <session refid="mySession"/>
>         <match>
>           <regexp><![CDATA[Hello there, Joe Bloggs]]></regexp>
>         </match>
>       </httpRequest>
>     </http>
>     <property name="sessionStr" refid="mySession"/>
>     <echo>After two HTTP requests, our session contains: ${sessionStr}</echo>
> 
> This requires an external Tomcat setup with two JSPs, one to set a session
> value and another to retrieve it.
> 
> On my computer, output with debug=10 is as follows:
> 
>      [http] {} Session has no cookie for path '/session'
>      [http] -------------------- Sending to localhost:8787
>      [http] GET /session/setname.jsp?name=Joe+Bloggs HTTP/1.0
>      [http] Host: localhost
>      [http] 
>      [http] ----------
>      [http] Reading response 
>      [http] Got: HTTP/1.1 200 OK
>      [http] Got headers: {Date=Date: Wed, 12 Jun 2002 13:45:05 GMT, Server=Server: Apache Tomcat/4.0 (HTTP/1.1 Connector), Set-Cookie=Set-Cookie: JSESSIONID=20E8B41772E3D0A492694612758860D2;Path=/session, Connection=Connection: close, Content-Type=Content-Type: text/html;charset=ISO-8859-1}
>      [http] Got body: Setting session param
>      [http] 
>      [http] 
>      [http] Got session cookie Set-Cookie: JSESSIONID=20E8B41772E3D0A492694612758860D2;Path=/session
>      [http] {} Session storing cookie: JSESSIONID=20E8B41772E3D0A492694612758860D2;Path=/session
>      [http] {} Session storing mapping '/session' -> 'JSESSIONID=20E8B41772E3D0A492694612758860D2'
>      [http] Adding session cookie cookie: JSESSIONID=20E8B41772E3D0A492694612758860D2
>      [http] -------------------- Sending to localhost:8787
>      [http] GET /session/getname.jsp HTTP/1.0
>      [http] cookie: JSESSIONID=20E8B41772E3D0A492694612758860D2
>      [http] Host: localhost
>      [http] 
>      [http] ----------
>      [http] Reading response 
>      [http] Got: HTTP/1.1 200 OK
>      [http] Got headers: {Date=Date: Wed, 12 Jun 2002 13:45:05 GMT, Server=Server: Apache Tomcat/4.0 (HTTP/1.1 Connector), Connection=Connection: close, Content-Type=Content-Type: text/html;charset=ISO-8859-1}
>      [http] Got body: Hello there, Joe Bloggs
>      [http] 
>      [null]    OK: 2 passed, 0 failed [Tests session support]
>      [echo] After two HTTP requests, our session contains: {/session=JSESSIONID=20E8B41772E3D0A492694612758860D2}
> 
> 
> 
> Note: the support is *very* rudimentary, given the potential complexity
> of cookies. The HttpClient parse() method is 263 lines; mine is 19. It
> works with Tomcat 4.0 anyway. If anyone has problems precluding a 1.0
> release, please let me know.
> 
> A note on the syntax: why didn't I wrap <http> tags in a <session> tag,
> like Latka? Because Ant does not make it easy to nest elements. The
> official mechanism, TaskContainer, is rather deficient because it *only*
> allows tasks to be added; no DataTypes or regular nested elements. So
> I've gone with the (more flexible) session-object-passing approach.
> Same story for the upcoming <logger> element.
> 
> 
> --Jeff
> 
> _______________________________________________________________
> 
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> _______________________________________________
> aft-devel mailing list
> aft-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/aft-devel
> 



-- 

-= Ivelin =-


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org