Okay, a big thanks for all of you Litty, Gregor, and Walden. It was really a very interesting and helpful discussion.
On Nov 9, 7:42 pm, gregor <[EMAIL PROTECTED]> wrote: > Hi Muhannad, > > > > > " > > Note that, just like a Javaapplicationserver, the path to the > > servlet is relative to the web project root and not the root of the > > server. With this project, the default project URL in hosted mode is > > the following. > > http://localhost:8888/org.gwtbook.ServerStatus/ServerStatus.html > > So, when we specify /server-status as the path to the servlet *, it > > will be accessible with the following URL: > > http://localhost:8888/org.gwtbook.ServerStatus/server-status > > > --- > > * <servlet path="/server-status" > > class="org.gwtbook.server.ServerServiceImpl"/> > > " > > > My question is: does that mean that I would get the same thing (HTML > > page) whether I wrote the first URL or the second one in the address > > bar??!! > > No. In the first case you are calling the mainapplicationHTML page > that in turn causes theapplication'sjavascript file to be loaded and > start the GWTapplication. In the second case you are calling a GWT > RPC servlet. What you get back from the server is (at the wire level) > a JSON string representing the return value of the RPC service method > which might represent asingleJava object or a graph (or Collection) > of Java objects. GWT deserializes this (conceptually at run time, > really in hosted mode) back into Java objects for you in the service > Callback. > > It is not an HTML page and cannot be treated as such. It is analogous > to an asynchronous RMI, DCOM, CORBA or SOAP call. Under the covers it > would look most like a SOAP call, but from a programming point of view > it behaves like an asynchronous RMI call, and that is perhaps the best > way to think of it. > > If you wanted to return some predefined static HTML content, say your > "About" page, you can use a Frame widget to do that using a URL than > rather than a GWT RPC method. > > regards > gregor > > > As for me I don't think so because the second URL is the address of > > the service not the HTML page. So if I wrote that URL in the address > > bar I should not get the ServerStatus.html page loaded, which is > > exactly what happpens with me; when I wrote the service address I get > > the following error, which is reasonable: > > " > > HTTP Status 405 - HTTP method GET is not supported by this URL > > > type: Status report > > > message: HTTP method GET is not supported by this URL > > > description: The specified HTTP method is not allowed for the > > requested resource (HTTP method GET is not supported by this URL). > > " > > > So, depending on the previous explanation, if I have multiple services > > (like in my case above: HomeService, AboutService...) it's not enough > > to write their URL in order to get them loaded! > > Not to forget that in order to be able to call a service from the > > client side you should do a very IMPORTANT thing, Generate the Service > > Proxy Object, which is NOT done automatically when I write the > > service's URL in the address bar. > > > " > > ServerStatusServiceAsync serviceProxy = (ServerStatusServiceAsync) > > GWT.create(ServerStatusService.class); > > ServiceDefTarget target = (ServiceDefTarget) serviceProxy; > > target.setServiceEntryPoint(GWT.getModuleBaseURL() + "server- > > status"); > > " > > > On Nov 6, 6:15 pm, walden <[EMAIL PROTECTED]> wrote: > > > > Muhannad, > > > > I agree with Litty and Gregor. Probably the best thing to bring > > > clarity to you at this point would be for you to develop the canonical > > > GWTsingle-page rich clientapplicationand use asingleGWT RPC > > > Service for all data needs. Get comfortable with that model (you can > > > do a lot with it!) before you try to hybridize with standard page-load- > > > page webapplicationstyle. In particular, drop the idea of Service- > > > per-URL. Yagni. > > > > Walden > > > > On Nov 6, 2:35 am, Muhannad <[EMAIL PROTECTED]> wrote: > > > > > Hi Walden, > > > > > I'm not sure that I got your idea, but I always had a concern about > > > > that so I'll share it with you: > > > > 1. Does the GWTapplicationhave just one html page (module-name.html) > > > > that all the content should be rendered there? > > > > What I mean is that Litty wrote "if the URL ends with /about then > > > > the AboutService will be called". Well but what if that AboutService > > > > does not extends or consists of any UI element? What is gonna to be > > > > displayed on the browser? > > > > > 2. What I've received from your idea above is, each service should > > > > have its own (index.html)??!! If that was the case, each time I click > > > > on a menu item then a whole new page is going to be rendered and the > > > > browser will send an HTTP request and page will be rebuilt and > > > > displayed, which is not the case here:http://extjs.com/Pleasetryto > > > > click any menu item and notice that only a portion of the page is > > > > rendered (the section under the menu) and not the whole page. > > > > Actually, this is exactly what I need to do but I think I was not > > > > clear enough. > > > > > 3. Suppose that I want to pass parameters in the URL in some > > > > customized format; not using the regular > > > > wayhttp://domain/service?param1=value1¶m2=value2. > > > > For example, something like that: > > > > http://domain/service/param1/value1/param2/value2. > > > > Where should I write my own code that should take care of this > > > > customized URL "encoding"?? I mean, is there any place in GWT > > > >applicationwhere I could capture the URL and manipulate it before > > > > redirect it to some place depending on some parameters passed?? I > > > > guess there is something in .NET called HTTP Handler or Generic > > > > Handler to deal with that. I think this is an issue that the Web > > > > Server should deal with it not the GWTapplication???!!! > > > > > Thank you very much. > > > > > On Nov 5, 5:56 pm, walden <[EMAIL PROTECTED]> wrote: > > > > > > Muhannad, > > > > > > There's a problem with your assumptions. When a user clicks on your > > > > > "about" menu link, she's not going to get a Panel, she's going to get > > > > > a whole new page fromhttp://domain/about/index.html. That page can > > > > > be a GWT host file if you like, but this is regular HTML pages, not a > > > > > rich GWT client showing and hiding content based on menu navigation. > > > > > I think you'd better get your head around that first, and then tackle > > > > > the RPC URL binding question next, if it's even an issue at all. > > > > > > Walden > > > > > > On Nov 5, 5:12 am,Muhannad<[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > > > > > I want to build a website with (Home, about, products, ...) menu. I > > > > > > need to build multiple forms (panels), each panel corresponds to one > > > > > > menu item, e.g. aboutPanel for "about" menu item, productsPanel for > > > > > > "products"... > > > > > > > Moreover, I would like to implement that panel in terms of RPC > > > > > > services; I need to correspond each panel to asingleRPC service that > > > > > > communicates with the server to get its data, build the whole form, > > > > > > and return the result as a panel to be displayed somewhere in the > > > > > > home > > > > > > page (for example). > > > > > > > Of course, GWT allows us to define multiple services and add > > > > > > multiple > > > > > > <servlet path="/service" ...> to the module XML file. > > > > > > > My problem is how to know which service should I instantiate > > > > > > depending > > > > > > on the URL mapping, i.e. suppose that the menu is defined as follow: > > > > > > > <div id="menu"> > > > > > > <a href="index.html">Home</a> > > > > > > <a href="/about">About us</a> > > > > > > <a href="/products">Products</a> > > > > > > ... > > > > > > </div> > > > > > > > So when someone clicks the "About us" link, the URL would be > > > > > > "http:// > > > > > > domain/about". So I should instantiate the "about" service and > > > > > > create > > > > > > an aboutPanel to display it. The same thing when s/he clicks the > > > > > > "Products" link, then the URL is "http://domain/products" and, in > > > > > > this > > > > > > case, I should build the product panel... > > > > > > > So, is there somewhere in GWTapplicationthat I could parse the URL > > > > > > and depending on the mapping portion of it "/about" or "/products" > > > > > > could I decide which service to instantiate? Or is there another > > > > > > better way to do that? > > > > > > > Thank you very much in advance.- 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
