Java 类org.kohsuke.stapler.HttpRedirect 实例源码

项目:grapes-jenkins-plugin    文件:AdministrateResendAction.java   
/**
 *  Performs the notification on 'POST' action named "perform"
 *
 * @param req StaplerRequest
 * @param rsp StaplerResponse
 * @return HttpResponse
 */
public HttpResponse do_perform(final StaplerRequest req, final StaplerResponse rsp)  {
    // Only administrator can create a new site.
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);

    // TODO: display the progression

    for(ResendProjectAction resendProjectAction: resendActions){
        try {
            final NotificationHandler notifHandler = new NotificationHandler(resendProjectAction.getConfig());
            for(Map.Entry<AbstractBuild<?,?>, List<ResendBuildAction>> resendBuildAction: resendProjectAction.getResendActionPerBuild().entrySet()){
                notifHandler.send(resendBuildAction.getKey(), resendBuildAction.getValue());
            }

        } catch (Exception e ){
            GrapesPlugin.getLogger().log(Level.SEVERE, "[GRAPES] Failed to re-send notification: ", e);
        }
    }

    refresh();

    return HttpRedirect.DOT;
}
项目:ec2-plugin    文件:EC2Computer.java   
/**
 * When the slave is deleted, terminate the instance.
 */
@Override
public HttpResponse doDoDelete() throws IOException {
    checkPermission(DELETE);
    if (getNode() != null)
        getNode().terminate();
    return new HttpRedirect("..");
}
项目:multi-branch-project-plugin    文件:TemplateDrivenMultiBranchProject.java   
@SuppressWarnings(UNUSED)
@CLIMethod(name = "disable-job")
@RequirePOST
public HttpResponse doDisable() throws IOException, ServletException { // NOSONAR
    checkPermission(CONFIGURE);
    makeDisabled(true);
    return new HttpRedirect(".");
}
项目:multi-branch-project-plugin    文件:TemplateDrivenMultiBranchProject.java   
@SuppressWarnings(UNUSED)
@CLIMethod(name = "enable-job")
@RequirePOST
public HttpResponse doEnable() throws IOException, ServletException { // NOSONAR
    checkPermission(CONFIGURE);
    makeDisabled(false);
    return new HttpRedirect(".");
}
项目:mesos-plugin    文件:MesosComputer.java   
@Override
public HttpResponse doDoDelete() throws IOException {
  checkPermission(DELETE);
    MesosSlave node = getNode();
    if (node != null) {
        node.terminate();
    }
  return new HttpRedirect("..");
}
项目:jenkins-keycloak-plugin    文件:KeycloakSecurityRealm.java   
public HttpResponse doCommenceLogin(StaplerRequest request, StaplerResponse response,
        @Header("Referer") final String referer) throws IOException {
    request.getSession().setAttribute(REFERER_ATTRIBUTE, referer);

    String redirect = redirectUrl(request);

    String state = UUID.randomUUID().toString();

    String authUrl = getKeycloakDeployment().getAuthUrl().clone()
            .queryParam(OAuth2Constants.CLIENT_ID, getKeycloakDeployment().getResourceName())
            .queryParam(OAuth2Constants.REDIRECT_URI, redirect).queryParam(OAuth2Constants.STATE, state)
            .queryParam(OAuth2Constants.RESPONSE_TYPE, OAuth2Constants.CODE).build().toString();

    return new HttpRedirect(authUrl);

}
项目:deepin-oauth-plugin    文件:DeepinSecurityRealm.java   
public HttpResponse doCommenceLogin(StaplerRequest request, @Header("Referer") final String referer) throws IOException {
    request.getSession().setAttribute(REFERER_ATTRIBUTE, referer);
    DeepinOAuthApiService DeepinOAuthApiService = new DeepinOAuthApiService(clientID, clientSecret);
    return new HttpRedirect(DeepinOAuthApiService.createOAutuorizeURL());
}