Relogin question

Hi,

Sorry if this is a foolish question, I’m brand new to SmartClient and AJAX generally, and perhaps have difficulty thinking in terms other than page-at-a-time web apps…

I don’t quite get how I’m supposed to use the Relogin feature. When my server code detects an unauthenticated user (because of session expiry or an attempt to dive straight into the app without going through the login procedure), it’s always as a result of an RPC call. I am NEVER returning HTML, I am ALWAYS returning an RPCResponse or a DSResponse from plain old Java code.

Given this, how does the loginRequiredMarker work? Do I just embed the contents of that HTML file in the data member of the RPCResponse? If so, is there a less onerous / more maintainable way of doing this than cut/pasting the whole shebang into a Java string?

Thanks for any advice

Hi wrussel,

When you get an RPCRequest, you don’t have to send back an RPCResponse. The typical approach is to just do a servlet include() of loginRequiredMarker.html and never call RPCManager.send().

However, you can also have an RPCResponse trigger the relogin flow by setting the result status to STATUS_LOGIN_REQUIRED. The overview doesn’t mention this approach because we typically find that people implement authentication intercepts that protect something else aside from RPCs, such as HTML content, and in that case a human-readable response is required in which a relogin marker must be embedded.