Download - Advanced Seaside

Transcript
Page 1: Advanced Seaside

Advanced SeasidePhilippe Marschall

ESUG 2014

Page 2: Advanced Seaside

Advanced Seaside

• WARestfulComponentFilter

• session tracking

• http://smalltalkhub.com/mc/marschall/ESUG-2014/main

• http://ss3.gemstone.com/ss/frank.html

Page 3: Advanced Seaside

WARestfulComponentFilter

Page 4: Advanced Seaside

Disclaimer

• REST in this context simply means “pretty URLs”

Page 5: Advanced Seaside

WARestfulComponentFilter

• new with 3.1

• Norbert’s fault

• this is the missing documentation

Page 6: Advanced Seaside

WARestfulComponentFilter

• run “front page(s)” without session

• “window shopping”

• run pages behind with session

• central place to recover from expired session

Page 7: Advanced Seaside

WARestfulComponentFilter

• “REST” filter that runs before the application

• only when no session

• or session is expired

• can start session with any component instance

Page 8: Advanced Seaside

WARestfulComponentFilter

• if it runs, normal REST filter rules apply

• SeasideRest

• up to you how HTML is generated

• WABuilder/WAPainter

• no callbacks

• …

Page 9: Advanced Seaside

Example Ⅰ

• counter

• all “pages” handled by filter and component

• not the normal case

• not composable

Page 10: Advanced Seaside

Example Ⅱ

• one two three

• first page just static content

• link to second page with static content

• third page with counter (and session)

Page 11: Advanced Seaside

Session Tracking

Page 12: Advanced Seaside

Session Tracking

• used to be implemented in WAApplication

• had a single flag

• optionally use cookies

Page 13: Advanced Seaside

Session Tracking 3.1

• factored out into a strategy object

• can implement your own

• handles no or expired session

Page 14: Advanced Seaside

Session Tracking Fully Customizable

• query fields

• cookie only

• cookie if supported, query field otherwise

• cookie for browser, IP for crawler

• SSL session id (*)

• path parameter (*)

Page 15: Advanced Seaside

Query Field

• /?_s=KAAWl0x3c6KLnN6Q

• easy for development

• session per tab

• no issue with cookie laws

• no iframe issues (P3P)

Page 16: Advanced Seaside

Path Parameter

• ;_s=KAAWl0x3c6KLnN6Q/

• like query parameter

• doesn’t have to be hidden field in form

• required by some load balancers

• “JavaEE” way

Page 17: Advanced Seaside

Cookie Only

• never shows up in links

• never shows up in access logs

• links can be copied and pasted

• links can be sent by email

• session per browser

• crawlers don’t accept cookies

Page 18: Advanced Seaside

IP

• option for crawlers

• same session for all browsers

• issues with

• mobile clients

• NATs

• Proxies

Page 19: Advanced Seaside

SSL Session Id

• never shows up

• needs sever (adapter) support (3.1)

• SSL session has to be keep alive

• or client gets same id again

• no SSL session cookies

Page 20: Advanced Seaside

Session Tracking Fully Customizable

• query fields

• cookie only

• cookie if supported, query field otherwise

• cookie for browser, IP for crawler

• SSL session id (*)

• path parameter (*)

Page 21: Advanced Seaside

Custom

• variant of any of those

• combination of any of those

• can rename field

• whatever else

• eg. header set by security proxy

• client certificate

Page 22: Advanced Seaside

Example

• fake JavaEE

• eg. Tomcat, JBoss

• eg. for load balancer

• use existing load balancer infrastructure, configuration, documentation

• jvmRoute left as an exercise

Page 23: Advanced Seaside

jvmRoute

• sticky session load balancing

• no session replication

• attach image id / JVM id to session id

• /;jsessionid=KAAWl0x3c6KLnN6Q.42

• supported by “JavaEE load balancers”

Page 24: Advanced Seaside

Example

• jsessionid path parameter name

• JSESSIONID cookie name


Top Related