gpt4 book ai didi

java - Google App Engine Appstats 的问题

转载 作者:行者123 更新时间:2023-11-30 09:55:53 25 4
gpt4 key购买 nike

我在获取 Appstats 时遇到问题才能正常工作。使用/appstats 或/appstats/stats 会陷入无限循环,不断重定向回/appstats/stats。这会导致 404 错误,指出页面没有正确重定向。知道问题出在哪里吗?

下面是我的 web.xml 中的相关行。这与文档基本相同 here .

<servlet>
<servlet-name>appstats</servlet-name>
<servlet-class>com.google.appengine.tools.appstats.AppstatsServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>appstats</servlet-name>
<url-pattern>/appstats/*</url-pattern>
</servlet-mapping>

<filter>
<filter-name>appstats</filter-name>
<filter-class>com.google.appengine.tools.appstats.AppstatsFilter</filter-class>
<init-param>
<param-name>logMessage</param-name>
<param-value>Appstats available: /appstats/details?time={ID}</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>appstats</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<security-constraint>
<display-name>appstatsConstraint</display-name>
<web-resource-collection>
<web-resource-name>appstatsCollection</web-resource-name>
<url-pattern>/appstats/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>

这是我的 appengine-web.xml 中的相关行。我试过同时使用/appstats/stats 和/appstats,它们都有同样的问题。

<admin-console>
<page name="Appstats" url="/appstats/stats" />
</admin-console>

以下是显示无限重定向循环的 http header :

http://mysite.appspot.com/appstats/stats

GET /appstats/stats HTTP/1.1
Host: mysite.appspot.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:
1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: USER_LOCALE=en_US; JSESSIONID=POTIUPPpEmjHZoaNDWOSTA;
ACSID=AJKiYcHiwT8jH7e01V9O5iFu3kpBhDd3k3oBwwxylv5u0DbJ-
utvdpsgdb4Xim2WXwobkJmgTGGljvuh94_yVQ__-
VPnBsTtUAhRjSyZ2Lv3G7oUHAxTsCWHJIMChGT3-
XUyUNx8wxwvJisL_RTXH8Hc4TTLh_rVHm2k8gk8kgdbVZXexSV0K-
a3coELTecWIBolt0qLd5L-5vALm382KsqbHorPXqoZMPTvR_06g_mR1cbmF2Ihnk6YhP7no58BNpESM9HvFyKNKXODo39hF4oaZCcW0Q9TBqUMgsrBqlcIh3-
VvC7qvH0n_nAtrLTBbK_swnOFvCDcaf3whT9ty0CJ0VRNuNqIPOLHIeQAMgwXUNMr89P64EsgmuyONHR67glCQXEPOGXIaT1vcBJFwFoeNUqjdp824fHvoVhaL7Xlav-
LTIFuM3f_ymHLmibk57PRuXUYEaAG

HTTP/1.1 302 Found
Location: http://mysite.appspot.com/appstats/stats
X-AppEngine-Estimated-CPM-US-Dollars: $0.645553
X-AppEngine-Resource-Usage: ms=18965 cpu_ms=27884 api_cpu_ms=0
Set-Cookie:
ACSID=AJKiYcF_YA7PB18b3T5OO7vEMo31f1hFhO8xKqFRiBUGrCr4YABAAyugZXcDfKMOM-
r0FiK8xlOPfQWx3tOWIJ6ueOqK89X8M9YfHIs8WKUcSs6PwNZSKV0HKxvbqeWxfZI_cpo2YoS73s_RPlyEvjaYLOf6iXPpWeYyKTAbSqPOEBnVnTk3oso6ur66CIj3FnN8vsHfbanqY4sbaRsNj9pLjWZco0quYLOK1fd4wRZx_oAvk3jOlfAj7BZ7p9L1bO8oVCMpVn19cwT6zvO2-9RSjfiOPAacw7Cg0MT30r7Fr7SCj7VcSPAye4lc7tb9KL9ztZEk0xbEX-9vC6vHM_VfPJ54Kb_FycxE6lACsKTE4hj0bOa2-2quaOP0NSxfoH9ozLlQQCsGhpWBnlu__W06D0GqDqxcDUu2HocYqWuLi91aoa-
aRTkqB_qo4aAa3OvHeKoFgwrS; expires=Mon, 12-Apr-2010 19:41:49 GMT;
path=/
Date: Sun, 11 Apr 2010 19:42:08 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Content-Type: text/html
Server: Google Frontend
Content-Length: 0
----------------------------------------------------------
http://mysite.appspot.com/appstats/stats

GET /appstats/stats HTTP/1.1
Host: mysite.appspot.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:
1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: USER_LOCALE=en_US; JSESSIONID=POTIUPPpEmjHZoaNDWOSTA;
ACSID=AJKiYcF_YA7PB18b3T5OO7vEMo31f1hFhO8xKqFRiBUGrCr4YABAAyugZXcDfKMOM-
r0FiK8xlOPfQWx3tOWIJ6ueOqK89X8M9YfHIs8WKUcSs6PwNZSKV0HKxvbqeWxfZI_cpo2YoS73s_RPlyEvjaYLOf6iXPpWeYyKTAbSqPOEBnVnTk3oso6ur66CIj3FnN8vsHfbanqY4sbaRsNj9pLjWZco0quYLOK1fd4wRZx_oAvk3jOlfAj7BZ7p9L1bO8oVCMpVn19cwT6zvO2-9RSjfiOPAacw7Cg0MT30r7Fr7SCj7VcSPAye4lc7tb9KL9ztZEk0xbEX-9vC6vHM_VfPJ54Kb_FycxE6lACsKTE4hj0bOa2-2quaOP0NSxfoH9ozLlQQCsGhpWBnlu__W06D0GqDqxcDUu2HocYqWuLi91aoa-
aRTkqB_qo4aAa3OvHeKoFgwrS

HTTP/1.1 302 Found
Location: http://mysite.appspot.com/appstats/stats
X-AppEngine-Estimated-CPM-US-Dollars: $0.002243
X-AppEngine-Resource-Usage: ms=64 cpu_ms=93 api_cpu_ms=0
Date: Sun, 11 Apr 2010 19:42:08 GMT
Content-Type: text/html
Server: Google Frontend
Content-Length: 0

最佳答案

事实证明,这是我在 web.xml 中也有的 URL 重写过滤器配置的问题。我必须确保没有规则匹配 /appstats/*。我将我的重写 urlrewrite.xml 编辑到下面。

<urlrewrite>
<rule>
<from>^(?!/appstats/)/(.*)$</from>
<to last="true">/app/$1</to>
</rule>
</urlrewrite>

/app/* 是我的 Spring 调度程序 servlet 映射。

关于java - Google App Engine Appstats 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2618473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com