55import jenkins .model .Jenkins ;
66import org .kohsuke .accmod .Restricted ;
77import org .kohsuke .accmod .restrictions .NoExternalUse ;
8- import org .kohsuke .stapler .HttpResponse ;
9- import org .kohsuke .stapler .HttpResponses ;
10- import org .kohsuke .stapler .QueryParameter ;
8+ import org .kohsuke .stapler .StaplerRequest ;
9+ import org .kohsuke .stapler .StaplerResponse ;
1110import org .kohsuke .stapler .interceptor .RequirePOST ;
1211
12+ import javax .servlet .ServletException ;
13+ import java .io .IOException ;
14+
1315/**
1416 * Displays the reminder that the configuration must be done.
1517 */
@@ -33,15 +35,15 @@ public String getDisplayName() {
3335
3436 @ Restricted (NoExternalUse .class )
3537 @ RequirePOST
36- public HttpResponse doAct (@ QueryParameter ( fixEmpty = true ) String yes , @ QueryParameter ( fixEmpty = true ) String no ) {
38+ public void doAct (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException {
3739 AdvisorGlobalConfiguration config = AdvisorGlobalConfiguration .getInstance ();
38- if (yes != null ) {
39- return HttpResponses . redirectViaContextPath ( config .getUrlName ());
40- } else if (no != null ) {
40+ if (req . hasParameter ( " yes" ) ) {
41+ rsp . sendRedirect ( req . getContextPath () + "/manage/" + config .getUrlName ());
42+ } else if (req . hasParameter ( "no" ) ) {
4143 // should never return null if we get here
42- return HttpResponses . redirectViaContextPath ( Jenkins .get ().getPluginManager ().getSearchUrl () + "/installed" );
43- } else { //remind later
44- return HttpResponses .forwardToPreviousPage ();
44+ rsp . sendRedirect ( req . getContextPath () + "/" + Jenkins .get ().getPluginManager ().getSearchUrl () + "/installed" );
45+ } else {
46+ rsp .forwardToPreviousPage (req );
4547 }
4648 }
4749}
0 commit comments