当前位置: 首页>>代码示例>>Java>>正文


Java StaplerResponse.sendRedirect方法代码示例

本文整理汇总了Java中org.kohsuke.stapler.StaplerResponse.sendRedirect方法的典型用法代码示例。如果您正苦于以下问题:Java StaplerResponse.sendRedirect方法的具体用法?Java StaplerResponse.sendRedirect怎么用?Java StaplerResponse.sendRedirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kohsuke.stapler.StaplerResponse的用法示例。


在下文中一共展示了StaplerResponse.sendRedirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doDynamic

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    // Relax the Content Security Policy
    System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "");
    System.setProperty("jenkins.model.DirectoryBrowserSupport.CSP", "");

    DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(this, new FilePath(this.dir()), this.getTitle(), getUrlName(), false);
    File report = new File(dir(), DONUT_REPORT_FILENAME);

    if (!report.exists()) {
        rsp.sendRedirect(Functions.getResourcePath() + "/plugin/donut-jenkins-plugin/error.html");
        return;
    }

    dbs.setIndexFileName(DONUT_REPORT_FILENAME);
    dbs.generateResponse(req, rsp, this);
}
 
开发者ID:DonutReport,项目名称:donut-jenkins-plugin,代码行数:17,代码来源:DonutAction.java

示例2: doParamsSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doParamsSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    List<BuildTargetParameter> buildTargetParams;
    TargetParameterBuildAction paramAction;
    JSONObject jsonObject;
    TargetBuildParameterUtil buildParamUtil = new TargetBuildParameterUtil();
    jsonObject = req.getSubmittedForm();
    buildTargetParams = buildParamUtil.parse(jsonObject);
    if (buildTargetParams == null) {
        rsp.sendRedirect(400, "Invalid Parameters - All Fields must be filed");
        return;
    } else {
        paramAction = new TargetParameterBuildAction();
        paramAction.setBaseBranch(jsonObject.getString("baseBranch"));
        paramAction.setParameters(buildTargetParams);
        Hudson.getInstance().getQueue().schedule2(project, 0, paramAction, new CauseAction(new Cause.UserIdCause()));
    }
    rsp.sendRedirect("../");
}
 
开发者ID:maidsafe-archive,项目名称:CI-Jenkins-Plugin,代码行数:19,代码来源:GitHubTargetParameterAction.java

示例3: doSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * handles the add request for multiple Fossil Tags
 * 
 * @param req the form request
 * @param rsp the form response
 * @throws IOException
 * @throws ServletException 
 */
public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    getACL().checkPermission(getPermission());

    MultipartFormDataParser parser = new MultipartFormDataParser(req);

    Map<FossilCheckinWithTags, String> newTags = new HashMap<FossilCheckinWithTags, String>();

    int i=-1;
    for (FossilCheckinWithTags e : this.revisions) {
        ++i;
        if (parser.get("tag" + i) != null && ! parser.get("name" + i).isEmpty()) {
            newTags.put(e, parser.get("name" + i));
        }
    }

    new TagWorkerThread(newTags, parser.get("force") != null).start();

    rsp.sendRedirect(".");
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:28,代码来源:FossilTagAction.java

示例4: doDelete

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * Handles the deletion request for a Fossil tag.
 * 
 * @param req the form request
 * @param rsp the form response
 * @throws IOException
 * @throws ServletException 
 */
public synchronized void doDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
    getACL().checkPermission(getPermission());

    if (req.getParameter("tag") != null) {
        FossilCheckinWithTags revision = null;
        String tag = null;

        for (FossilCheckinWithTags e : this.revisions) {
            if (e.getRevId().equals(req.getParameter("revid"))) {
                revision = e;
                tag = req.getParameter("tag");
            }
        }

        new TagDeletionWorkerThread(revision, tag).start();
    }

    rsp.sendRedirect(".");
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:28,代码来源:FossilTagAction.java

示例5: doChangeSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doChangeSubmit(StaplerRequest req, StaplerResponse rsp)
		throws IOException, ServletException {

	JSONObject formData = req.getSubmittedForm();
	if (!formData.isEmpty()) {
		String port = req.getParameter("_.p4port");
		//String change = req.getParameter("_.change");
		List<Job> jobs = getJobs();

		LOGGER.info("Manual trigger event: ");
		if (port != null) {
			probeJobs(port, jobs);
		} else {
			LOGGER.warning("p4port must be specified");
		}

		// send the user back.
		rsp.sendRedirect("../");
	}
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:21,代码来源:P4Hook.java

示例6: doProjectsSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doProjectsSubmit(StaplerRequest req, StaplerResponse rsp)
		throws IOException, UnsupportedEncodingException, ServletException,
		FormException {
	Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
	CloudCIAuthorizationStrategy.DESCRIPTOR.doProjectsSubmit(req, rsp);
	rsp.sendRedirect(".");
}
 
开发者ID:jenkinsci,项目名称:ssh2easy-plugin,代码行数:8,代码来源:ProjectStrategyConfig.java

示例7: doAssignSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doAssignSubmit(StaplerRequest req, StaplerResponse rsp)
		throws IOException, UnsupportedEncodingException, ServletException,
		FormException {
	Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
	CloudCIAuthorizationStrategy.DESCRIPTOR.doAssignSubmit(req, rsp);
	rsp.sendRedirect(".");
}
 
开发者ID:jenkinsci,项目名称:ssh2easy-plugin,代码行数:8,代码来源:ProjectStrategyConfig.java

示例8: doIndex

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
/**
 * Handles the rebuild request and redirects to deflake config page
 *
 * @param request StaplerRequest the request.
 * @param response StaplerResponse the response handler.
 * @throws java.io.IOException in case of Stapler issues
 * @throws javax.servlet.ServletException if something unfortunate happens.
 * @throws InterruptedException if something unfortunate happens.
 */
public void doIndex(StaplerRequest request, StaplerResponse response) throws
    IOException, ServletException, InterruptedException {
  AbstractBuild currentBuild = request.findAncestorObject(AbstractBuild.class);
  if (currentBuild != null) {

    AbstractProject project = currentBuild.getProject();
    if (project == null) {
      return;
    }
    project.checkPermission(AbstractProject.BUILD);
    response.sendRedirect(DEFLAKE_CONFIG_URL);
  }
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:23,代码来源:DeflakeAction.java

示例9: doBuild

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {

		project.checkPermission(AbstractProject.BUILD);

		List<ParameterValue> values = new ArrayList<ParameterValue>();
		List<ParameterDefinition> defs = new ArrayList<ParameterDefinition>();

		Enumeration<?> names = req.getParameterNames();
		while (names.hasMoreElements()) {
			String name = (String) names.nextElement();
			defs.add(new StringParameterDefinition(name, null));
		}

		for (ParameterDefinition d : defs) {
			StringParameterValue value = (StringParameterValue) d.createValue(req);
			if (value != null && value.value != null && !value.value.isEmpty()) {
				values.add(value);
			}
		}

		// Schedule build
		TimeDuration delay = new TimeDuration(project.getQuietPeriod());
		CauseAction cause = new CauseAction(new Cause.UserIdCause());

		List<ParameterValue> internalParams = extractAndRemoveInternalParameters(values);
		ParametersAction params = new SafeParametersAction(values, internalParams);

		Jenkins j = Jenkins.getInstance();
		if (j != null) {
			Queue queue = j.getQueue();
			queue.schedule(project, delay.getTime(), params, cause);

			// send the user back to the job top page.
			rsp.sendRedirect("../");
		}
	}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:37,代码来源:ReviewAction.java

示例10: doControlSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doControlSubmit(@QueryParameter("stopId") String stopId, StaplerRequest req, StaplerResponse rsp) throws ServletException,
        IOException,
        InterruptedException {

    theCloud.getClient()
        .stopContainerCmd(stopId).exec();

    rsp.sendRedirect(".");
}
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:10,代码来源:DockerManagementServer.java

示例11: doRedirect

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public final Object doRedirect(StaplerRequest req, StaplerResponse rsp) throws IOException {
    DisplayURLProvider provider = lookupProvider(req);
    rsp.sendRedirect(HttpServletResponse.SC_MOVED_TEMPORARILY, getRedirectURL(provider));
    return null;
}
 
开发者ID:jenkinsci,项目名称:display-url-api-plugin,代码行数:6,代码来源:AbstractDisplayAction.java

示例12: doIndex

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doIndex(StaplerRequest request, StaplerResponse response) throws IOException, ServletException {
    if ("GET".equals(request.getMethod())) {
        response.sendRedirect("readme");
        return;
    }

    Project project = getProject();

    if (project == null) {
        response.getWriter().print("Can't find any project, make sure your url is correct");
        return;
    }

    List<ParameterValue> values = new ArrayList<ParameterValue>();

    // add gitlab webhook parameters
    values.addAll(getParametersFromJsonPayload(request));

    // add all parameters with its default value
    ParametersDefinitionProperty paramDefProp = (ParametersDefinitionProperty)project.getProperty(
        ParametersDefinitionProperty.class);

    List<ParameterValue> fromDefault = new ArrayList<ParameterValue>();
    if (paramDefProp != null) {
        List<String> params = paramDefProp.getParameterDefinitionNames();
        for (String item : params) {
            boolean ignore = false;
            for (ParameterValue pv : values) {
                if (pv.getName().equals(item)) {
                    // just ignore the default value, if it has been in the webhook parameters
                    ignore = true;
                }
            }
            if (ignore) {
                continue;
            } else {
                ParameterDefinition pd = paramDefProp.getParameterDefinition(item);
                ParameterValue defaultValue = pd.getDefaultParameterValue();
                if (defaultValue != null) {
                    fromDefault.add(defaultValue);
                }
            }

        }
    }

    values.addAll(fromDefault);

    if (skippingBuildExpressionMatches(project, values)) {
        LOGGER.log(Level.INFO, String.format(
            "(Project:%s)Webhook received, but matches skipping build expression, will not trigger a build.",
            project.getName()));
        return;
    }

    List<Action> actions = new ArrayList<Action>();
    actions.add(new ParametersAction(values));

    Hudson.getInstance().getQueue().schedule((Queue.Task)project, 0, actions);
    response.getWriter().print("ok, scheduled.");

}
 
开发者ID:myzhan,项目名称:gitlab-build-plugin,代码行数:63,代码来源:GitlabWebhookAction.java

示例13: trigger

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
@Override
protected void trigger(StaplerResponse response, PushNotification pushNotification) throws IOException {
    super.trigger(response, pushNotification);
    response.sendRedirect("../");
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:6,代码来源:DockerHubWebHook.java

示例14: doShowAll

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doShowAll( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  onlyShowFlakyTests = !onlyShowFlakyTests;
  rsp.sendRedirect("..");
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:5,代码来源:HistoryAggregatedFlakyTestResultAction.java

示例15: doSubmit

import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
public void doSubmit(StaplerRequest req, StaplerResponse rsp) throws Exception, ServletException {

		getACL().checkPermission(PerforceScm.TAG);

		String description = req.getParameter("desc");
		String name = req.getParameter("name");

		TaskListener listener = new LogTaskListener(logger, Level.INFO);

		labelBuild(listener, name, description, null);

		rsp.sendRedirect(".");
	}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:14,代码来源:TagAction.java


注:本文中的org.kohsuke.stapler.StaplerResponse.sendRedirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。