Relogin question

Hi ,

Now I’m doing a simple test about SmartClient’s ReLogin feature,however I got some problem.Here is my code:
this is my index.jsp ,which use tu send a RPC to a Servlet to get datas.

<!-- Load isomorphic XML tags for a Java server -->
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %>
<HTML><HEAD>
		<isomorphic:loadISC runat="server"/>
		
<STYLE>
	.headerText {font-family:Verdana,Helvetica,sans-serif; font-size:12px; font-weight:bold; color:black;}
</STYLE><TITLE>
	Isomorphic Software Simple Client/Server Communication example
</TITLE>
</HEAD><BODY>
<!-- Begin example code -->
<SCRIPT>


Label.create({
    ID: "dataLabel",
    position: "relative",
    width: 400,
	contents:"Click below to fetch data from data-layer..."
});
//
// Clicking on this button sends the current browser time to the server (rpcTarget.jsp) where it
// logged to the console.
//

function isLogin(data){
	    dataLabel.setContents(data);
}
Button.create({
    title: "Get Data",
    position: "relative",
    width: 150,
    click: function () {   
    	RPCManager.send(new Date(),"isLogin(data)",{actionURL:"getData"});               
    }
});
</SCRIPT>
</BODY>
</HTML>

While I click the button “Get Data”,it send a rpc request whose url is “/getData” ,then it hand the request to GetDataServlet to handle.
here is the method(doPost) of my GetDataServlet’:

System.out.println(this.getClass());
		boolean isLogin = request.getParameter("login")!=null?true:false;
		RPCManager rpc = null;
		if(isLogin)
		{
			try{
				rpc = new RPCManager(request, response);
					rpc.send("Welcome to get Data page.");
			}catch(Exception e)
			{			
			}
		}else
		{
			response.setContentType("text/html");
			PrintWriter out = response.getWriter();
			out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
			out.println("<HTML>");
			out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
			out.println("<script src=\"isomorphic/login/reloginFlow.js\"></script>");
			out.println("  <BODY><script>");
			out.print("while (!window.isc && document.domain.indexOf(\".\") != -1) {");
			out.print("try {");
			out.print("parent.isc;");
			out.print("break;");
			out.print("} catch (e) {");
			out.print("document.domain = document.domain.replace(/.*?\\./, '');}}");
			out.print("var isc = top.isc ? top.isc : window.opener ? window.opener.isc : null;");
			out.print("if (isc) isc.RPCManager.delayCall(\"handleLoginRequired\", [window]);");
			out.println("</script>  </BODY>");
			out.println("</HTML>");
			out.flush();
			out.close();
		}

while the isLogin is false,the login form that SmartClient supply in reloginFlow.js doesn’t come out.

Is there any wrong in my code???

thanks.

Hi,

I find some sentence like this in your Reference doc in the three sect(http://www.smartclient.com/docs/5.6/a/b/c/go.html#group..relogin),which mention that

When SmartClient detects the loginRequired marker, the transaction that encountered session timeout is put on hold, and RPCManager.loginRequired() is called.

So how does the SmartClient to detects it ?what does its principle?
And you supply three choose for me in your doc as options.Such as the third option is the sample of your reloginFlow.js

thanks.

While I use the loginRequiredMarker.html which was sent from a Servlet,I monitor the tcp/ip data with eclipse’s tcp/ip monitor,and I got some message like this :couldn’t found a transactionNum

what’s the matter?

Hello Joy,

A number of mistakes could lead to that error message, it’s not obvious what the problem is from the limited code samples you’re showing. Relogin is a heavily tested system that is live in multiple production sites right now, so it’s likely a typo or similar minor error that’s creating a problem for you.

We’d suggest you put together a set of files that can run in an unmodified SmartClient SDK. Once you have that working, try applying it to your actual application.

If you think you’ve discovered a bug in relogin, please do send us a self-contained test case that runs in an unmodified SmartClient SDK.

Hi Isomorphic,

I really do my test in an unmodified SmartClient SDK.

Now I do a bit of alter like this:
GetDataServlet’s doPost(…)

rpc = new RPCManager(request, response);
RPCResponse rpcResponse = new RPCResponse();			rpcResponse.setStatus(RPCResponse.STATUS_LOGIN_REQUIRED);
rpc.send(rpcResponse);

in your reloginFlow.js add some code in the method of loginReply

if(status == isc.RPCResponse.STATUS_LOGIN_REQUIRED)
    {
    	this.show();
    }

then the login form bring up.

but this seems have some problems.

Hello Joy,

If you think you’ve discovered a bug in SmartClient, please feel free to email a self-contained, standalone test case to support@smartclient.com.