本文整理汇总了Java中org.kohsuke.stapler.StaplerRequest类的典型用法代码示例。如果您正苦于以下问题:Java StaplerRequest类的具体用法?Java StaplerRequest怎么用?Java StaplerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaplerRequest类属于org.kohsuke.stapler包,在下文中一共展示了StaplerRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException
{
useSummarize = formData.getBoolean("useSummarize");
save();
return super.configure(req, formData); //To change body of generated methods, choose Tools | Templates.
}
示例2: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public synchronized boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
wait = formData.getString("wait");
waitUnit = ITimedMicrocksPlugin.TimeoutUnit.normalize(formData.getString("waitUnit"));
if (wait == null || wait.isEmpty()) {
// If someone clears the value, go back to default and use seconds
wait = "" + getStaticDefaultWaitTime() / ITimedMicrocksPlugin.TimeoutUnit.SECONDS.multiplier;
waitUnit = ITimedMicrocksPlugin.TimeoutUnit.SECONDS.name;
}
wait = wait.trim();
save();
return true;
}
示例3: doPost
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
public HttpResponse doPost(StaplerRequest request) throws IOException {
if (!request.getMethod().equals("POST")) {
return HttpResponses
.error(HttpServletResponse.SC_BAD_REQUEST,
"Only POST requests are supported, this was a " + request.getMethod() + " request");
}
if (!"application/json".equals(request.getContentType())) {
return HttpResponses
.error(HttpServletResponse.SC_BAD_REQUEST,
"Only application/json content is supported, this was " + request.getContentType());
}
String type = request.getHeader("X-Gitea-Event");
if (StringUtils.isBlank(type)) {
return HttpResponses.error(HttpServletResponse.SC_BAD_REQUEST,
"Expecting a Gitea event, missing expected X-Gitea-Event header");
}
String origin = SCMEvent.originOf(request);
boolean processed = false;
for (GiteaWebhookHandler<?, ?> h : ExtensionList.lookup(GiteaWebhookHandler.class)) {
if (h.matches(type)) {
h.process(request.getInputStream(), origin);
processed = true;
}
}
return HttpResponses.plainText(processed ? "Processed" : "Ignored");
}
示例4: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public ResourceSelector newInstance(StaplerRequest req,
JSONObject formData) throws FormException {
ResourceSelector s = super.newInstance(req, formData);
String selectionType = formData.getString("selectionType");
System.out.println("parms2: " + selectionType);
if (SELECT_BY_KIND.equals(selectionType)) {
s.names = null;
}
if (SELECT_BY_NAMES.equals(selectionType)) {
s.kind = null;
s.labels = null;
}
return s;
}
示例5: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
// To persist global configuration information,
// set that to properties and call save().
useDefault = formData.getBoolean("useDefault");
exePath = formData.getString("exePath");
// ^Can also use req.bindJSON(this, formData);
// (easier when there are many fields; need set* methods for this, like setUseDefault)
save();
return super.configure(req, formData);
}
示例6: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest staplerRequest, JSONObject json) throws FormException {
// to persist global configuration information,
// set that to properties and call save().
//System.out.println(json.toString());
if(json.containsKey("logPollingFreq")) {
logPollingFreq = json.getInt("logPollingFreq");
}
else {
logPollingFreq = 15;
}
save();
return true; // indicate that everything is good so far
}
示例7: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override public Step newInstance(StaplerRequest req, JSONObject formData) throws FormException {
String overridesS = formData.getString("overrides");
List<String> overrides = new ArrayList<>();
for (String line : overridesS.split("\r?\n")) {
line = line.trim();
if (!line.isEmpty()) {
overrides.add(line);
}
}
return new EnvStep(overrides);
}
示例8: doEndOfflineAgentJobs
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
public void doEndOfflineAgentJobs(final StaplerRequest request, final StaplerResponse response) {
Jenkins j;
if ((j = Jenkins.getInstance()) != null) {
Queue queue = j.getQueue();
if (queue != null) {
for (Item job : queue.getItems()) {
if (job.getCauseOfBlockage() instanceof BecauseNodeIsOffline
|| job.getCauseOfBlockage() instanceof BecauseLabelIsOffline) {
queue.cancel(job);
}
}
}
}
try {
response.sendRedirect2(request.getRootPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例9: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public Trigger newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
if (jsonObject.has("subscribeInternalScm")) {
jsonObject.put("subscribeInternalScm", Boolean.TRUE);
}
return super.newInstance(req, jsonObject);
}
示例10: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(final StaplerRequest req, final JSONObject json) throws FormException {
Object sqsQueues = json.get("sqsQueues");
if (json.size() == 1) {
String key = json.keys().next().toString();
sqsQueues = json.getJSONObject(key).get("sqsQueues");
}
this.sqsQueues = req.bindJSONToList(SQSTriggerQueue.class, sqsQueues);
this.initQueueMap();
this.save();
EventBroker.getInstance().post(new ConfigurationChangedEvent());
return true;
}
示例11: newInstance
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public SQSScmConfig newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
JSONObject json = jsonObject.getJSONObject("type");
json.put("type", json.getString("value"));
json.remove("value");
return super.newInstance(req, json);//req.bindJSON(SQSScmConfig.class, json);
}
示例12: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
json = json.getJSONObject("keycloak");
keycloakJson = json.getString("keycloakJson");
save();
return true;
}
示例13: configure
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
json = json.getJSONObject("config");
webhookSecret = json.getString("webhookSecret");
save();
return true;
}
开发者ID:codeclou,项目名称:jenkins-github-webhook-build-trigger-plugin,代码行数:8,代码来源:GithubWebhookBuildTriggerPluginBuilder.java
示例14: doTestIcon
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
/**
* Serves the testCoverage badge image. TO DO
* @param req
* @param rsp
* @param job
* @return
*/
@SuppressWarnings("rawtypes")
public HttpResponse doTestIcon(StaplerRequest req, StaplerResponse rsp, @QueryParameter String job) {
Job<?, ?> project = getProject(job);
Integer testPass = null;
Integer testTotal = null;
if (project.getLastCompletedBuild() != null) {
AbstractTestResultAction testAction = project.getLastCompletedBuild().getAction(AbstractTestResultAction.class);
if(testAction != null){
int total = testAction.getTotalCount();
int pass = total - testAction.getFailCount() - testAction.getSkipCount();
testTotal = total;
testPass = pass;
}
}
return iconResolver.getTestResultImage(testPass, testTotal);
}
示例15: doBuildDescriptionIcon
import org.kohsuke.stapler.StaplerRequest; //导入依赖的package包/类
/**
* Serves the Build Description badge image.
* @param req
* @param rsp
* @param job
* @return
*/
public HttpResponse doBuildDescriptionIcon(StaplerRequest req, StaplerResponse rsp, @QueryParameter String job) {
Job<?, ?> project = getProject(job);
String buildDescription = null;
/*if (project.getLastSuccessfulBuild() != null) {
buildDescription = project.getLastSuccessfulBuild().getDescription();
}*/
/*if (project.getLastBuild() != null) {
buildDescription = project.getLastBuild().getDescription();
}*/
if (project.getLastCompletedBuild() != null) {
buildDescription = project.getLastCompletedBuild().getDescription();
}
return iconResolver.getBuildDescriptionImage(buildDescription);
}