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

项目: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());
}
项目:DotCi    文件:BranchHistoryWidget.java   
@Override
public void doAjax(final StaplerRequest req, final StaplerResponse rsp, @Header("n") final String n) throws IOException, ServletException {

    if (n == null) {
        throw HttpResponses.error(SC_BAD_REQUEST, new IllegalArgumentException("Missing the 'n' HTTP header"));
    }

    rsp.setContentType("text/html;charset=UTF-8");

    final List<T> items = new LinkedList<>();

    String nn = null;

    // TODO refactor getBuildsAfter and database query to be getBuildsAfterAndEqual
    final Iterable<T> builds = this.model.getBuildsAfter(Integer.parseInt(n) - 1);
    for (final T t : builds) {
        if (this.adapter.compare(t, n) >= 0) {
            items.add(t);
            if (this.adapter.isBuilding(t)) {
                nn = this.adapter.getKey(t);
            }
        } else {
            break;
        }
    }

    if (nn == null) {
        if (items.isEmpty()) {
            nn = n;
        } else {
            nn = this.adapter.getNextKey(this.adapter.getKey(items.get(0)));
        }
    }

    this.baseList = items;
    GReflectionUtils.setField(HistoryWidget.class, "firstTransientBuildKey", this, nn);

    rsp.setHeader("n", nn);

    req.getView(this, "ajaxBuildHistory.jelly").forward(req, rsp);
}