How to access header values of request in Java Restlet?

前端 未结 5 1277
挽巷
挽巷 2021-01-13 20:23

I am developing web services using Restlet Java.

For this I want to protect some webservices from unauthorized clients. So I have written Filter cla

5条回答
  •  耶瑟儿~
    2021-01-13 20:38

    Please also notice that Restlet provides an API for RESTful application. This means that you can access standard headers using this API. In most cases, you donn't need to use the attribute named "org.restlet.http.headers".

    For example, if you want to set a Location header in the response, you add this code:

    getResponse().setLocationRef("http://...");
    

    Otherwise, since you talk about security, Restlet provides a generic API to support such aspect (see classes ChallengeAuthenticator, Verifier, Enroler).

    Hope it helps you. Thierry

提交回复
热议问题