2016-11-24 15 views
0

GWTPプレゼンターからのRESTサービスからの応答を取得しようとしています。私のsecurityDelegateはonSuccessメソッドをトリガしますが、UserDTOは空であるようです。ネットワークツールはHTTPコード200のリクエストと現在のユーザーの応答を表示します。何らかの理由でUserDTOが空であるようです。GWTP ResourceDelegate response undefined

LOGGERくれ

CLASSを示しています。[email protected]

名:未定義

//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 
    } 

答えて

0

私の悪いが、私が定義するのを忘れてしセッター!私はBuilderパターンとしてUserDTOを定義しました。

関連する問題