2
私はリソースを確保していますが、認証を削除しても動作するようですが、セキュリティがなければ何がポイントですか?ここでセキュリティで保護されたdropwizardリソースに引数を渡す
は私のコードです:
@POST
@Path("/secured")
@Timed
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@UnitOfWork
@RolesAllowed("mainUser")
public Response aliveSecure(@Auth User user, CustomRequest test)
{
CustomResponse resp = new CustomResponse();
System.out.println(test.getMessage());
return Response.status(Response.Status.ACCEPTED).entity(resp).build();
}
CustomRequestとCustomResponse種類はかなり標準のPOJOている、彼らは単に「メッセージ」と呼ばれる文字列を保持する - 彼らは実際には同じですが、これは私がしようとしているだけの運動ですDropWizardを学ぶために完了すること。
ここで@Authのものと@RolesAllowedなどを削除すると、そのメソッドが安全でないものになりますが、メソッドは正常に実行されますが、これはアプリケーションの起動時に発生するエラーです。
org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
! [[FATAL] No injection source found for a parameter of type public CustomRequest at index 0.;
を拡張している、あなたの
Service
に以下を追加確保しなければならない!!!!ありがとう!! :) – MickeyThreeSheds@MickeyThreeShedsお勧めします。 :) – nullpointer