Re: Default value for @RemoteServiceRelativePath ?
What is RpcRefinable ? Google finds only this thread when searching for it. On Nov 23, 5:35 am, Didier Durand durand.did...@gmail.com wrote: Hi David, You can achieve what you want by using ServiceDefTarget of GWT. Here below some code snippet of mine dynamically creating a detailed url (instead of the basic one done by the annotation) to allow better monitoring: I put some info (object id, etc.) in the url to monitor more efficiently So, check the ServiceDefTarget object in GWT dev kit: it will provide you what you need. ServiceDefTarget def = (ServiceDefTarget)GWT.create(ServerObjectGetService.class);; String url = RELATIVE_URL + / + Util.getSimpleName(object.getClass()); if (object instanceof RpcRefinable) { url += / + ((RpcRefinable)object).getSubUrl();} def.setServiceEntryPoint(url); didier On Nov 22, 9:02 pm, David Balažic xerc...@gmail.com wrote: Hi! would it be possible to have a default value for the RemoteServiceRelativePath annotation? Like the interface name? For example: @RemoteServiceRelativePath(StockPriceService) public interface StockPriceService extends RemoteService { ... } could be written just as public interface StockPriceService extends RemoteService { ... } And StockPriceService would be the default name is there is no annotation? Would save some typing for the developer. Regards, David -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Default value for @RemoteServiceRelativePath ?
Hi David, This is just an interface of mine indicating that the URL can refined: if the object is an instance, it supplies the sub-url to provide a more detailled url for the server log. regards didier On Nov 23, 4:34 pm, David Balažic xerc...@gmail.com wrote: What is RpcRefinable ? Google finds only this thread when searching for it. On Nov 23, 5:35 am, Didier Durand durand.did...@gmail.com wrote: Hi David, You can achieve what you want by using ServiceDefTarget of GWT. Here below some code snippet of mine dynamically creating a detailed url (instead of the basic one done by the annotation) to allow better monitoring: I put some info (object id, etc.) in the url to monitor more efficiently So, check the ServiceDefTarget object in GWT dev kit: it will provide you what you need. ServiceDefTarget def = (ServiceDefTarget)GWT.create(ServerObjectGetService.class);; String url = RELATIVE_URL + / + Util.getSimpleName(object.getClass()); if (object instanceof RpcRefinable) { url += / + ((RpcRefinable)object).getSubUrl();} def.setServiceEntryPoint(url); didier On Nov 22, 9:02 pm, David Balažic xerc...@gmail.com wrote: Hi! would it be possible to have a default value for the RemoteServiceRelativePath annotation? Like the interface name? For example: @RemoteServiceRelativePath(StockPriceService) public interface StockPriceService extends RemoteService { ... } could be written just as public interface StockPriceService extends RemoteService { ... } And StockPriceService would be the default name is there is no annotation? Would save some typing for the developer. Regards, David -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Default value for @RemoteServiceRelativePath ?
Hi! would it be possible to have a default value for the RemoteServiceRelativePath annotation? Like the interface name? For example: @RemoteServiceRelativePath(StockPriceService) public interface StockPriceService extends RemoteService { ... } could be written just as public interface StockPriceService extends RemoteService { ... } And StockPriceService would be the default name is there is no annotation? Would save some typing for the developer. Regards, David -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Default value for @RemoteServiceRelativePath ?
Hi David, You can achieve what you want by using ServiceDefTarget of GWT. Here below some code snippet of mine dynamically creating a detailed url (instead of the basic one done by the annotation) to allow better monitoring: I put some info (object id, etc.) in the url to monitor more efficiently So, check the ServiceDefTarget object in GWT dev kit: it will provide you what you need. ServiceDefTarget def = (ServiceDefTarget)GWT.create(ServerObjectGetService.class);; String url = RELATIVE_URL + / + Util.getSimpleName(object.getClass()); if (object instanceof RpcRefinable) { url += / + ((RpcRefinable)object).getSubUrl(); } def.setServiceEntryPoint(url); didier On Nov 22, 9:02 pm, David Balažic xerc...@gmail.com wrote: Hi! would it be possible to have a default value for the RemoteServiceRelativePath annotation? Like the interface name? For example: @RemoteServiceRelativePath(StockPriceService) public interface StockPriceService extends RemoteService { ... } could be written just as public interface StockPriceService extends RemoteService { ... } And StockPriceService would be the default name is there is no annotation? Would save some typing for the developer. Regards, David -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
GWT RPC , IncompatibleRemoteServiceException, Possible @RemoteServiceRelativePath. problem
I am having trouble getting a simple GWT RPC to work. I got the default created by the Application Builder, webAppCreator to work fine in both development mode and on my server. I then tried to create my own that passes back an object. When I run it in hosted mode, the Jetty tab says greetServlet: An IncompatibleRemoteServiceException: This application is out of date, please click the refresh button. I tried not only doing that, in both Internet Explorer and Mozilla, but also changing to another computer and resetting up all the files. I always get this error. (I also got the same error message when I ran it in build mode on my Servlet Container. This was the first time I ran the application in the browser.) Here is the code where I set up my call to the service in MyWebApp.java, private final ThreeAsync greetingService = GWT.create(Three.class); greetingService.GE(LastName,FirstName, new AsyncCallbackEmployee() { public void onFailure(Throwable caught) { // Show the RPC error message to the user dialogBox.setText(Remote Procedure Call - Failure); serverResponseLabel.setHTML(server Error); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(Employee result) { dialogBox.setText(Remote Procedure Call); serverResponseLabel.removeStyleName(serverResponseLabelError); serverResponseLabel.setHTML(result.toString()); dialogBox.center(); closeButton.setFocus(true); } }); } And here is the Three.java and ThreeAsync.java files I use in my client directory (C:\g3\src\com\mycompany\mywebapp) package com.mycompany.mywebapp.client; import com.google.gwt.user.client.rpc.AsyncCallback; import com.mycompany.mywebapp.shared.Employee; /** * The async counterpart of codeThree/code. */ public interface ThreeAsync { void GE(String LN, String FN, AsyncCallbackEmployee callback) throws IllegalArgumentException; } package com.mycompany.mywebapp.client; import com.mycompany.mywebapp.shared.Employee; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; /** * The client side stub for the RPC service. */ @RemoteServiceRelativePath(greet) public interface Three extends RemoteService { public Employee GE(String LN, String FN) throws IllegalArgumentException; } One of the Google Web Posts mentioned that this can be caused by a problem with the @RemoteServiceRelativePath. I do not understand what is supposed to be in the parentheses for this argument. Here is the definition of the Employee class package com.mycompany.mywebapp.shared; import java.util.Date; import java.io.*; public class Employee implements Serializable{ public String LastName; public String FirstName; public float Salary; public Date BirthDate; public String toString () { return LastName+, +FirstName; }} And here is my test of the server code in the server directory: package com.mycompany.mywebapp.server; import com.mycompany.mywebapp.client.Three; import com.mycompany.mywebapp.shared.FieldVerifier; import com.mycompany.mywebapp.shared.Employee; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import java.util.Date; /** * The server side implementation of the RPC service. */ @SuppressWarnings(serial) public class ThreeImpl extends RemoteServiceServlet implements Three { Employee [] EmployeeList; int EmployeeCount; public Employee GE(String LastName, String FirstName) throws IllegalArgumentException { // Verify that the input is valid. if (!FieldVerifier.isValidName(LastName) || ! FieldVerifier.isValidName(FirstName)) { // If the input is not valid, throw an IllegalArgumentException back to // the client. throw new IllegalArgumentException( Both Name must be at least 4 characters long); } Employee ReturnThis; ReturnThis = new Employee(); ReturnThis.LastName=LastName; ReturnThis.FirstName=FirstName; ReturnThis.Salary = 2; ReturnThis.BirthDate = new Date(1990,10,12); return ReturnThis; } } -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Add RetentionPolicy.RUNTIME to @RemoteServiceRelativePath
The annotation @RemoteServiceRelativePath is used in the client side by GWT to find out the URL path of the RPC service. Server side code could make use of this annotation too. After all, our server-side code is going to implement the client side remote interface, so we should be able to get access to that annotation and extract the path in order to map the controller. Right now this annotation is lost in run time, so it's impossible to get this piece of data and we have to explicitly duplicate information in the server side in order to map the controller. Regards, -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Add RetentionPolicy.RUNTIME to @RemoteServiceRelativePath
There is an accepted issue for this... see: http://code.google.com/p/google-web-toolkit/issues/detail?id=3803 And add a star On Mon, Mar 22, 2010 at 7:44 AM, Ulon monz...@gmail.com wrote: The annotation @RemoteServiceRelativePath is used in the client side by GWT to find out the URL path of the RPC service. Server side code could make use of this annotation too. After all, our server-side code is going to implement the client side remote interface, so we should be able to get access to that annotation and extract the path in order to map the controller. Right now this annotation is lost in run time, so it's impossible to get this piece of data and we have to explicitly duplicate information in the server side in order to map the controller. Regards, -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to consume a service from another module (RemoteServiceRelativePath and ServiceDefTarget question)
the problem appears because of the RemoteServiceRelativePath as you noticed it says relativepath, one way to fix that is to use your code ((ServiceDefTarget) gwtService).setServiceEntryPoint(/some/absolute/path); or use the power of the relative path (that's how i do it, because I'm lazy) @RemoteServiceRelativePath(../servX) which instead of /modB/servX or /modA/servX will become /servX no matter what module calls it also you'll need to make the proper changes in web.xml so that the servlet class will be mapped to the /servX path On Feb 21, 5:44 pm, Fabio fabio.it...@gmail.com wrote: Hi, First, the scenario: I designed two GWT modules (modA.gwt.xml and modB.gwt.xml), each with its own services: // Module A services @RemoteServiceRelativePath(serv1) public interface Service1OnModuleA extends RemoteService { ... } @RemoteServiceRelativePath(serv2) public interface Service2OnModuleA extends RemoteService { ... } // Module B services @RemoteServiceRelativePath(servX) public interface ServiceXOnModuleB extends RemoteService { ... } @RemoteServiceRelativePath(servY) public interface ServiceYOnModuleB extends RemoteService { ... } At the server side, service implementations were configured to serve / modA/serv1, /modA/serv2, etc..., /modB/servX, /modB/servY. But when trying to consume Service1OnModuleA from module B code, the call is directed to /modB/serv1, instead of /modA/serv1. Obviously, / modB/serv1 produces a HTTP 404 error. By the web, I found ServiceDefTarget can be used to configure absolute instead of relative paths: * ((ServiceDefTarget) gwtService).setServiceEntryPoint(/some/ absolute/path); What would be the best practices in these scenarios? The topics bellow can help to summarize the question. * How to design and consume inter-module services? * What's the best way to design service URLs? * When to use and not to use RemoteServiceRelativePath annotation? * Is there some way to define absolute paths without having to hard- code it everywhere via ServiceDefTaget casts? Thanks, Fábio. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
How to consume a service from another module (RemoteServiceRelativePath and ServiceDefTarget question)
Hi, First, the scenario: I designed two GWT modules (modA.gwt.xml and modB.gwt.xml), each with its own services: // Module A services @RemoteServiceRelativePath(serv1) public interface Service1OnModuleA extends RemoteService { ... } @RemoteServiceRelativePath(serv2) public interface Service2OnModuleA extends RemoteService { ... } // Module B services @RemoteServiceRelativePath(servX) public interface ServiceXOnModuleB extends RemoteService { ... } @RemoteServiceRelativePath(servY) public interface ServiceYOnModuleB extends RemoteService { ... } At the server side, service implementations were configured to serve / modA/serv1, /modA/serv2, etc..., /modB/servX, /modB/servY. But when trying to consume Service1OnModuleA from module B code, the call is directed to /modB/serv1, instead of /modA/serv1. Obviously, / modB/serv1 produces a HTTP 404 error. By the web, I found ServiceDefTarget can be used to configure absolute instead of relative paths: * ((ServiceDefTarget) gwtService).setServiceEntryPoint(/some/ absolute/path); What would be the best practices in these scenarios? The topics bellow can help to summarize the question. * How to design and consume inter-module services? * What's the best way to design service URLs? * When to use and not to use RemoteServiceRelativePath annotation? * Is there some way to define absolute paths without having to hard- code it everywhere via ServiceDefTaget casts? Thanks, Fábio. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: @RemoteServiceRelativePath
I have the following tag: servlet path=/MyService class=com.google.tabs.server.MyServiceImpl / On Sep 1, 1:43 pm, Thad thad.humphr...@gmail.com wrote: Do you have the proper servlet and servlet-mapping tags in your web.xml? On Sep 1, 10:31 am, Aximilli302 aximilli...@gmail.com wrote: Me again, I have another quick question for the general comunity. What goes into the @RemoteServiceRelativePath tag? Is it the name of the class it is in? for example, package com.google.tabs.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath(MyService) public interface MyService extends RemoteService{ public String myMethod(String s, String username); } I put that in, and the server call fails. I get a warning: Sep 1, 2009 9:24:28 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /tabs/MyService Does anyone know how to make this work?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: @RemoteServiceRelativePath
I have this tag: servlet path=/serve class=com.google.tabs.server.MyServiceImpl / On Sep 1, 1:43 pm, Thad thad.humphr...@gmail.com wrote: Do you have the proper servlet and servlet-mapping tags in your web.xml? On Sep 1, 10:31 am, Aximilli302 aximilli...@gmail.com wrote: Me again, I have another quick question for the general comunity. What goes into the @RemoteServiceRelativePath tag? Is it the name of the class it is in? for example, package com.google.tabs.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath(MyService) public interface MyService extends RemoteService{ public String myMethod(String s, String username); } I put that in, and the server call fails. I get a warning: Sep 1, 2009 9:24:28 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /tabs/MyService Does anyone know how to make this work?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: @RemoteServiceRelativePath
On 2 sep, 15:02, Aximilli302 aximilli...@gmail.com wrote: I have the following tag: servlet path=/MyService class=com.google.tabs.server.MyServiceImpl / This is no longer used in HostedMode (vs. GWTShell; i.e. since GWT 1.6), and it should have warned you about it. You have to configure your war/WEB-INF/web.xml just like with any Java webapp. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
@RemoteServiceRelativePath
Me again, I have another quick question for the general comunity. What goes into the @RemoteServiceRelativePath tag? Is it the name of the class it is in? for example, package com.google.tabs.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath(MyService) public interface MyService extends RemoteService{ public String myMethod(String s, String username); } I put that in, and the server call fails. I get a warning: Sep 1, 2009 9:24:28 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /tabs/MyService Does anyone know how to make this work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: @RemoteServiceRelativePath
Do you have the proper servlet and servlet-mapping tags in your web.xml? On Sep 1, 10:31 am, Aximilli302 aximilli...@gmail.com wrote: Me again, I have another quick question for the general comunity. What goes into the @RemoteServiceRelativePath tag? Is it the name of the class it is in? for example, package com.google.tabs.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath(MyService) public interface MyService extends RemoteService{ public String myMethod(String s, String username); } I put that in, and the server call fails. I get a warning: Sep 1, 2009 9:24:28 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /tabs/MyService Does anyone know how to make this work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
@RemoteServiceRelativePath glassfish problem
Hi, @RemoteServiceRelativePath does not work correctly when war is deployed on glassfish server 2.1 I've noticed that GWT.getModuleBaseURL() returned value had doubled application name suffix at the URL end: http://localhost:8080/ejbAccess/ejbAccess/ instead of value returned in hosted mode: http://localhost:8080/ejbAccess/ Does anyone have any idea why this behavior is wrong/different on glassfish2.1 ? Regards, sc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
@RemoteServiceRelativePath retention policy
This is not really a cry for help, more just a grumble. I had this great idea to include in my unit tests a check to see if my server- side RPC implementation class was being registered properly by grabbing the URL out of the ? extends RemoteService interfaces using reflection to get the @RemoteServiceRelativePath annotation and then using the URL inside of it to test if the server was correctly set up. After going mental for a few hours I stumbled across the @Retention annotation that is used (or in this case, not used) to tell Java where to store the annotation. In the case of @RemoteServiceRelativePath there is no @Retention in the annotation's definition which means it falls back to the default of storing the URL in the code, the bytecode but not in memory once the class is loaded at runtime. I get that the annotation is really mainly used for compiling into JavaScript, but would it be hard to define it's retention as RUNTIME? I'm in the habit of doing most of my unit testing with actual java objects and only using GWTTestCase when I really need it (results in much faster tests). Specifying the annotation as CLASS retention policy means I have no way of accessing the information inside of it during my unit tests. I'm just wondering, is this by design or is it just how it is for no real reason? Does anyone know? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---