So, for anyone who is looking at this, I tried an experiment. I rewrote the server as an HttpServlet returning a JSON string with the same data as the hashmap, and I let the client parse it and send it to dosomething. Here are some observations and a bit of information that narrows down the problem.
1. I was getting an error when trying to call GWT.getModuleBaseURL() on the server side, so I send the value of that call as a parameter "sender" in the GET request. 2. After that and a little tweaking, I end up with the ability to "log in", but... 3. ...the redirect to the url "lcoalhost:port/modulename" which is the value of getModuleBaseURL() results in the error 403 I described below. 4. As a test, I changed the sender to be the Host URL + entry html file, which worked for the redirect, but... 5. ...didn't register the login. Any thoughts or suggestions are welcome. Thanks. -- V On Jun 12, 10:31 pm, venk <[email protected]> wrote: > Hi all - > > I'm stumped. I keep getting a Error 403 that causes the onFailure > method to be invoked in response to a call to a RemoteServiceAsync > interface method. Not sure if that makes sense, but I'll put the code/ > xml/etc. here, along with the StackTrace and you'll see what I mean I > hope. > > Basically, breakpoints in the ServiceImpl on the server side do NOT > get tripped, but a breakpoint in the onFailure method of the callback > does. Sorry for the occasional "censoring" of names of modules, > packages, etc. But, it's pretty much all there. If I comment out the > entire call to the greetingService and just go straight to > "dosomething", everything works fine. > > This GreetingService is meant to catch the request for the URL to find > out if the user is logged in or not and return the appropriate login/ > logout URL and any available user data if logged in. So it would be > nice to get it working. > > Anyone that can help with this? Thanks in advnace! > > -- V > > ***** GreetingService.java ***** > > import java.util.HashMap; > > 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("") > public interface GreetingService extends RemoteService { > HashMap<String, String> greetServer(String senderURL); > > } > > ***** GreetingServiceAsync.java ***** > > import java.util.HashMap; > > import com.google.gwt.user.client.rpc.AsyncCallback; > > /** > * The async counterpart of <code>GreetingService</code>. > */ > public interface GreetingServiceAsync { > void greetServer(String senderURL, AsyncCallback<HashMap<String, > String>> callback); > > } > > ***** GreetingServiceImpl.java ***** > > import java.util.HashMap; > > import com.zeo.dashboard.client.GreetingService; > import com.google.appengine.api.users.User; > import com.google.appengine.api.users.UserService; > import com.google.appengine.api.users.UserServiceFactory; > import com.google.gwt.user.server.rpc.RemoteServiceServlet; > > /** > * The server side implementation of the RPC service. > */ > @SuppressWarnings("serial") > public class GreetingServiceImpl extends RemoteServiceServlet > implements GreetingService { > > public HashMap<String, String> greetServer(String senderURL) { > UserService userService = UserServiceFactory.getUserService(); > User user = userService.getCurrentUser(); > > HashMap<String, String> response = new HashMap<String, > String>(); > > if (user == null) { > response.put("label", "Login"); > response.put("url", > userService.createLoginURL(senderURL)); > } > else { > response.put("label", "Logout " + user.getEmail()); > response.put("email", user.getEmail()); > response.put("name", user.getNickname()); > response.put("domain", user.getAuthDomain()); > response.put("url", > userService.createLogoutURL(senderURL)); > } > > return response; > } > > } > > ***** web.xml ***** > > <servlet> > <servlet-name>greetServlet</servlet-name> > <servlet-class>[server.package.name].GreetingServiceImpl</servlet- > class> > </servlet> > > <servlet-mapping> > <servlet-name>greetServlet</servlet-name> > <url-pattern>/[modulename]</url-pattern> > </servlet-mapping> > > ***** GreetingClient.java ***** > > import java.util.HashMap; > > import com.google.gwt.core.client.EntryPoint; > import com.google.gwt.core.client.GWT; > import com.google.gwt.user.client.Window; > import com.google.gwt.user.client.rpc.AsyncCallback; > > /** > * Entry point classes define <code>onModuleLoad()</code>. > */ > public class GreetingClient implements EntryPoint { > /** > * Create a remote service proxy to talk to the server-side Greeting > service. > */ > private final GreetingServiceAsync greetingService = GWT.create > (GreetingService.class); > > /** > * This is the entry point method. > */ > public void onModuleLoad() { > greetingService.greetServer(GWT.getModuleBaseURL(), new > AsyncCallback<HashMap<String, String>>() { > public void onFailure(Throwable caught) { > Window.alert("Error accessing user service: " > + > caught.getMessage()); > caught.printStackTrace(); > } > > public void onSuccess(HashMap<String, String> > response) { > dosomethingwithresponse(response); > } > }); > } > > } > > ***** [appname].gwt.xml ***** > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4// > EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro- > source/core/src/gwt-module.dtd"> > <module rename-to='[modulename]'> > > <!-- Inherit the core Web Toolkit stuff. --> > <inherits name='com.google.gwt.user.User'/> > > <inherits name="com.google.gwt.i18n.I18N"/> > <inherits name='com.google.gwt.xml.XML'/> > > <inherits name='com.google.gwt.user.theme.standard.Standard'/> > <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> > <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> > > <!-- Other module inherits --> > > <!-- Specify the app entry point class. --> > <entry-point class='[client.package.name].GreetingClient'/> > > ***** StackTrace from Error ***** > > com.google.gwt.user.client.rpc.StatusCodeException: <html> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"/> > <title>Error 403 </title> > </head> > <body><h2>HTTP ERROR: 403</h2><pre>FORBIDDEN</pre> > <p>RequestURI=/[modulename]/</p><p><i><small><a href="http:// > jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > > </body> > </html> > > at > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv ed > (RequestCallbackAdapter.java:192) > at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl > (Request.java:264) > at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch > (Request.java:236) > at com.google.gwt.http.client.Request.fireOnResponseReceived > (Request.java:227) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java: > 103) > at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod > (IDispatchImpl.java:126) > at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke > (IDispatchProxy.java:155) > at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke > (IDispatchImpl.java:294) > at com.google.gwt.dev.shell.ie.IDispatchImpl.method6 > (IDispatchImpl.java:194) > at org.eclipse.swt.internal.ole.win32.COMObject.callback6 > (COMObject.java:117) > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925) > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966) > at com.google.gwt.dev.SwtHostedModeBase.processEvents > (SwtHostedModeBase.java:235) > at com.google.gwt.dev.HostedModeBase.pumpEventLoop > (HostedModeBase.java:558) > at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405) > at com.google.gwt.dev.HostedMode.main(HostedMode.java:232) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" 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-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
