本文整理匯總了Java中hudson.util.FormValidation.okWithMarkup方法的典型用法代碼示例。如果您正苦於以下問題:Java FormValidation.okWithMarkup方法的具體用法?Java FormValidation.okWithMarkup怎麽用?Java FormValidation.okWithMarkup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hudson.util.FormValidation
的用法示例。
在下文中一共展示了FormValidation.okWithMarkup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doTestConnection
import hudson.util.FormValidation; //導入方法依賴的package包/類
public FormValidation doTestConnection(@AncestorInPath ItemGroup context,
@QueryParameter("credentialsId") final String credentialsId) {
String targetAPI = chooseTargetAPI(environment);
if (!credentialsId.equals(preCredentials) || Util.isNullOrEmpty(bluemixToken)) {
preCredentials = credentialsId;
try {
String newToken = getBluemixToken(context, credentialsId, targetAPI);
if (Util.isNullOrEmpty(newToken)) {
bluemixToken = newToken;
return FormValidation.warning("<b>Got empty token</b>");
} else {
return FormValidation.okWithMarkup("<b>Connection successful</b>");
}
} catch (Exception e) {
return FormValidation.error("Failed to log in to Bluemix, please check your username/password");
}
} else {
return FormValidation.okWithMarkup("<b>Connection successful</b>");
}
}
示例2: doTestConnection
import hudson.util.FormValidation; //導入方法依賴的package包/類
public FormValidation doTestConnection(@AncestorInPath ItemGroup context,
@QueryParameter("credentialsId") final String credentialsId) {
String targetAPI = chooseTargetAPI(environment);
if (!credentialsId.equals(preCredentials) || Util.isNullOrEmpty(bluemixToken)) {
preCredentials = credentialsId;
try {
String newToken = getBluemixToken(context, credentialsId, targetAPI);
if (Util.isNullOrEmpty(newToken)) {
bluemixToken = newToken;
return FormValidation.warning("<b>Got empty token</b>");
} else {
return FormValidation.okWithMarkup("<b>Connection successful</b>");
}
} catch (Exception e) {
return FormValidation.error("Failed to log in to Bluemix, please check your username/password");
}
} else {
return FormValidation.okWithMarkup("<b>Connection successful</b>");
}
}