本文整理匯總了Java中mesosphere.marathon.client.auth.TokenAuthRequestInterceptor類的典型用法代碼示例。如果您正苦於以下問題:Java TokenAuthRequestInterceptor類的具體用法?Java TokenAuthRequestInterceptor怎麽用?Java TokenAuthRequestInterceptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TokenAuthRequestInterceptor類屬於mesosphere.marathon.client.auth包,在下文中一共展示了TokenAuthRequestInterceptor類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //導入依賴的package包/類
public Marathon build() {
if (null == listOfServers) {
if (!StringUtils.isEmpty(token)) {
return getInstanceWithTokenAuth(baseEndpoint, token);
} else if (!StringUtils.isEmpty(username)) {
return getInstanceWithBasicAuth(baseEndpoint, username, password);
} else {
return getInstance(baseEndpoint);
}
} else {
setMarathonRibbonProperty("listOfServers", listOfServers);
setMarathonRibbonProperty("OkToRetryOnAllOperations", Boolean.TRUE.toString());
setMarathonRibbonProperty("MaxAutoRetriesNextServer", maxRetryCount);
setMarathonRibbonProperty("ConnectTimeout", connectionTimeout);
setMarathonRibbonProperty("ReadTimeout", readTimeout);
Feign.Builder builder = Feign.builder()
.client(RibbonClient.builder().lbClientFactory(new MarathonLBClientFactory()).build())
.encoder(new GsonEncoder(ModelUtils.GSON))
.decoder(new GsonDecoder(ModelUtils.GSON))
.errorDecoder(new MarathonErrorDecoder());
if (!StringUtils.isEmpty(token)) {
builder.requestInterceptor(new TokenAuthRequestInterceptor(token));
}
else if (!StringUtils.isEmpty(username)) {
builder.requestInterceptor(new BasicAuthRequestInterceptor(username,password));
}
builder.requestInterceptor(new MarathonHeadersInterceptor());
return builder.target(Marathon.class, DEFAULT_MARATHON_ENDPOINT);
}
}
示例2: createMarathonClient
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //導入依賴的package包/類
private static Marathon createMarathonClient() {
String token = LoginClient.getAuthToken(LOGIN_URL);
return getInstance(ENDPOINT, new TokenAuthRequestInterceptor(token));
}
示例3: getInstanceWithTokenAuth
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //導入依賴的package包/類
public static Metronome getInstanceWithTokenAuth(String endpoint, String token) {
return getInstance(endpoint, new TokenAuthRequestInterceptor(token));
}
示例4: createMetronomeClient
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //導入依賴的package包/類
private static Metronome createMetronomeClient() {
String token = LoginClient.getAuthToken(LOGIN_URL);
return MetronomeClient.getInstance(ENDPOINT, new TokenAuthRequestInterceptor(token));
}
示例5: getInstanceWithTokenAuth
import mesosphere.marathon.client.auth.TokenAuthRequestInterceptor; //導入依賴的package包/類
/**
* Creates a Marathon client proxy that uses a token for authentication.
*
* @param endpoint URL of Marathon
* @param token token
* @return Marathon client
*/
public static Marathon getInstanceWithTokenAuth(String endpoint, String token) {
return getInstance(endpoint, new TokenAuthRequestInterceptor(token));
}