Basic Authentication at Grizzly Server

烂漫一生 提交于 2019-12-13 00:20:51

问题


I am using Jersey Grizzly and want to implement Basic Authentication to Grizzly. I create my grizzly server as follows:

ResourceConfig rc = new PackagesResourceConfig("com.abc.de");
GrizzlyServerFactory.createHttpServer(BASE_URI, rc);

at another class I have something like:

@GET
@Produces("text/plain")
@Path("/description")
public String getDescription() {
    String description = "probeDescription";
    return description;
}

I don't know the difference and main concepts of jersey and grizzly. What jersey can't do that grizzly can. However I want that if a user wants to get description it should pass the basic authentication.

Any ideas about how can I implement it?


回答1:


I followed that example: http://java.net/projects/jersey/sources/svn/show/trunk/jersey/samples/https-clientserver-grizzly?rev=5752 and it works.



来源:https://stackoverflow.com/questions/11325334/basic-authentication-at-grizzly-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!