Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions core/src/main/java/hudson/PluginWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.interceptor.RequirePOST;
Expand Down Expand Up @@ -1237,16 +1235,6 @@ public PluginWrapper getPlugin(String shortName) {
return plugins.get(shortName);
}

/**
* Depending on whether the user said "dismiss" or "correct", send him to the right place.
*/
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
if (req.hasParameter("correct")) {
rsp.sendRedirect(req.getContextPath() + "/pluginManager");

}
}

public static PluginWrapperAdministrativeMonitor get() {
return AdministrativeMonitor.all().get(PluginWrapperAdministrativeMonitor.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
import hudson.ExtensionPoint;
import hudson.model.AbstractModelObject;
import hudson.model.AdministrativeMonitor;
import java.io.IOException;
import java.util.List;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
Expand Down Expand Up @@ -63,17 +61,9 @@ public String getDisplayName() {
return Messages.HudsonHomeDiskUsageMonitor_DisplayName();
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@RequirePOST
public HttpResponse doAct(@QueryParameter String no) throws IOException {
if (no != null) {
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
} else {
return HttpResponses.redirectToDot();
}
public HttpResponse doTellMeMore() {
return HttpResponses.redirectToDot();
}

public List<Solution> getSolutions() {
Expand Down
13 changes: 0 additions & 13 deletions core/src/main/java/hudson/diagnosis/OldDataMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,6 @@ public Iterator<VersionNumber> getVersionList() {
return set.iterator();
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@RequirePOST
public HttpResponse doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
if (req.hasParameter("no")) {
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
} else {
return new HttpRedirect("manage");
}
}

/**
* Save all or some of the files to persist data in the new forms.
* Remove those items from the data map.
Expand Down
19 changes: 0 additions & 19 deletions core/src/main/java/hudson/diagnosis/ReverseProxySetupMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import hudson.Util;
import hudson.model.AdministrativeMonitor;
import hudson.security.Permission;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
Expand All @@ -42,7 +41,6 @@
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
* Looks out for a broken reverse proxy setup that doesn't rewrite the location header correctly.
Expand Down Expand Up @@ -114,23 +112,6 @@ public Permission getRequiredPermission() {
return Jenkins.SYSTEM_READ;
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@Restricted(DoNotUse.class) // WebOnly
@RestrictedSince("2.235")
@RequirePOST
public HttpResponse doAct(@QueryParameter String no) throws IOException {
if (no != null) { // dismiss
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
disable(true);
// of course the irony is that this redirect won't work
return HttpResponses.redirectViaContextPath("/manage");
} else {
return new HttpRedirect("https://www.jenkins.io/redirect/troubleshooting/broken-reverse-proxy");
}
}

@Override
public String getDisplayName() {
return Messages.ReverseProxySetupMonitor_DisplayName();
Expand Down
18 changes: 0 additions & 18 deletions core/src/main/java/hudson/diagnosis/TooManyJobsButNoView.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import hudson.security.Permission;
import java.io.IOException;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
* If Hudson is run with a lot of jobs but no views, suggest the user that they can create views.
Expand Down Expand Up @@ -60,20 +56,6 @@ public boolean isActivated() {
return j.getViews().size() == 1 && j.getItems().size() > THRESHOLD;
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
if (req.hasParameter("no")) {
disable(true);
rsp.sendRedirect(req.getContextPath() + "/manage");
} else {
rsp.sendRedirect(req.getContextPath() + "/newView");
}
}

@Override
public Permission getRequiredPermission() {
return Jenkins.SYSTEM_READ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
import hudson.Extension;
import hudson.Main;
import hudson.model.AdministrativeMonitor;
import java.io.IOException;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.RequirePOST;

@Extension
@Symbol({"executorsOnBuiltInNodeWithAgents", "controllerExecutorsWithAgents"})
Expand All @@ -56,15 +52,4 @@ public boolean isActivated() {
return !Main.isDevelopmentMode && Jenkins.get().getNumExecutors() > 0 &&
(!Jenkins.get().clouds.isEmpty() || !Jenkins.get().getNodes().isEmpty());
}

@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
if (req.hasParameter("no")) {
disable(true);
rsp.sendRedirect(req.getContextPath() + "/manage");
} else if (req.hasParameter("yes")) {
rsp.sendRedirect(req.getContextPath() + "/computer/(built-in)/configure");
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
import hudson.Extension;
import hudson.Main;
import hudson.model.AdministrativeMonitor;
import java.io.IOException;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.RequirePOST;

@Extension
@Symbol({"executorsOnBuiltInNodeWithoutAgents", "controllerExecutorsWithoutAgents"})
Expand All @@ -51,18 +47,6 @@ public boolean isSecurity() {
return true;
}

@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
if (req.hasParameter("no")) {
disable(true);
rsp.sendRedirect(req.getContextPath() + "/manage");
} else if (req.hasParameter("cloud")) {
rsp.sendRedirect(req.getContextPath() + "/manage/cloud/");
} else if (req.hasParameter("agent")) {
rsp.sendRedirect(req.getContextPath() + "/computer/new");
}
}

@Override
public boolean isActivated() {
return !Main.isDevelopmentMode && Jenkins.get().getNumExecutors() > 0 &&
Expand Down
17 changes: 0 additions & 17 deletions core/src/main/java/jenkins/diagnostics/SecurityIsOffMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import java.io.IOException;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
* Unsecured Jenkins is, well, insecure.
Expand Down Expand Up @@ -35,17 +31,4 @@ public boolean isActivated() {
public boolean isSecurity() {
return true;
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
if (req.hasParameter("no")) {
disable(true);
rsp.sendRedirect(req.getContextPath() + "/manage");
} else {
rsp.sendRedirect(req.getContextPath() + "/configureSecurity");
}
}
}
16 changes: 5 additions & 11 deletions core/src/main/java/jenkins/model/BuiltInNodeMigration.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@

import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import jakarta.servlet.ServletException;
import hudson.util.HttpResponses;
import java.io.IOException;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
Expand All @@ -51,13 +49,9 @@
}

@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp, @QueryParameter String yes, @QueryParameter String no) throws IOException, ServletException {
if (yes != null) {
Jenkins.get().performRenameMigration();
} else if (no != null) {
disable(true);
}
rsp.forwardToPreviousPage(req);
public HttpResponse doMigrate() throws IOException {
Jenkins.get().performRenameMigration();
return HttpResponses.forwardToPreviousPage();

Check warning on line 54 in core/src/main/java/jenkins/model/BuiltInNodeMigration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 54 is not covered by tests
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/jenkins/model/Jenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,9 @@
}

@RequirePOST
public void doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
public HttpResponse doReset() throws IOException {
j.forceSetSlaveAgentPort(getExpectedPort());
rsp.sendRedirect2(req.getContextPath() + "/manage");
return HttpResponses.redirectViaContextPath("/manage");

Check warning on line 1306 in core/src/main/java/jenkins/model/Jenkins.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 1306 is not covered by tests
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import hudson.security.Permission;
import java.io.IOException;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
Expand All @@ -43,11 +42,6 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.interceptor.RequirePOST;

@Extension
@Restricted(NoExternalUse.class)
Expand Down Expand Up @@ -127,21 +121,6 @@ public Permission getRequiredPermission() {
return Jenkins.SYSTEM_READ;
}

/**
* Depending on whether the user said "yes" or "no", send him to the right place.
*/
@Restricted(DoNotUse.class) // WebOnly
@RequirePOST
public HttpResponse doAct(@QueryParameter String no) throws IOException {
if (no != null) { // dismiss
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
disable(true);
return HttpResponses.forwardToPreviousPage();
} else {
return new HttpRedirect("https://jenkins.io/redirect/java-support/");
}
}

@NonNull
private static LocalDate getEndOfLife() {
LocalDate endOfLife = SUPPORTED_JAVA_VERSIONS.get(Runtime.version().feature());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.interceptor.RequirePOST;

@Extension
Expand Down Expand Up @@ -254,16 +252,8 @@ private String buildDocumentationUrl(String operatingSystemName) {
*/
@Restricted(DoNotUse.class) // WebOnly
@RequirePOST
public HttpResponse doAct(@QueryParameter String no) throws IOException {
if (no != null) { // dismiss
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
disable(true);
LOGGER.log(Level.FINE, "Disabled operating system end of life monitor");
return HttpResponses.forwardToPreviousPage();
} else {
LOGGER.log(Level.FINE, "Enabled operating system end of life monitor");
return new HttpRedirect(documentationUrl);
}
public HttpResponse doMoreInfo() {
return new HttpRedirect(documentationUrl);
}

@Override
Expand Down
Loading
Loading