本文整理汇总了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);
}
示例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("../");
}
示例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(".");
}
示例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(".");
}
示例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("../");
}
}
示例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(".");
}
示例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(".");
}
示例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);
}
}
示例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("../");
}
}
示例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(".");
}
示例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;
}
示例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.");
}
示例13: trigger
import org.kohsuke.stapler.StaplerResponse; //导入方法依赖的package包/类
@Override
protected void trigger(StaplerResponse response, PushNotification pushNotification) throws IOException {
super.trigger(response, pushNotification);
response.sendRedirect("../");
}
示例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(".");
}