GWTP Resourceselegate响应不确定



我正在尝试从GWTP主持人那里获得REST服务的响应。我的SecurityDelegate触发了Onsuccess方法,但UserDTO似乎是空的。网络工具向我展示了使用HTTP代码200的请求以及与当前用户的响应。由于某种原因,Userdto似乎是空的。

记录器向我展示

类:xx.xxxx.xxx.web.shared.dto.userdto@1f

名称:未定义

    //LoginPresenter.java
    securityDelegate.withCallback(new AsyncCallback<UserDTO>() {
        @Override
        public void onFailure(Throwable throwable) {
            Window.alert("fail");
        }
        @Override
        public void onSuccess(UserDTO user) {
            LOGGER.info("CLASS:"+user.toString());
            LOGGER.info("Name:"+user.getName());
        }
    }).authenticate(username,password);
    //SecurityResource.java
    @Path("/security")
    @Produces (MediaType.APPLICATION_JSON)
    @Consumes (MediaType.APPLICATION_JSON)
    public interface SecurityResource {
        @POST
        @Path ("/authenticate")
        RestAction<UserDTO> authenticate(@HeaderParam ("username") String username,@HeaderParam("password") String password);
    }
    //SecurityResourceImpl.java
    @Path ("/security")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes (MediaType.APPLICATION_JSON)
    public class SecurityResourceImpl {
        @EJB
        private SecurityBean securityBean;
        @POST
        @Path("/authenticate")
        @Override
        public Response authenticate(@HeaderParam ("username")
    String username, @HeaderParam("password") String password){
        User currentUser = securityBean.find(username,password);
        return Response.ok().entity(new UserDTO(currentUser)).build();
      }
}
    //UserDTO.java
    public class UserDTO implements Serializable {
        private String name;
        public UserDTO(){
        }
        public UserDTO(User user){...}
        //getters/setters
    }

我不好,我忘了定义设定器!我将UserDto定义为构建器模式。

相关内容

  • 没有找到相关文章

最新更新