Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Where does the @TunnelToServer annotation belong to?
Where does the @TunnelToServer annotation belong to? [message #1728508] Tue, 05 April 2016 06:19 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
The question could be summarized like this:
Quote:
Should the @TunnelToServer be added:
* to the interface: com.company.example.helloworld.shared.helloworld.IHelloWorldService
* to the implementation in the server: com.company.example.helloworld.server.helloworld.HelloWorldService


When the classes are created by the Scout SDK (new Form for example), the interface is annotated with the interface.

----

When you create an application having the client and the server deployed in the same application. See (org.eclipse.scout.contacts.all.app.dev for an example), the ServerSession is only created when the server class is annotated with @TunnelToServer. I had the problem that the HelloWorldServer was throwing a NullPointerException on this line:
ServerSession.get().getUserId()

because "ServerSession.get()" was null.

As far I could debug it, this is because of the implementation of BridgeToServerBeanDecorationFactory#decorate(..) that checks if bean.getBeanAnnotation(TunnelToServer.class) is not null.

I have tried to create here an "helloworld.all.app.dev" and the only solution was to move the annotation from the interface to the class.

Code is on GitHub: https://github.com/jmini/scout-helloworld

----

By the way, I think I will add it later to the architecture document, but if you are interested to create a "<your-app>.all.app.dev", you simply need to create a new project similar to your "<your-app>.ui.html.app.dev" with those dependencies:
* org.eclipse.scout.dev.jetty (like in the "<your-app>.ui.html.app.dev")
* org.eclipse.scout.rt.serverbridge (this on is important)
* <your-app>.ui.html (like in the "<your-app>.ui.html.app.dev")
* helloworld.server (the same dendencies as the one you have in "<your-app>.server.app.dev")
Re: Where does the @TunnelToServer annotation belong to? [message #1728575 is a reply to message #1728508] Tue, 05 April 2016 14:04 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Quote:
Should the @TunnelToServer be added:
* to the interface: com.company.example.helloworld.shared.helloworld.IHelloWorldService
* to the implementation in the server: com.company.example.helloworld.server.helloworld.HelloWorldService


* TunnelToServer should always be added to the interface. It means that a proxy is created for this interface that is connecting to the server.
* In org.eclipse.scout.rt.serverbridge, there is a platform listener (RegisterTunnelToServerBridgePlatformListener) to remove the proxies and register the beans implementing TunnelToServer directly.
* RegisterTunnelToServerBridgePlatformListener was however only active, if the property scout.beans.createTunnelToServerBeans was set. (scout.beans.createTunnelToServerBeans=true in the config.properties file). I changed that, such that it is now always active, if the bridge is included.
Re: Where does the @TunnelToServer annotation belong to? [message #1728576 is a reply to message #1728575] Tue, 05 April 2016 14:05 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Thank you a lot. I will try to verify this with M7
Previous Topic:[neon] wizard improvement idea
Next Topic:SQL.selectInto(...) with IN clause and Grouping
Goto Forum:
  


Current Time: Sat Apr 27 03:11:25 GMT 2024

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

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

Back to the top