|
Re: How to change timeout page [message #652235 is a reply to message #651340] |
Thu, 03 February 2011 09:54 |
Ivan Furnadjiev Messages: 2426 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi,
currently there is no public APIs to customize the timeout page. We are
aware of this and we are looking for a solution - see bug:
284422: Improve session timeout notification
https://bugs.eclipse.org/bugs/show_bug.cgi?id=284422
But... you can use an internal API to render your customize timeout page
- see the snippet below:
------------------------
String newTimeoutPage = "<html><body>My custom timeout page</body></html>";
String pattern
= "org.eclipse.swt.Request.getInstance().setTimeoutPage( \"{0}\"
);";
Object[] param = new Object[] { newTimeoutPage };
String jsCode = MessageFormat.format( pattern, param );
JSExecutor.executeJS( jsCode );
------------------------
Please consider, that this snippet uses internal APIs, both on client
and server, that are subject to change without notice!
HTH,
Ivan
On 1/29/2011 4:43 PM, evol wrote:
> Hi, I just wonder how can I chage session timeout page. I guess it can
> be done by preserving "timeoutPage" in widget adapter. But there is a
> bit of confusion. The code of writeErrorPages method
> (org.eclipse.swt.internal.widgets.displaykit.DisplayLCA) is seems to
> always write predefined timeout page and do not use preserved value at
> all. Is there is some kind of trick that I do not understand or maybe
> it's just a misprint in variables names?
> Here is a code of the method below:
>
> private static void writeErrorPages( final Display display )
> throws IOException
> {
> String timeoutPage = getTimeoutPage();
> IWidgetAdapter adapter = DisplayUtil.getAdapter( display );
> Object newTimeoutPage = adapter.getPreserved( PROP_TIMEOUT_PAGE );
> if( !timeoutPage.equals( newTimeoutPage ) ) {
> String pattern
> = "org.eclipse.swt.Request.getInstance().setTimeoutPage(
> \"{0}\" );";
> Object[] param = new Object[] { newTimeoutPage };
> String jsCode = MessageFormat.format( pattern, param );
> IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
> HtmlResponseWriter out = stateInfo.getResponseWriter();
> out.write( jsCode );
> }
> }
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03896 seconds