|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ApplicationLinkRequestFactory
Provides authenticated ApplicationLinkRequest
objects. Use the
ApplicationLink.createAuthenticatedRequestFactory()
or
ApplicationLink.createAuthenticatedRequestFactory(Class)
method to create an
ApplicationLinkRequestFactory
targeting a particular remote ApplicationLink
.
Method Summary | |
---|---|
ApplicationLinkRequest |
createRequest(com.atlassian.sal.api.net.Request.MethodType methodType,
java.lang.String url)
Creates a request of the given method type to the given url. |
Methods inherited from interface com.atlassian.applinks.api.AuthorisationURIGenerator |
---|
getAuthorisationURI, getAuthorisationURI |
Method Detail |
---|
ApplicationLinkRequest createRequest(com.atlassian.sal.api.net.Request.MethodType methodType, java.lang.String url) throws CredentialsRequiredException
AuthenticationProvider
s. See
ApplicationLink.createAuthenticatedRequestFactory()
for more details.
ApplicationLinkRequestFactory
requestFactory =ApplicationLink.createAuthenticatedRequestFactory()
;ApplicationLinkRequest
request; try { request = requestFactory.createRequest(Request.MethodType#GET
, "/rest/my-plugin/1.0/my-resource"); } catch (CredentialsRequiredException
e) { // we don't have credentials stored for the context user, so prompt user to authenticate // using the URI provided byCredentialsRequiredException.getAuthorisationURI()
// ... } try { boolean success = request.execute(newApplicationLinkResponseHandler
<Boolean>() { Boolean handle(Response
response) throwsResponseException
{ return response.Response.isSuccessful()
) } Boolean credentialsRequired(Response
response) throwsResponseException
{ // the remote server rejected our credentials, so prompt the user to authenticate // using the URI provided byAuthorisationURIGenerator.getAuthorisationURI()
// ... } }); } catch (ResponseException
re) { // the request failed to complete normally }
methodType
- The HTTP method typeurl
- The target of the request. If you specify a URI that does not start with a protocol string
(e.g. http: or https:) the target ApplicationLink
's rpcUrl will be pre-pended to the request
URI. Specified absolute URIs will be used as is.
ApplicationLinkRequest
object
CredentialsRequiredException
- when the target ApplicationLink
requires authentication, but no
credentials are available for the context user.CredentialsRequiredException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |