|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wink.client.handlers.BasicAuthSecurityHandler
public class BasicAuthSecurityHandler
SecurityHandler for a client to perform http basic auth:
Usage:
ClientConfig config = new ClientConfig();
BasicAuthSecurityHandler basicAuth = new BasicAuthSecurityHandler();
basicAuth.setUserName("user1");
basicAuth.setPassword("password2");
config.handlers(basicAuth);
// create the rest client instance
RestClient client = new RestClient(config);
// create the resource instance to interact with Resource
resource = client.resource("https://localhost:8080/path/to/resource");
Constructor Summary | |
---|---|
BasicAuthSecurityHandler()
|
Method Summary | |
---|---|
ClientResponse |
handle(ClientRequest request,
HandlerContext context)
Performs basic HTTP authentication. |
void |
setPassword(java.lang.String aPassword)
Sets the password to use. |
void |
setUserName(java.lang.String aUserName)
Sets the username to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicAuthSecurityHandler()
Method Detail |
---|
public void setUserName(java.lang.String aUserName)
aUserName
- the user namepublic void setPassword(java.lang.String aPassword)
aPassword
- the password to usepublic ClientResponse handle(ClientRequest request, HandlerContext context) throws java.lang.Exception
handle
in interface ClientHandler
client
- request objecthandler
- context object
java.lang.Exception
- any exception can be thrown by a handler and it will be
caught by the underlying client implementation and wrapped in
a ClientRuntimeException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |