facebook
  • google-app-engine
  • gwt
  • xfbml
  • 2012-09-08 49 views 1 likes 
    1

    我有一個使用gwt的應用程序並託管在gae上。有一種使用xfbml的表單,一旦數據填充並提交表單,就會有一個重定向URL。問題是它通過xfbml表單提交發生異常。如果我直接調用網址,它的效果很好。從xfbml重定向到gwt不起作用

    的XFBML代碼:

    <fb:registration redirect-uri="http://www.sakshum.org/FbBloodDonorRegister" fields='[{"name":"name"},{"name":"first_name"},{"name":"last_name"}, {"name":"cellPhone", "description":"Cell Number", "type":"text"}, {"name":"homePhone", "description":"Home Number", "type":"text"}]' onvalidate="validated" width="530"> 
    </fb:registration> 
    

    唯一的例外是下面

    javax.servlet.ServletContext log: Exception while dispatching incoming RPC call 
    javax.servlet.ServletException: Content-Type was 'application/x-www-form-urlencoded'. Expected 'text/x-gwt-rpc'. 
        at com.google.gwt.user.server.rpc.RPCServletUtils.checkContentTypeIgnoreCase(RPCServletUtils.java:427) 
        at com.google.gwt.user.server.rpc.RPCServletUtils.readContent(RPCServletUtils.java:160) 
        at com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsGwtRpc(RPCServletUtils.java:205) 
        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.readContent(AbstractRemoteServiceServlet.java:182) 
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:239) 
        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) 
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) 
        at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:102) 
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
        at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) 
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
        at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) 
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) 
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) 
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) 
        at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:249) 
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
        at org.mortbay.jetty.Server.handle(Server.java:326) 
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) 
        at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) 
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) 
        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135) 
        at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:447) 
        at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:452) 
        at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:458) 
        at com.google.tracing.TraceContext.runInContext(TraceContext.java:698) 
        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336) 
        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328) 
        at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:456) 
        at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251) 
        at java.lang.Thread.run(Thread.java:679) 
    
    +0

    任何一個在這個請嗎? – Vik

    回答

    1

    看看這個文件,這是上面叫: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/server/rpc/RPCServletUtils.java

    因爲這是在

    public static String readContentAsGwtRpc(HttpServletRequest request) 
        throws IOException, ServletException { 
        return readContent(request, GWT_RPC_CONTENT_TYPE, CHARSET_UTF8_NAME); 
    } 
    

    鍵指定你不會要能夠很容易地改變預期的內容類型,似乎是你從Facebook的XFBML調用一個RPC特定的servlet。嘗試調用RPC特定的調用是不值得的,你可能無法改變FB如何調用它。最簡單的解決方案是添加另一個接受普通POSTS和GETS的servlet,並從Facebook調用它。

    +0

    看起來像一個很棒的建議。將嘗試並更新你 – Vik

    1

    我看到你的錯誤顯示:內容類型是 '應用/的X WWW的形式,進行了urlencoded'。預期'text/x-gwt-rpc'

    我會將您的servlet中的預期內容類型更改爲'text/x-gwt-rpc'。你的servlet獲得回調嗎?

    +0

    如何更改servlet中的預期內容類型? – Vik

    +0

    是的,這是servlet獲得回調 – Vik

    相關問題