Google App Engine self.redirect()POST方法 [英] Google App Engine self.redirect() POST method

查看:95
本文介绍了Google App Engine self.redirect()POST方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GAE(Python)中,使用webApp框架,调用self.redirect('some_url')通过GET方法将用户重定向到该URL。是否有可能通过带有一些参数的POST方法做一个(重定向)?



如果可能的话,怎么样?



感谢!

解决方案

这是不可能的,因为大多数客户端实现重定向[1]:


但是,大多数现有的用户代理实现将302看作是
是303响应,在Location字段值上执行GET,无论$

所以你必须使用一种解决方法(就像从RequestHandler中调用方法post() )或忘记了这个主意。

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2


In GAE (Python), using the webApp Framework, calling self.redirect('some_url') redirects the user to that URL via the GET method. Is it possible to do a (redirect) via the POST method with some parameters as well?

If possible, how?

Thanks!

解决方案

This is not possible due to how most clients implement redirection [1]:

However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method.

So you must use a workaround (like simply calling the method post() from the RequestHandler) or forget the idea.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2

这篇关于Google App Engine self.redirect()POST方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆