简体   繁体   English

登录后如何使用Java在应用引擎上保留查询字符串(使用Google的`userService`)?

[英]How to preserve a Query String after Login(using Google's `userService`) on app engine using Java?

I am developing an application in java on GAE(Google App Engine). 我正在GAE(Google App Engine)上用Java开发应用程序。 I have a JSP where I have used Google's userService to handle authentication through the gmail account,this works fine and users are able to Login using Gmail account. 我有一个JSP,我曾使用Google的userService通过gmail帐户来处理身份验证,此方法工作正常,用户可以使用Gmail帐户登录。

I have used userService.createLoginURL(request.getRequestURI()) to create the Login url. 我已经使用userService.createLoginURL(request.getRequestURI())创建登录URL。

My requirement is that I append some Query Parameter at the end of base url of my application, and I send that url to the user, this is intended to take the user to a specific page with information pulled in from database based on the Query parameter after login. 我的要求是,我在应用程序的基本URL末尾附加一些查询参数,然后将该URL发送给用户,这是为了将用户带到特定页面,其中包含基于Query参数从数据库中提取的信息登录后。

However, when a user is not logged in and opens the url(having Query String) then it takes him to the Login Page, and after the Login, it is supposed to go to that specific page but after Login the query String is lost and it simply takes the user to the welcome page, which is not intended for this case. 但是,当用户未登录并打开url(具有查询字符串)时,它将带他到登录页面,登录后,应该转到该特定页面,但登录后查询字符串丢失并且它只是将用户带到欢迎页面,该页面不适用于这种情况。

How can I avoid this ? 如何避免这种情况? Is there a work around for this or this is just a limitation on App Engine ? 是否可以解决此问题,或者这仅仅是对App Engine的限制?

如果我们对网址应用安全约束,则查询字符串可以保留,这也需要访问页面或网址所需的登录名。

<security-constraint> <web-resource-collection> <web-resource-name>Any Name</web-resource-name> <url-pattern>/page or url you want to apply the security</url-pattern> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> </security-constraint>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM