Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.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
Spring Rest服务HttpStatus代码400 GET/user/%7Bid%7D_Spring_Google App Engine_Rest_Maven_Gwt - Fatal编程技术网

Spring Rest服务HttpStatus代码400 GET/user/%7Bid%7D

Spring Rest服务HttpStatus代码400 GET/user/%7Bid%7D,spring,google-app-engine,rest,maven,gwt,Spring,Google App Engine,Rest,Maven,Gwt,我只是试图通过控制器服务接口获取用户数据,但我总是得到 [WARN] 400 - GET /user/%7Bid%7D (127.0.0.1) 1403 bytes 我的控制器: @Controller @RequestMapping(value ="/user") public class AdminSpringController { @RequestMapping( value = "/{id}", method = RequestMethod.GET) @ResponseSt

我只是试图通过控制器服务接口获取用户数据,但我总是得到

[WARN] 400 - GET /user/%7Bid%7D (127.0.0.1) 1403 bytes
我的控制器:

@Controller
@RequestMapping(value ="/user")
public class AdminSpringController {

@RequestMapping( value = "/{id}", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.OK)
    public @ResponseBody GWTUser getUser(@PathVariable Integer id) throws NotFoundException {
...
}

}
我的服务,它是一个restygwt接口:

@Path("/user")
public interface UserAdminRestService extends RestService {

@GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public void getUser(Integer id, MethodCallback<GWTUser> callback);
}
@Path(“/user”)
公共接口UserAdminRestService扩展了RestService{
@得到
@路径(“/{id}”)
@产生(MediaType.APPLICATION_JSON)
@使用(MediaType.APPLICATION_JSON)
public void getUser(整数id,MethodCallback);
}
我的servlet:

<servlet>
    <servlet-name>userService</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/classes/servlet/userService-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>userService</servlet-name>   
    <url-pattern>/</url-pattern>
  </servlet-mapping>

用户服务
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/classes/servlet/userService-servlet.xml
1.
用户服务
/
myservlet.xml

<context:component-scan base-package="com.app.admin.controller" />

    <tx:annotation-driven />

    <mvc:annotation-driven />

    <!--This tag allows for mapping the DispatcherServlet to "/" (all extensions etc) -->
    <mvc:default-servlet-handler/> 


    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
            <list>
                <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />             
            </list>
        </property>
    </bean>

我已经有了一个方法
(user/users
,它返回所有用户,工作正常,但我认为问题在于我的
{id}
(参数变量),因为我的服务或其他东西似乎解析了我的
{id}
,正如你在我的错误
/user/%7Bid%7D
.Thx中看到的任何帮助。

缺少
@PathParam服务接口中的(“id”)
是问题所在

public void getUser(@PathParam("id") Integer id, MethodCallback<GWTUser> callback);
@PUT
@Path("/update")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public void update(GWTUser user, MethodCallback<UserServiceResponse> callback);
@RequestMapping( value = "/update", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
public void update(@RequestBody GWTUser gwtUser) {