我想從書中運行一個示例程序:「Google App Engine Java和GWT應用程序開發代碼」。谷歌GWT錯誤404
該程序稱爲connactr。
該程序正在使用的進口: com.google.appengine.api.labs.taskqueue.TaskOptions.Builder.url com.google.appengine.api.labs.taskqueue.Queue
不存在了,所以我把它們改成: com.google.appengine.api.taskqueue.TaskOptions.Builder.withurl com.google.appengine.api.taskqueue *
我也改變了代碼:
Queue queue = QueueFactory.getDefaultQueue();
queue.add(url("/updatefeedurls").payload(data,
"application/x-java-serialized-object"));
到:
Queue queue = QueueFactory.getDefaultQueue();
queue.add(withUrl("/updatefeedurls").payload(data,
"application/x-java-serialized-object"));
我做這些樣的變化無處不在,我有老辦法。 我能夠運行應用程序,沒有任何錯誤,但對於每一頁我收到錯誤404,找不到頁面。
我假設withurl()方法有不同的邏輯,導致錯誤404,但我無法找到我應該做什麼來解決它。
我爲了做這個工作應該改變什麼?
下面是web.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<!-- ===================== friendsService ===================== -->
<servlet>
<servlet-name>friendsService</servlet-name>
<servlet-class>com.metadot.book.connectr.server.FriendsServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>friendsService</servlet-name>
<url-pattern>/connectr/friendsService</url-pattern>
</servlet-mapping>
<!-- ===================== messagesService ===================== -->
<servlet>
<servlet-name>messagesService</servlet-name>
<servlet-class>com.metadot.book.connectr.server.MessagesServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>messagesService</servlet-name>
<url-pattern>/connectr/messagesService</url-pattern>
</servlet-mapping>
<!-- ===================== Login Service ===================== -->
<servlet>
<servlet-name>loginService</servlet-name>
<servlet-class>com.metadot.book.connectr.server.LoginServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>loginService</servlet-name>
<url-pattern>/connectr/loginService</url-pattern>
</servlet-mapping>
<!-- ===================== Login Google Servlet ===================== -->
<servlet>
<servlet-name>logingoogle</servlet-name>
<servlet-class>com.metadot.book.connectr.server.servlets.LoginGoogleServlet</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>logingoogle</servlet-name>
<url-pattern>/logingoogle</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>logingooglecallback</servlet-name>
<servlet-
class>com.metadot.book.connectr.server.servlets.LoginGoogleCallbackServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>logingooglecallback</servlet-name>
<url-pattern>/logingooglecallback</url-pattern>
</servlet-mapping>
<!-- ===================== Login Twitter Servlet ===================== -->
<servlet>
<servlet-name>logintwitter</servlet-name>
<servlet-class>com.metadot.book.connectr.server.servlets.LoginTwitterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>logintwitter</servlet-name>
<url-pattern>/logintwitter</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>logintwittercallback</servlet-name>
<servlet-
class>com.metadot.book.connectr.server.servlets.LoginTwitterCallbackServlet</servlet-
Class>
</servlet>
<servlet-mapping>
<servlet-name>logintwittercallback</servlet-name>
<url-pattern>/logintwittercallback</url-pattern>
</servlet-mapping>
<!-- ===================== Login Facebook Servlet ===================== -->
<servlet>
<servlet-name>loginfacebook</servlet-name>
<servlet-class>com.metadot.book.connectr.server.servlets.LoginFacebookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>loginfacebook</servlet-name>
<url-pattern>/loginfacebook</url-pattern>
</servlet-mapping>
</servlet>
<servlet-mapping>
<servlet-name>XMPPRequest</servlet-name>
<url-pattern>/xmpprequest</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<url-pattern>/xmpprequest</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<filter-mapping>
<filter-name>appstats</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<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>
<security-constraint>
<web-resource-collection>
<url-pattern>/appstats/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint> -->
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>ConnectrApp.html</welcome-file>
</welcome-file-list>
</web-app>
謝謝你在前進, 伊詹。
這會更好的附加有關web.xml的信息,關於404錯誤的螢火蟲控制檯信息。用google-app-engine標籤重新標記。 – SSR
我添加了web.xml,謝謝 –
在Firebug控制檯或Chrome開發工具中監視請求,以檢查請求被激發到的URL。 withURL函數可能會稍微修改使您的web.xml映射不正確的URL。 – SSR