Hallo Werner, thank You for Your help and Your patience!
You gave me the right hint: The session was not saved because of missing cookie-rights, and I could solve my problems! Sorry for such a trivial solution! My application sometimes is called from a customer's web-page. Normally my application needs a authentication of the user. Being called from this customer's web-page I wanted to automatically log-on a anonymous user and redirect him to the start of the application. The standard cookie-setting of Safari says: 'Only accept cookies of web sites I am visiting' So I guess, at the very first request to my application my application does not belong to these web-sites Safari is visiting; so when redirected to the second page the session-id is lost. To log-on anonymously now I made an intermediate site for the anonymous start. This intermediate page does nothing but redirect the request to a seond page. When this second page is processed I log-on the anonymous user (and save the user being logged on in a session scoped bean) and then redirect again to the start of the application. In this case the cookie is accepted and the session is not lost and the information of the session scoped bean still exists.... So now the anonymous log-on is working also using the standard cookie settings of Safari; but for the anonymous login the User will be redirected 2 times. Once more thanks a lot! Georg 2009/9/1 Werner Punz <[email protected]>: > Hello the main issue you have is you want to trigger from an outside > navigation a jsf page and you want to preserve the session, correct? > > I assume this here is hardcoded right? <frame > src="http://localhost:9080/InvestInform/login/iimnall.jsf" > name="anzeige" id="anzeige" title="anzeige" /> > > > what you have to do is following, you have to create the link dynamically > and use: > response.encodeURL(encodedUrl) > no redirect is needed here, you will have lost the session already at > > private void umleitenAufNeueZielseite(PhaseEvent event, String >> kontextStamm, String zielSeite) > > > What happens is following: > You trigger an external page here, page gets a session id assigned, then you > trigger a frame but you omit the session id, the frame then gets its own > session id, because you have a hardcoded link. > > You have to drag in your session id to the link that jsf calls so that jsf > can recycle it. > > > the call should then look like<frame > src="http://localhost:9080/InvestInform/login/iimnall.jsf?jsessionId=....." > name="anzeige" id="anzeige" title="anzeige" /> > > It depends on the context you are in, if you already are in jsf or if. > But as I said do not create the link hardcoded use the el to > make the link and then delegate to response.encodeURL(...) > > however also make sure that the server and browser allow cookies otherwise > the entire sessionid thing wont work > (since you know german > http://www.java-forum.org/allgemeines-ee/87463-funkt-encodeurl-auch-wenn-cookies-eingeschalten-sind.html) > > > Werner > > > Georg Füchsle schrieb: >> >> Hallo Werner, >> >> thanks for Your help. >> But I have to ask once more: >> >> thecall of 'response.encodeURL(encodedUrl)' doesnot change the url. >> >> for the redirect I use the following funktion: >> >> >> private void umleitenAufNeueZielseite(PhaseEvent event, String >> kontextStamm, String zielSeite) >> { >> try >> { >> ExternalContext ectx = >> event.getFacesContext().getExternalContext(); >> HttpServletResponse response = >> (HttpServletResponse)ectx.getResponse(); >> >> >> String encodedUrl = kontextStamm + zielSeite; >> encodedUrl = response.encodeURL(encodedUrl); >> >> ectx.redirect(encodedUrl); >> } >> catch (IOException e) >> { >> log.error("Fehler bei der Weiterleitung!"); >> } >> } >> >> >> Was it this what you wanted to advice me? >> >> Cheers >> Georg >> >> >> 2009/8/28 Werner Punz <[email protected]>: >>> >>> Werner Punz schrieb: >>>> >>>> Georg Füchsle schrieb: >>>>> >>>>> Hallo Werner , hallo Jan-Kees, >>>>> >>>>> thank you for your answers. >>>>> >>>>> - I do not redirect to another application but to another URL inside >>>>> the same application. >>>>> - I do not change from http to https or vice versa. >>>>> - Werner: I tried to youse handleNavigtion instead of redirect, but >>>>> unfortunately i didn't succeed as i got an exception. ( I asked this >>>>> in another request to this news group...) >>>>> >>>>> >>>>> But now I examined once more an found out another strange fact: >>>>> >>>>> >>>>> I loose the session only if the application is called out of a frame. >>>>> (The application should be embedded into the website of a customer >>>>> using a frameset :) >>>>> >>>>> <frame src="http://localhost:9080/InvestInform/login/iimnall.jsf" >>>>> name="anzeige" id="anzeige" title="anzeige" /> >>>>> >>>>> >>>> Ok here is the issue, you basically change applications implicitely via >>>> the usage of frames :-) >>>> >>>> You probably should add your session id to the link.. via >>>> response.encodeUrl you can get a valid url including the id :-) >>>> Make sure you do that for all frame to frame navigations (inside a frame >>>> you wont have to do that) >>>> >>>> Werner >>>> >>>> >>> Ok Just to add something here, in your case with trying to call a JSF >>> page >>> from an outside frame, a navigation case wont help you. Navigaton cases >>> only >>> work within the same frame. >>> >>> Werner >>> >>> >> > >

