當前位置: 首頁>>代碼示例>>Java>>正文


Java StaplerRequest類代碼示例

本文整理匯總了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.
}
 
開發者ID:ranorex,項目名稱:Jenkins-Ranorex-Plugin,代碼行數:8,代碼來源:RanorexRunnerBuilder.java

示例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;
}
 
開發者ID:microcks,項目名稱:microcks-jenkins-plugin,代碼行數:14,代碼來源:TimedBuildStepDescriptor.java

示例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");
}
 
開發者ID:jenkinsci,項目名稱:gitea-plugin,代碼行數:27,代碼來源:GiteaWebhookAction.java

示例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;
}
 
開發者ID:openshift,項目名稱:jenkins-client-plugin,代碼行數:18,代碼來源:ResourceSelector.java

示例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);
}
 
開發者ID:TommyLin,項目名稱:cppchecker,代碼行數:12,代碼來源:Cppchecker.java

示例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
}
 
開發者ID:nfultz,項目名稱:aws-batch,代碼行數:15,代碼來源:AwsBatchBuilder.java

示例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);
}
 
開發者ID:10000TB,項目名稱:Jenkins-Plugin-Examples,代碼行數:12,代碼來源:EnvStep.java

示例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);
		}
	}
 
開發者ID:jenkinsci,項目名稱:no-agent-job-purge-plugin,代碼行數:22,代碼來源:PurgeNoAgentJobs.java

示例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);
}
 
開發者ID:riboseinc,項目名稱:aws-codecommit-trigger-plugin,代碼行數:8,代碼來源:SQSTrigger.java

示例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;
}
 
開發者ID:riboseinc,項目名稱:aws-codecommit-trigger-plugin,代碼行數:16,代碼來源:SQSTrigger.java

示例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);
}
 
開發者ID:riboseinc,項目名稱:aws-codecommit-trigger-plugin,代碼行數:8,代碼來源:SQSScmConfig.java

示例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;
}
 
開發者ID:devlauer,項目名稱:jenkins-keycloak-plugin,代碼行數:8,代碼來源:KeycloakSecurityRealm.java

示例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);
   }
 
開發者ID:SxMShaDoW,項目名稱:embeddable-badges-plugin,代碼行數:26,代碼來源:PublicBadgeAction.java

示例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);
}
 
開發者ID:SxMShaDoW,項目名稱:embeddable-badges-plugin,代碼行數:26,代碼來源:PublicBadgeAction.java


注:本文中的org.kohsuke.stapler.StaplerRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。