本文整理汇总了Java中org.kohsuke.stapler.StaplerRequest.bindJSON方法的典型用法代码示例。如果您正苦于以下问题:Java StaplerRequest.bindJSON方法的具体用法?Java StaplerRequest.bindJSON怎么用?Java StaplerRequest.bindJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kohsuke.stapler.StaplerRequest
的用法示例。
在下文中一共展示了StaplerRequest.bindJSON方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSeries
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
/**
* Using file and label and the Stapler request, create a subclass of series
* that can process the type selected.
*
* @param formData
* JSON data for series
*/
public static Series createSeries(JSONObject formData, StaplerRequest req) {
String file = formData.getString("file");
formData = formData.getJSONObject("fileType");
formData.put("file", file);
String type = formData.getString("value");
Class<? extends Series> typeClass = null;
if ("properties".equals(type))
typeClass = PropertiesSeries.class;
else if ("csv".equals(type))
typeClass = CSVSeries.class;
else if ("xml".equals(type))
typeClass = XMLSeries.class;
return typeClass != null ? req.bindJSON(typeClass, formData) : null;
}
示例2: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json)
throws FormException {
/**
* If all cluster configurations are deleted in the UI and saved,
* binJSON does not set the list. So clear out the list before bind.
*/
clusterConfigs = null;
req.bindJSON(this, json.getJSONObject("openshift"));
save();
return true;
}
示例3: doSubmit
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
public void doSubmit(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
// '$class' in form data tells Stapler which Fruit subclass to use,
// older versions of Jenkins/Stapler used 'stapler-class'
Fruit fruit = req.bindJSON(Fruit.class, req.getSubmittedForm().getJSONObject("fruit"));
rsp.setContentType("text/plain");
new XStream2().toXML(fruit, rsp.getWriter());
}
示例4: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public Config newInstance(@Nonnull final StaplerRequest req, final JSONObject formData) throws FormException {
Config jiraConfig = req.bindJSON(Config.class, formData);
if (jiraConfig.siteName == null) {
jiraConfig = null;
}
return jiraConfig;
}
示例5: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public Config newInstance(@Nonnull final StaplerRequest req, final JSONObject formData)
throws FormException {
Config jiraConfig = req.bindJSON(Config.class, formData);
if (jiraConfig.siteName == null) {
jiraConfig = null;
}
return jiraConfig;
}
示例6: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
req.bindJSON(this, json);
configChange();
save();
return true;
}
示例7: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
GogsProjectProperty tpp = req.bindJSON(
GogsProjectProperty.class,
formData.getJSONObject(GOGS_PROJECT_BLOCK_NAME)
);
if ( tpp != null ) {
LOGGER.info(formData.toString());
LOGGER.info(tpp.gogsSecret);
gogsSecret = tpp.gogsSecret;
}
return tpp;
}
示例8: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
final JSONObject rootNode = json.getJSONObject(NAMESPACE);
req.bindJSON(this, rootNode);
applyEmptyRulesListWorkaroundIfNeeded(rootNode);
save();
return true;
}
示例9: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
if (!ignoreGlobalSettings) {
updateFromGlobalConfiguration();
}
req.bindJSON(this, formData);
save();
return super.configure(req, formData);
}
示例10: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
if (formData.isNullObject()) return null;
JSONObject containersDefinition = formData.getJSONObject("containersDefinition");
if (containersDefinition.isNullObject()) return null;
return req.bindJSON(ContainerSetDefinition.class, containersDefinition);
}
示例11: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
if (formData.has(NAMESPACE)) {
JSONObject config = formData.getJSONObject(NAMESPACE);
req.bindJSON(this, config);
save();
if (config.has("usageStatsEnabled")) {
setEnableUsageStats(config.getBoolean("usageStatsEnabled"));
}
}
return true;
}
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:14,代码来源:BrowserStackBuildWrapperDescriptor.java
示例12: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
req.bindJSON(this, formData.getJSONObject("bitbucket-build-status-notifier"));
save();
return true;
}
开发者ID:jenkinsci,项目名称:bitbucket-build-status-notifier-plugin,代码行数:8,代码来源:BitbucketBuildStatusNotifier.java
示例13: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
req.bindJSON(this, json);
// stapler oddity, empty lists coming from the HTTP request are not set on bean by "req.bindJSON(this, json)"
this.publisherOptions = req.bindJSONToList(MavenPublisher.class, json.get("publisherOptions"));
save();
return true;
}
示例14: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
try {
checkValidConfiguration(json);
enabled = json.getBoolean("enabled");
appId = json.getString("appId");
secret = json.getString("secret");
req.bindJSON(this, json);
save();
savePluginConfiguration();
return super.configure(req, json);
} catch (IOException e) {
throw new FormException(e, e.getMessage());
}
}
示例15: configure
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@Override
public boolean configure(
final StaplerRequest req,
final JSONObject formData)
throws FormException {
req.bindJSON(this, formData);
save();
return super.configure(req, formData);
}