Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Calling a custom JavaScript function from RAP
Calling a custom JavaScript function from RAP [message #89170] Wed, 21 May 2008 11:54 Go to next message
Reinhold Bentele is currently offline Reinhold BenteleFriend
Messages: 16
Registered: July 2009
Junior Member
Hi all,

I have defined a custom HTML body in the branding extension and added
there some text like "Please wait..." to indicate to the user that the
application is loading (download of the qooxdoo-library).
If the transfer is complete and the first window (in our case a login
dialog) is shown I want to change this text (e.g. "Ready."). Therefore I
created a JavaScript function (in my custom HTML body).

How can I call this function from RAP for example on LoginDialog.open()?

Ciao - Reinhold.
Re: Calling a custom JavaScript function from RAP [message #89231 is a reply to message #89170] Wed, 21 May 2008 16:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Reinhold,

(whithout having actually tried it)
you could add a PhaseListener in your EntryPoint. This one could
listen for after-RENDER and then append Javascript code to the
response, that changes your "Loading..." message.

HTH
Rüdiger


Reinhold Bentele wrote:
> Hi all,
>
> I have defined a custom HTML body in the branding extension and added
> there some text like "Please wait..." to indicate to the user that the
> application is loading (download of the qooxdoo-library).
> If the transfer is complete and the first window (in our case a login
> dialog) is shown I want to change this text (e.g. "Ready."). Therefore I
> created a JavaScript function (in my custom HTML body).
>
> How can I call this function from RAP for example on LoginDialog.open()?
>
> Ciao - Reinhold.
Re: Calling a custom JavaScript function from RAP [message #89864 is a reply to message #89231] Mon, 26 May 2008 07:49 Go to previous messageGo to next message
Reinhold Bentele is currently offline Reinhold BenteleFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Rüdiger,

Rüdiger Herrmann schrieb:
> you could add a PhaseListener in your EntryPoint. This one could listen
> for after-RENDER and then append Javascript code to the response, that
> changes your "Loading..." message.

thank you for your response.
I implemented a PhaseListener in my EntryPoint and the afterPhase method
is called correctly. But I have problems to append something to the
response. I tried RWT.getResponse().getWriter().println("test") but this
throws the following IllegalStateException:

java.lang.IllegalStateException
at
org.mortbay.jetty.servlet.ServletHttpResponse.getOutputStrea m(ServletHttpResponse.java:540)
at
org.eclipse.rwt.internal.service.AbstractServiceHandler.getO utputWriter(AbstractServiceHandler.java:51)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.wri teOutput(LifeCycleServiceHandler.java:265)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.int ernalService(LifeCycleServiceHandler.java:183)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.acc ess$1(LifeCycleServiceHandler.java:168)
at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler$Lif eCycleServiceHandlerSync.doService(LifeCycleServiceHandler.j ava:133)
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.serviceInternal(RWTLifeCycleServiceHandlerSync.java:47 )
at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandle rSync.service(RWTLifeCycleServiceHandlerSync.java:35)

at
org.eclipse.rwt.internal.service.LifeCycleServiceHandler.ser vice(LifeCycleServiceHandler.java:140)
at
org.eclipse.rwt.internal.service.ServiceManager$HandlerDispa tcher.service(ServiceManager.java:100)
at org.eclipse.rwt.internal.engine.RWTDelegate.doPost(RWTDelega te.java:61)
at
org.eclipse.ui.internal.servlet.RequestHandler.service(Reque stHandler.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at
org.eclipse.equinox.http.servlet.internal.ServletRegistratio n.handleRequest(ServletRegistration.java:90)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.proce ssAlias(ProxyServlet.java:111)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.servi ce(ProxyServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at
org.eclipse.equinox.http.jetty.internal.HttpServerManager$In ternalHttpServiceServlet.service(HttpServerManager.java:269)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder .java:428)
at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHan dler.java:677)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandl er.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java: 820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.ja va:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:8 37)
at
org.mortbay.http.SocketListener.handleConnection(SocketListe ner.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:3 57)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:5 34)


What am I doing wrong? What is the normal way to append custom lines to
the response?

Reinhold
Re: Calling a custom JavaScript function from RAP [message #89909 is a reply to message #89864] Mon, 26 May 2008 08:40 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi,

have you tried these lines?

HtmlResponseWriter writer =
ContextProvider.getStateInfo().getResponseWriter();
writer.writer("alert('Test')");

Regards,
Stefan.
Re: Calling a custom JavaScript function from RAP [message #89939 is a reply to message #89909] Mon, 26 May 2008 09:03 Go to previous message
Reinhold Bentele is currently offline Reinhold BenteleFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Stefan,

Stefan Röck schrieb:
> Hi,
>
> have you tried these lines?
>
> HtmlResponseWriter writer =
> ContextProvider.getStateInfo().getResponseWriter();
> writer.writer("alert('Test')");

That's the solution. Thanks a lot!

Reinhold
Previous Topic:Text widget WRAP-Problem -1.1.0-RC1
Next Topic:Applets as views
Goto Forum:
  


Current Time: Sat Dec 21 14:33:14 GMT 2024

Powered by FUDForum. Page generated in 0.04078 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top