public static HttpResponseException success ( final String destination ) { return new HttpResponseException ( ) { public void generateResponse ( StaplerRequest req , StaplerResponse rsp , Object node ) throws IOException , ServletException { if ( isApply ( req ) ) { // if the submission is via 'apply', show a response in the notification bar applyResponse ( "notificationBar.show('" + Messages . HttpResponses_Saved ( ) + "',notificationBar.OK)" ) . generateResponse ( req , rsp , node ) ; } else { rsp . sendRedirect ( destination ) ; } } } ; }
Generates the response for the form submission in such a way that it handles the apply button correctly .