|
Re: Redirect browser after close workbench [message #635928 is a reply to message #635069] |
Thu, 28 October 2010 15:51 |
Ivan Furnadjiev Messages: 2427 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Sergey,
yes it possible, but currently only by using an internal RAP classes or
custom widget. Using internal RAP classes is NOT recommended, as they
are subject to change in any time, but this is the easier way to do it.
Without testing myself you could try:
----
String jscode = "window.location.href = 'http://www.eclipse.org';";
JSExecutor.executeJS( jsCode );
----
You could use this code in the main shell listener
ShellListener#shellClosed for example.
HTH,
Ivan
On 10/25/2010 5:53 PM, Sergey Kuznetsov wrote:
> Hi,
>
> Is it possible to redirect browser after workbench being closed to
> some html (bundle resource)?
>
> Thanks,
> Sergey.
|
|
|
Re: Redirect browser after close workbench [message #635941 is a reply to message #635069] |
Thu, 28 October 2010 16:29 |
Austin Riddle Messages: 128 Registered: July 2009 |
Senior Member |
|
|
Hi Sergey,
This is what we use for redirecting to a logout page.
Just override postShutdown() in your workbench advisor:
@Override
public void postShutdown()
{
super.postShutdown();
final Display display = Display.getCurrent();
RWT.getLifeCycle().addPhaseListener( new PhaseListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("restriction")
public void afterPhase( PhaseEvent event ) {
if( Display.getCurrent() == null || display == Display.getCurrent() ) {
try {
// Uses a non-public API, but currently this is the only solution
HtmlResponseWriter writer
= ContextProvider.getStateInfo().getResponseWriter();
String url = "theme/logout-confirmation.html";
writer.write( "window.location.href=\"" + url + "\";" );
RWT.getRequest().getSession().setMaxInactiveInterval(1);
} catch( IOException e ) {
e.printStackTrace();
}
RWT.getLifeCycle().removePhaseListener( this );
}
}
public PhaseId getPhaseId() {
return PhaseId.ANY;
}
public void beforePhase(PhaseEvent event) {};
} );
}
Keep in mind the warning that Ivan gave, this does use internal API, but it may be appropriate for your situation.
Hope this helps.
[Updated on: Thu, 28 October 2010 16:33] Report message to a moderator
|
|
|
Re: Redirect browser after close workbench [message #635973 is a reply to message #635928] |
Thu, 28 October 2010 19:10 |
Sergey Kuznetsov Messages: 29 Registered: July 2009 |
Junior Member |
|
|
thanks a lot, that works!
28.10.10 17:51, Ivan Furnadjiev пишет:
> Hi Sergey,
> yes it possible, but currently only by using an internal RAP classes or
> custom widget. Using internal RAP classes is NOT recommended, as they
> are subject to change in any time, but this is the easier way to do it.
> Without testing myself you could try:
> ----
> String jscode = "window.location.href = 'http://www.eclipse.org';";
> JSExecutor.executeJS( jsCode );
> ----
> You could use this code in the main shell listener
> ShellListener#shellClosed for example.
> HTH,
> Ivan
>
> On 10/25/2010 5:53 PM, Sergey Kuznetsov wrote:
>> Hi,
>>
>> Is it possible to redirect browser after workbench being closed to
>> some html (bundle resource)?
>>
>> Thanks,
>> Sergey.
|
|
|
|
Powered by
FUDForum. Page generated in 0.24445 seconds