Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gwt RPC调用的Servlet映射_Gwt_Servlets_Rpc_Web.xml - Fatal编程技术网

Gwt RPC调用的Servlet映射

Gwt RPC调用的Servlet映射,gwt,servlets,rpc,web.xml,Gwt,Servlets,Rpc,Web.xml,我对GWT编程相当陌生,但我已经用Java编程很长时间了 我创建了一个带有RPC调用的小应用程序,但它不起作用 当我单击将启动呼叫的按钮时,控制台上仅显示以下消息: [WARN] 404 - POST /wps_akt/student (127.0.0.1) 1401 bytes Request headers Host: 127.0.0.1:8888 Connection: keep-alive Accept: */* User-Agent

我对GWT编程相当陌生,但我已经用Java编程很长时间了

我创建了一个带有RPC调用的小应用程序,但它不起作用

当我单击将启动呼叫的按钮时,控制台上仅显示以下消息:

[WARN] 404 - POST /wps_akt/student (127.0.0.1) 1401 bytes
   Request headers
      Host: 127.0.0.1:8888
      Connection: keep-alive
      Accept: */*
      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
      Accept-Encoding: gzip,deflate,sdch
      Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
      Content-Length: 137
      X-GWT-Module-Base: http://127.0.0.1:8888/wps_akt/
      X-GWT-Permutation: HostedMode
      Origin: http://127.0.0.1:8888
      Content-Type: text/x-gwt-rpc; charset=UTF-8
      Referer: http://127.0.0.1:8888/Wps_akt.html?gwt.codesvr=127.0.0.1:9997
   Response headers
      Content-Type: text/html; charset=iso-8859-1
      Content-Length: 1401
web.xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">



  <!-- Servlets -->
    <servlet>
    <servlet-name>StudentServiceImpl</servlet-name>
    <servlet-class>at.htlpinkafeld.wps.server.StudentServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>StudentServiceImpl</servlet-name>
    <url-pattern>/student</url-pattern>
  </servlet-mapping>


  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>Wps_akt.html</welcome-file>
  </welcome-file-list>

</web-app>

学生服务项目
at.htlpinkafeld.wps.server.studentserviceinpl
学生服务项目
/学生
Wps_akt.html
谢谢你的帮助 中的Stefan

GWT-RPC路径相对于
GWT.getModuleBaseURL()
,即GWT生成*.nocache.js和.cache的文件夹。文件(该文件夹以GWT模块的名称命名,或以*.GWT.xml文件中的
重命名为
属性命名)

所以你的
应该使用
/wps\u akt/student
而不仅仅是
/student

如果您想使用
/student
,那么您必须调整
@RemoteServiceRelativePath
以读取
”。/student“
(假设GWT编译器接受它),或者显式设置路径(将服务转换为
ServiceDefTarget
,并使用您将servlet映射到的URL进行调用)