当前位置: 首页>>代码示例>>Java>>正文


Java HttpServerExchange.removeAttachment方法代码示例

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


在下文中一共展示了HttpServerExchange.removeAttachment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSession

import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
public HttpSessionImpl getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) {
    SessionConfig c = originalServletContext.getSessionConfig();
    HttpSessionImpl httpSession = exchange.getAttachment(sessionAttachmentKey);
    if (httpSession != null && httpSession.isInvalid()) {
        exchange.removeAttachment(sessionAttachmentKey);
        httpSession = null;
    }
    if (httpSession == null) {
        final SessionManager sessionManager = deployment.getSessionManager();
        Session session = sessionManager.getSession(exchange, c);
        if (session != null) {
            httpSession = SecurityActions.forSession(session, this, false);
            exchange.putAttachment(sessionAttachmentKey, httpSession);
        } else if (create) {

            String existing = c.findSessionId(exchange);
            if (originalServletContext != this) {
                //this is a cross context request
                //we need to make sure there is a top level session
                originalServletContext.getSession(originalServletContext, exchange, true);
            } else if (existing != null) {
                c.clearSession(exchange, existing);
            }

            final Session newSession = sessionManager.createSession(exchange, c);
            httpSession = SecurityActions.forSession(newSession, this, true);
            exchange.putAttachment(sessionAttachmentKey, httpSession);
        }
    }
    return httpSession;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:ServletContextImpl.java

示例2: sendAuthenticationInfoHeader

import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
public void sendAuthenticationInfoHeader(final HttpServerExchange exchange) {
    DigestContext context = exchange.getAttachment(DigestContext.ATTACHMENT_KEY);
    DigestQop qop = context.getQop();
    String currentNonce = context.getNonce();
    String nextNonce = nonceManager.nextNonce(currentNonce, exchange);
    if (qop != null || !nextNonce.equals(currentNonce)) {
        StringBuilder sb = new StringBuilder();
        sb.append(NEXT_NONCE).append("=\"").append(nextNonce).append("\"");
        if (qop != null) {
            Map<DigestAuthorizationToken, String> parsedHeader = context.getParsedHeader();
            sb.append(",").append(Headers.QOP.toString()).append("=\"").append(qop.getToken()).append("\"");
            byte[] ha1 = context.getHa1();
            byte[] ha2;

            if (qop == DigestQop.AUTH) {
                ha2 = createHA2Auth(context);
            } else {
                ha2 = createHA2AuthInt();
            }
            String rspauth = new String(createRFC2617RequestDigest(ha1, ha2, context), UTF_8);
            sb.append(",").append(Headers.RESPONSE_AUTH.toString()).append("=\"").append(rspauth).append("\"");
            sb.append(",").append(Headers.CNONCE.toString()).append("=\"").append(parsedHeader.get(DigestAuthorizationToken.CNONCE)).append("\"");
            sb.append(",").append(Headers.NONCE_COUNT.toString()).append("=").append(parsedHeader.get(DigestAuthorizationToken.NONCE_COUNT));
        }

        HeaderMap responseHeader = exchange.getResponseHeaders();
        responseHeader.add(AUTHENTICATION_INFO, sb.toString());
    }

    exchange.removeAttachment(DigestContext.ATTACHMENT_KEY);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:DigestAuthenticationMechanism.java

示例3: removeSession

import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
@Override
public Session removeSession(HttpServerExchange serverExchange) {
	if (serverExchange != null) {
		String sessionId = sessionConfig.findSessionId(serverExchange);
		Session oldSession =  serverExchange.removeAttachment(NEW_SESSION);
		removeSession(sessionId);
		return oldSession;
	}

	return null;
}
 
开发者ID:networknt,项目名称:light-session-4j,代码行数:12,代码来源:JdbcSessionManager.java

示例4: removeSession

import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
@Override
public Session removeSession(HttpServerExchange serverExchange) {
    if (serverExchange != null) {
        String sessionId = sessionConfig.findSessionId(serverExchange);
        Session oldSession =  serverExchange.removeAttachment(NEW_SESSION);
        removeSession(sessionId);
        return oldSession;
    }

    return null;
}
 
开发者ID:networknt,项目名称:light-session-4j,代码行数:12,代码来源:HazelcastSessionManager.java

示例5: removeSession

import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
@Override
public Session removeSession(HttpServerExchange serverExchange) {
    if (serverExchange != null) {
        String sessionId = sessionConfig.findSessionId(serverExchange);
        MapSession oldSession =  serverExchange.removeAttachment(NEW_SESSION);
         removeSession(sessionId);
         return oldSession;
    }

    return null;
}
 
开发者ID:networknt,项目名称:light-session-4j,代码行数:12,代码来源:MapSessionManager.java


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