Hi All !
I try to follow GWT Getting Started Tutorial and everthing was fine
until the
3. Personalize the application with the User Service from
GWT and Google App Engine part.
Trying to use User Service on AppEngine deployed app I get
32.82.27.183 - - [20/Jun/2009:14:09:07 -0700] "POST /stockwatcher/
login HTTP/1.1" 500 113 "
http://MYAPPID.appspot.com/stockwatcher/
F2BA1EC2336108C70EFD27BB520BF7D5.cache.html" "Mozilla/5.0 (Windows; U;
Windows NT 5.1; pl; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11,gzip
(gfe)" "
MYAPPID.appspot.com"
javax.servlet.ServletContext log: Exception while dispatching incoming
RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract pl.waf.stockwatcher.client.LoginInfo
pl.waf.stockwatcher.client.LoginService.login(java.lang.String)' threw
an unexpected exception: java.lang.IllegalArgumentException: The
requested URL was not allowed:
http://MYAPPID.appspot.com/
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
(RPC.java:360)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:546)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:166)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
I have:
1. Login Service interface
package pl.waf.stockwatcher.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface LoginService extends RemoteService
{
public LoginInfo login(String requestUri);
}
2. LoginService implementation
package pl.waf.stockwatcher.server;
import pl.waf.stockwatcher.client.LoginInfo;
import pl.waf.stockwatcher.client.LoginService;
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;
public class LoginServiceImpl extends RemoteServiceServlet implements
LoginService {
@Override
public LoginInfo login(String requestUri)
{
UserService userService= UserServiceFactory.getUserService();
User user= userService.getCurrentUser();
LoginInfo loginInfo= new LoginInfo();
if(user!=null)
{
loginInfo.setLoggedIn(true);
loginInfo.setEmailAddress(user.getEmail());
loginInfo.setNickname(user.getNickname());
loginInfo.setLogoutUrl(userService.createLogoutURL(requestUri));
}
else
{
loginInfo.setLoggedIn(false);
loginInfo.setLoginUrl(userService.createLoginURL(requestUri));
}
return loginInfo;
}
}
3. and login service call
LoginServiceAsync loginService= GWT.create(LoginService.class);
loginService.login(GWT.getHostPageBaseURL(), new
AsyncCallback<LoginInfo>() {
@Override
public void onFailure(Throwable caught) {
handleError(caught);
}
@Override
public void onSuccess(LoginInfo result) {
loginInfo= result;
if(loginInfo.isLoggedIn())
loadStockWatcher();
else
loadLogin();
}
});
Why is userService.createLoginURL(requestUri) failing with requested
URL not allowed?
Are there any restrictions on request URI?
Everything is working fine in the development environment.
--
Wlodek