Java GAE Oauth2 login page not found
We are trying to use Oauth2 to login to our application and to Google Docs but having lots of trouble.

When deployed a not logged in user is redirect to the Url:
 http://----.appspot.com/_ah/login_required?continue=http://------.appspot.com/oauth2

But the page gives an Error: NOT_FOUND

We have followed this Google App Engine Applications example http://code.google.com/p/google-api-java-client/wiki/OAuth2, doGet looks like this:

    		try {
			redirectUri = getRedirectUri(request);
			response.sendRedirect(initializeFlow().newAuthorizationUrl().setRedirectUri(redirectUri).build());
		} catch (ServletException e) {
			Log.info("Redirect Error "+e.getLocalizedMessage());
			e.printStackTrace();
		}

Our security constraints in web.xml:

      <security-constraint>
        <web-resource-collection>
            <url-pattern>/oauth2</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>*</role-name>
        </auth-constraint>
   </security-constraint>
 
We have also trouble allowing access to the Google Docs API.
In devmode we get this error when requesting permissions and after clicking the Allow access button:

HTTP ERROR 404

Problem accessing /oauth2callback%3Fgwt.codesvr=127.0.0.1:9997. Reason:

NOT_FOUND

getRedirectUri method i Oauth2

    	protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException {
		GenericUrl url = new GenericUrl(req.getRequestURL().toString());
		String URL = "/oauth2callback";
		if(req.getRequestURL().toString().contains("http://127.0.0.1:8888")) {
			URL += Global.getLocalcodesvr();
		}
		url.setRawPath(URL);
		return url.build();
	}

We have registered our app and the callback urls required for both devmode and deployed.
We have already spent several days trying to solve these.
Java GAE Oauth2 login page not found
===

We are trying to use Oauth2 to login to our application and to Google Docs but having lots of trouble.

When deployed a not logged in user is redirect to the Url:
 http://----.appspot.com/_ah/login_required?continue=http://------.appspot.com/oauth2

But the page gives an Error: NOT_FOUND

We have followed this Google App Engine Applications example http://code.google.com/p/google-api-java-client/wiki/OAuth2, doGet looks like this:

    		try {
			redirectUri = getRedirectUri(request);
			response.sendRedirect(initializeFlow().newAuthorizationUrl().setRedirectUri(redirectUri).build());
		} catch (ServletException e) {
			Log.info("Redirect Error "+e.getLocalizedMessage());
			e.printStackTrace();
		}

Our security constraints in web.xml:

      <security-constraint>
        <web-resource-collection>
            <url-pattern>/oauth2</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>*</role-name>
        </auth-constraint>
   </security-constraint>
 
We have also trouble allowing access to the Google Docs API.
In devmode we get this error when requesting permissions and after clicking the Allow access button:

HTTP ERROR 404

Problem accessing /oauth2callback%3Fgwt.codesvr=127.0.0.1:9997. Reason:

NOT_FOUND

getRedirectUri method i Oauth2

    	protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException {
		GenericUrl url = new GenericUrl(req.getRequestURL().toString());
		String URL = "/oauth2callback";
		if(req.getRequestURL().toString().contains("http://127.0.0.1:8888")) {
			URL += Global.getLocalcodesvr();
		}
		url.setRawPath(URL);
		return url.build();
	}

We have registered our app and the callback urls required for both devmode and deployed.
We have already spent several days trying to solve these.