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


Java AttachmentKey类代码示例

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


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

示例1: addToAttachmentList

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) {

    if (key == null) {
        throw UndertowMessages.MESSAGES.argumentCannotBeNull("key");
    }
    final Map<AttachmentKey<?>, Object> attachments = this.attachments;
    synchronized (attachments) {
        final List<T> list = key.cast(attachments.get(key));
        if (list == null) {
            final AttachmentList<T> newList = new AttachmentList<T>((Class<T>) Object.class);
            attachments.put(key, newList);
            newList.add(value);
        } else {
            list.add(value);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:SpdyChannel.java

示例2: testNotOverride

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Test
public void testNotOverride() throws Exception {
	HttpServerExchange exchange = new MockUp<HttpServerExchange>() {
		@Mock
		public HeaderMap getRequestHeaders() {
			throw new AssertionError();
		}

		@Mock
		public <T> T getAttachment(final AttachmentKey<T> key) {
			throw new AssertionError();
		}
	}.getMockInstance();

	exchange.setRequestMethod(Methods.GET);

	this.target.handleRequest(exchange);
}
 
开发者ID:taichi,项目名称:siden,代码行数:19,代码来源:MethodOverrideHandlerTest.java

示例3: getAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T getAttachment(AttachmentKey<T> key) {
    if (key == null) {
        throw UndertowMessages.MESSAGES.argumentCannotBeNull("key");
    }
    return (T) attachments.get(key);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SpdyChannel.java

示例4: getAttachmentList

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key) {
    if (key == null) {
        throw UndertowMessages.MESSAGES.argumentCannotBeNull("key");
    }
    Object o = attachments.get(key);
    if(o == null) {
        return Collections.emptyList();
    }
    return (List)o;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:SpdyChannel.java

示例5: putAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T putAttachment(AttachmentKey<T> key, T value) {
    if (key == null) {
        throw UndertowMessages.MESSAGES.argumentCannotBeNull("key");
    }
    return key.cast(attachments.put(key, key.cast(value)));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SpdyChannel.java

示例6: ChunkReader

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
public ChunkReader(final Attachable attachable, final AttachmentKey<HeaderMap> trailerAttachmentKey, ConduitListener<? super T> finishListener, T conduit) {
    this.attachable = attachable;
    this.trailerAttachmentKey = trailerAttachmentKey;
    this.finishListener = finishListener;
    this.conduit = conduit;
    this.state = FLAG_READING_LENGTH;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ChunkReader.java

示例7: putAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> void putAttachment(final AttachmentKey<T> key, final T value) {
    exchange.putAttachment(key, value);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ServletWebSocketHttpExchange.java

示例8: getAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T getAttachment(final AttachmentKey<T> key) {
    return exchange.getAttachment(key);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ServletWebSocketHttpExchange.java

示例9: removeAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T removeAttachment(AttachmentKey<T> key) {
    return key.cast(attachments.remove(key));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyChannel.java

示例10: addToAttachmentList

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) {
    channel.addToAttachmentList(key, value);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyServerConnection.java

示例11: removeAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T removeAttachment(AttachmentKey<T> key) {
    return channel.removeAttachment(key);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyServerConnection.java

示例12: putAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T putAttachment(AttachmentKey<T> key, T value) {
    return channel.putAttachment(key, value);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyServerConnection.java

示例13: getAttachmentList

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key) {
    return channel.getAttachmentList(key);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyServerConnection.java

示例14: getAttachment

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
@Override
public <T> T getAttachment(AttachmentKey<T> key) {
    return channel.getAttachment(key);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SpdyServerConnection.java

示例15: AttachmentHandler

import io.undertow.util.AttachmentKey; //导入依赖的package包/类
public AttachmentHandler(final AttachmentKey<T> key, final HttpHandler next, final T instance) {
    this.next = next;
    this.key = key;
    this.instance = instance;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:AttachmentHandler.java


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