[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Postpone Rendering depending on clientmethodreceiver  XML
Forum Index -> Development
Author Message
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

Hi,

I use a PageBrowser and a clientmethodreceiver to pass a session id from an outside swing application into my CaptainCasaApplication.
Code:
 				m_pageBrowser = new PageBrowser(urlServer, urlAddress, 0,mainFrame, mainFrame, false, false);
 				// transfer session id
 	CLIENTMETHODRECEIVERElement.sendMessageToServer(sessionId);


It seems that when I call the constructor method the jsp of the CC app is rendered already, but my data access layer needs the session id, so I'd like rendering to take place a little later, after that clientmethodreceiver call has been done.

What do you think, what is an elegant way to achieve this?
We're thinking about passing the session id as a URL parameter in the urlAddress String. Are there any nice alternatives?

Thanks,

Björn
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

...why not wrapping PageBrowser in a Swing container (JPanel etc.), then you can optically embed the container, and later on get the data out?

Regards, Björn

Björn Müller, CaptainCasa GmbH
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

What we did now was to first provide the session ID in the Application URL passed into the pagebrowser.
Code:
URL + "SessionId=" + sessionId;

and then have a SessionPhaseListener registered:
Code:
     <lifecycle>
       <phase-listener>smonitor.cc.ui.SessionPhaseListener</phase-listener>
     </lifecycle>

which then reads the URL param and registers it in the FacesContext:
Code:
	@Override
 	public void beforePhase(PhaseEvent arg0) {
 
 		FacesContext context = FacesContext.getCurrentInstance();
 		String sessionId = request.getParameter("SessionId");
 
 		FacesContext.getCurrentInstance().getExternalContext()
 					.getSessionMap().put(..., sessionId)
 	}

This way we do not need clientmethodreceiver any more. Since our complete application depends on the Session ID, it makes sense to set it globally instead of dynamically via clientmethodreceiver.

Björn
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team