1
我在服务器端使用HTTP摘要身份验证机制,客户端是Firefox。Restlet中的HTTP身份验证,验证子网址
这是服务器端代码
Application application = new Vehicle();
component.getDefaultHost().attachDefault(application);
component.getDefaultHost().attach("/home",new Home());
DigestAuthenticator guard = new DigestAuthenticator(null, "TestRealm","mySecretServerKey");
Instantiates a Verifier of identifier/secret couples based on a simple Map.
MapVerifier mapVerifier = new MapVerifier();
负载,单一的静态登录/秘密对。
mapVerifier.getLocalSecrets().put("login", "secret".toCharArray());
guard.setWrappedVerifier(mapVerifier);
卫队的Restlet
guard.setNext(application);
component.getDefaultHost().attachDefault(guard);
component.start();
在家庭类
Router router = new Router(getContext());
router.attach("/People", People.class);
router.attach("/categories/",Categories.class);
return router;
,如果我要求http://localhost:8182/
HTTP验证工作,但http://localhost:8182/home/categories/
不要求任何http authentication
如果我们首先尝试/home/categories/
代替http://localhost:8182/
它会给出结果与任何身份验证机制SM。如何解决这个问题?
感谢您的回复,将尝试您的建议。 – ridy 2012-02-15 05:40:33