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