Clinton Posted September 1, 2005 Posted September 1, 2005 I have recently been working my way through re-creating the front end of my application using XSL. Though I seem to have control over the actual XSL, there are still a few things that I am unsure of. How exactly does one create and manage sessions? I know you must call the "fmxslt:create_session()" function, and give it a session name. I assume you include this on the first page the user sees after logging in. After that, how do you make sure the session is maintained after additional queries are made? The Custom Web Publishing Guide also mentions that you must use content buffering when using sessions, but I'm not sure exactly how to do this. Mainly, I was using the pages that the Site Assistant created as a starting point. I can see where they create a new session (though it seems to be of the same name, every time? Should a date/time stamp function be used to create session name?), but I do not see any mention of content buffering. I notice they use the "fmxslt:session_encode_url()" function a lot, as well. Does this need to be used for every link you have the user click? I'd appreciate any help; a list of steps or "recipes" for handling sessions would be very helpful, (not only code, but server-side settings, as well) but I can't seem to find any. Unfortunately, my application relies on global variables and states being maintained, so this is very important.
Martin Brändle Posted September 5, 2005 Posted September 5, 2005 After that, how do you make sure the session is maintained after additional queries are made? The Custom Web Publishing Guide also mentions that you must use content buffering when using sessions, but I'm not sure exactly how to do this. The problem is essentially to pass the web session key you create from page to page. You can do that by several ways: - store it in a database and retrieve it with XSLT document. This works e.g. if the information is personalized - pass it by a token (-token.session=yourkey) - store it in a cookie and retrieve it on every page Content buffering: Right after the XML declaration, you write: <?xml version="1.0" encoding="UTF-8"?> <?xslt-cwp-buffer buffer-content="true"?> Should a date/time stamp function be used to create session name?), but I do not see any mention of content buffering. I notice they use the "fmxslt:session_encode_url()" function a lot, as well. Does this need to be used for every link you have the user click? You are to free to use anything as a web session key, unless it is unique. The CWP Guide recommends to use fmxslt:session_encode_url() for all CWP internal links for all cases where cookies are turned off by the user. I'd appreciate any help; a list of steps or "recipes" for handling sessions would be very helpful, (not only code, but server-side settings, as well) but I can't seem to find any. Unfortunately, my application relies on global variables and states being maintained, so this is very important. Unfortunately I don't have any example - I did not feel up to now the need to use sessions, although in certain cases I can see their use. But first I have to do some performance tests, because when I start to save and retrieve large XML result trees in session variables, I want to be sure that this does not take too much time. With respect to global variables: You should turn on database sessions, otherwise they will not be maintained across pages.
Martin Brändle Posted September 5, 2005 Posted September 5, 2005 Another argument why I don't use sessions for the moment is that I'm missing query commands that can be submitted and act on the session variable content only, so that the database does not need to be queried. E.g. a select on session-saved XML result tree. Maybe a suggestion to FMI?
Recommended Posts
This topic is 7017 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now