保护尝试
网址
http://[GAE app URL]/_ah/sessioncleanup?clear
从 GAE 数据存储中清除 100 个过期会话(看起来如此)。
我想保护这个 URL,以便可以使用cron.xml类似的条目从应用程序中调用它
<cronentries>
  [...]
  <cron>
    <url>/_ah/sessioncleanup?clear</url>
    <description>Clean 100 expired sessions up</description>
    <schedule>[Schedule]</schedule>
  </cron>
</cronentries>
但不仅仅是来自任何遵循上述表单 URL 的用户。
所以我将以下代码添加到web.xml:
<web-app>
[...]
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>session-clean-up</web-resource-name>
      <url-pattern>/_ah/sessioncleanup</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
  </security-constraint>
</web-app>
我省略了添加以下内容,web.xml因为会话清理是在没有它的情况下使用手动 URL 调用进行的:
<web-app>
  [...]
  <servlet>
    <servlet-name>_ah_sessioncleanup</servlet-name>
    <servlet-class>com.google.apphosting.utils.servlet.SessionCleanupServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>_ah_sessioncleanup</servlet-name>
    <url-pattern>/_ah/sessioncleanup</url;-pattern>
  </servlet-mapping>
</web-app>
结果
可悲的是,在将此代码部署到生产中后,我发现将上述代码添加到任何一个都没有提供任何<security-constraint>保护
http://[GAE app URL]/_ah/sessioncleanup?clear
或者
http://[GAE app URL]/_ah/sessioncleanup
背景资料
我上面的代码基于GAE 问题 10047 (Request to document or publish code for SessionCleanupServlet)中引用的 Googler 的发布。
我的问题
有谁知道我可以如何解决我的问题?