本文介绍了Grizzly服务器上的基本身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jersey Grizzly,并且想要对Grizzly实施基本身份验证.我按如下方式创建我的grizzly服务器:

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?

推荐答案

我遵循了该示例: http://java.net/projects/jersey/sources/svn/show/trunk/jersey/samples/https-clientserver-grizzly?rev=5752 并且有效.

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

这篇关于Grizzly服务器上的基本身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 19:35