Google App Engine Appstats存在问题

时间:2010-04-11 19:55:18

标签: java google-app-engine appstats

我遇到问题让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标头:

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 

2 个答案:

答案 0 :(得分:2)

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

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

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

答案 1 :(得分:0)

感谢您发布答案。我一直在寻找谷歌文档最后一个小时试图找出什么是错的,然后我意识到在阅读你的帖子,我有该死的urlrewrite过滤器设置!干杯!