java - dropwizard 0.7 @Session annotation -
i'm trying dropwizard working sessions. i've read in 0.7, dropwizard added session support. release notes: "added support http sessions. add annotated parameter resource method: @session httpsession session have session context injected."
i have sample resource class, gets user/password http request, , want save user name in session:
@get public response auth(@queryparam("user") string user, @queryparam("password") string password, @session httpsession session) throws urisyntaxexception { uri rooturi = getapplicationrooturi(); if(!user.equals(config.getuser()) || !password.equals(config.getpassword())) { return response.temporaryredirect(rooturi).build(); } session.setattribute("user", user); return response.temporaryredirect( new uri("/../index.html")).build(); }
when trying log in app i'm getting:
error [2014-05-17 10:33:45,244] com.sun.jersey.spi.container.containerrequest: message body reader java class javax.servlet.http.httpsession, , java type interface javax.servlet.http.httpsession, , mime media type application/octet-stream not found.
i've tried looking on tests dropwizard source on github , seems @session annotation used same way in code.
any ideas?
thanks!
what had (dropwizard 0.7) in application class was:
environment.jersey().register(httpsessionprovider.class); environment.servlets().setsessionhandler(new sessionhandler());
Comments
Post a Comment