• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CookieImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.undertow.server.handlers.CookieImpl的典型用法代码示例。如果您正苦于以下问题:Java CookieImpl类的具体用法?Java CookieImpl怎么用?Java CookieImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CookieImpl类属于io.undertow.server.handlers包,在下文中一共展示了CookieImpl类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleValue

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
private static void handleValue(CookieImpl cookie, String key, String value) {
    if (key.equalsIgnoreCase("path")) {
        cookie.setPath(value);
    } else if (key.equalsIgnoreCase("domain")) {
        cookie.setDomain(value);
    } else if (key.equalsIgnoreCase("max-age")) {
        cookie.setMaxAge(Integer.parseInt(value));
    } else if (key.equalsIgnoreCase("expires")) {
        cookie.setExpires(DateUtils.parseDate(value));
    } else if (key.equalsIgnoreCase("discard")) {
        cookie.setDiscard(true);
    } else if (key.equalsIgnoreCase("secure")) {
        cookie.setSecure(true);
    } else if (key.equalsIgnoreCase("httpOnly")) {
        cookie.setHttpOnly(true);
    } else if (key.equalsIgnoreCase("version")) {
        cookie.setVersion(Integer.parseInt(value));
    } else if (key.equalsIgnoreCase("comment")) {
        cookie.setComment(value);
    }
    //otherwise ignore this key-value pair
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:Cookies.java


示例2: signIn

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
public void signIn(HttpServerExchange exchange) {
    String id = exchange.getRelativePath().substring(1);
    boolean redirect = exchange.getQueryParameters().get("redirect") != null;

    AuthService service = services.get(id);
    if (service != null) {
        String state = service.generateState();
        if (redirect) {
            exchange.setResponseCookie(new CookieImpl("pxls-auth-redirect", "1").setPath("/"));
            redirect(exchange, service.getRedirectUrl(state+"|redirect"));
        } else {
            respond(exchange, StatusCodes.OK, new SignInResponse(service.getRedirectUrl(state+"|json")));
        }
    } else {
        respond(exchange, StatusCodes.BAD_REQUEST, new Error("bad_service", "No auth method named " + id));
    }
}
 
开发者ID:xSke,项目名称:Pxls,代码行数:18,代码来源:WebHandler.java


示例3: build

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
public Cookie build() {
    Cookie cookie = new CookieImpl(this.cookieName)
            .setValue(this.cookieValue)
            .setDiscard(this.cookieDiscard)
            .setSecure(this.cookieSecure)
            .setHttpOnly(this.cookieHttpOnly)
            .setPath(this.cookiePath)
            .setExpires((this.cookieExpires == null) ?
                    Date.from(LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault()).toInstant()) :
                    Date.from(this.cookieExpires.atZone(ZoneId.systemDefault()).toInstant()));

    if (this.cookieDomain != null) {
        cookie.setDomain(this.cookieDomain);
    }

    if (this.cookieMaxAge != null) {
        cookie.setMaxAge(this.cookieMaxAge);
    }

    return cookie;
}
 
开发者ID:svenkubiak,项目名称:mangooio,代码行数:22,代码来源:CookieBuilder.java


示例4: wrap

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
@Override
public StreamSinkConduit wrap(ConduitFactory<StreamSinkConduit> factory, HttpServerExchange exchange) {
    SecurityContext sc = exchange.getSecurityContext();
    Account account = sc.getAuthenticatedAccount();
    if (account != null) {
        try (SingleSignOn sso = manager.createSingleSignOn(account, sc.getMechanismName())) {
            Session session = getSession(exchange);
            registerSessionIfRequired(sso, session);
            exchange.getResponseCookies().put(cookieName, new CookieImpl(cookieName, sso.getId()).setHttpOnly(httpOnly).setSecure(secure).setDomain(domain).setPath(path));
        }
    }
    return factory.create();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SingleSignOnAuthenticationMechanism.java


示例5: setSessionId

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
@Override
public void setSessionId(final HttpServerExchange exchange, final String sessionId) {
    Cookie cookie = new CookieImpl(cookieName, sessionId)
            .setPath(path)
            .setDomain(domain)
            .setDiscard(discard)
            .setSecure(secure)
            .setHttpOnly(httpOnly)
            .setComment(comment);
    if (maxAge > 0) {
        cookie.setMaxAge(maxAge);
    }
    exchange.setResponseCookie(cookie);
    exchange.getRequestCookies().put(cookieName, cookie);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:SessionCookieConfig.java


示例6: clearSession

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
@Override
public void clearSession(final HttpServerExchange exchange, final String sessionId) {
    Cookie cookie = new CookieImpl(cookieName, sessionId)
            .setPath(path)
            .setDomain(domain)
            .setDiscard(discard)
            .setSecure(secure)
            .setHttpOnly(httpOnly)
            .setMaxAge(0);
    exchange.setResponseCookie(cookie);
    exchange.getRequestCookies().remove(cookieName);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:SessionCookieConfig.java


示例7: setAuthCookie

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
private void setAuthCookie(HttpServerExchange exchange, String loginToken, int days) {
    Calendar cal2 = Calendar.getInstance();
    cal2.add(Calendar.DATE, -1);
    exchange.setResponseCookie(new CookieImpl("pxls-token", loginToken).setPath("/").setExpires(cal2.getTime()));
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, days);
    String hostname = App.getConfig().getString("host");
    exchange.setResponseCookie(new CookieImpl("pxls-token", loginToken).setHttpOnly(true).setPath("/").setDomain("." + hostname).setExpires(cal.getTime()));
    exchange.setResponseCookie(new CookieImpl("pxls-token", loginToken).setHttpOnly(true).setPath("/").setDomain(hostname).setExpires(cal.getTime()));
}
 
开发者ID:xSke,项目名称:Pxls,代码行数:11,代码来源:WebHandler.java


示例8: setResponseCookie

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
@Override
public void setResponseCookie(HttpServerCookie cookie) {
    CookieImpl actualCookie = new CookieImpl(cookie.getName(), cookie.getValue());

    actualCookie.setDomain(cookie.getDomain());
    actualCookie.setMaxAge(cookie.getMaxAge());
    actualCookie.setHttpOnly(cookie.isHttpOnly());
    actualCookie.setSecure(cookie.isSecure());
    actualCookie.setPath(cookie.getPath());

    httpServerExchange.setResponseCookie(actualCookie);
}
 
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:13,代码来源:ElytronHttpExchange.java


示例9: clearSsoCookie

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
private void clearSsoCookie(HttpServerExchange exchange) {
    exchange.getResponseCookies().put(cookieName, new CookieImpl(cookieName).setMaxAge(0).setHttpOnly(httpOnly).setSecure(secure).setDomain(domain));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:SingleSignOnAuthenticationMechanism.java


示例10: writeAttribute

import io.undertow.server.handlers.CookieImpl; //导入依赖的package包/类
@Override
public void writeAttribute(final HttpServerExchange exchange, final String newValue) throws ReadOnlyAttributeException {
    exchange.setResponseCookie(new CookieImpl(cookieName, newValue));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:CookieAttribute.java



注:本文中的io.undertow.server.handlers.CookieImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleRootEditPart类代码示例发布时间:2022-05-23
下一篇:
Java CanonicalizationException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap