本文整理汇总了Java中org.fourthline.cling.model.message.header.UpnpHeader.Type方法的典型用法代码示例。如果您正苦于以下问题:Java UpnpHeader.Type方法的具体用法?Java UpnpHeader.Type怎么用?Java UpnpHeader.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fourthline.cling.model.message.header.UpnpHeader
的用法示例。
在下文中一共展示了UpnpHeader.Type方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseHeaders
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
protected void parseHeaders() {
// This runs as late as possible and only when necessary (getter called and map is dirty)
parsedHeaders = new LinkedHashMap();
if (log.isLoggable(Level.FINE))
log.fine("Parsing all HTTP headers for known UPnP headers: " + size());
for (Entry<String, List<String>> entry : entrySet()) {
if (entry.getKey() == null) continue; // Oh yes, the JDK has 'null' HTTP headers
UpnpHeader.Type type = UpnpHeader.Type.getByHttpName(entry.getKey());
if (type == null) {
if (log.isLoggable(Level.FINE))
log.fine("Ignoring non-UPNP HTTP header: " + entry.getKey());
continue;
}
for (String value : entry.getValue()) {
UpnpHeader upnpHeader = UpnpHeader.newInstance(type, value);
if (upnpHeader == null || upnpHeader.getValue() == null) {
if (log.isLoggable(Level.FINE))
log.fine(
"Ignoring known but irrelevant header (value violates the UDA specification?) '"
+ type.getHttpName()
+ "': "
+ value
);
} else {
addParsedValue(type, upnpHeader);
}
}
}
}
示例2: addParsedValue
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
protected void addParsedValue(UpnpHeader.Type type, UpnpHeader value) {
if (log.isLoggable(Level.FINE))
log.fine("Adding parsed header: " + value);
List<UpnpHeader> list = parsedHeaders.get(type);
if (list == null) {
list = new LinkedList();
parsedHeaders.put(type, list);
}
list.add(value);
}
示例3: getFirstHeader
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public <H extends UpnpHeader> H getFirstHeader(UpnpHeader.Type type, Class<H> subtype) {
UpnpHeader[] headers = getAsArray(type);
if (headers.length == 0) return null;
for (UpnpHeader header : headers) {
if (subtype.isAssignableFrom(header.getClass())) {
return (H) header;
}
}
return null;
}
示例4: getFirstHeader
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
protected <H extends UpnpHeader> H getFirstHeader(UpnpHeader.Type headerType, Class<H> subtype) {
return getInputMessage().getHeaders().getFirstHeader(headerType, subtype);
}
示例5: containsKey
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public boolean containsKey(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.containsKey(type);
}
示例6: get
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public List<UpnpHeader> get(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.get(type);
}
示例7: add
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public void add(UpnpHeader.Type type, UpnpHeader value) {
super.add(type.getHttpName(), value.getString());
if (parsedHeaders != null)
addParsedValue(type, value);
}
示例8: remove
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public void remove(UpnpHeader.Type type) {
super.remove(type.getHttpName());
if (parsedHeaders != null)
parsedHeaders.remove(type);
}
示例9: getAsArray
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public UpnpHeader[] getAsArray(UpnpHeader.Type type) {
if (parsedHeaders == null) parseHeaders();
return parsedHeaders.get(type) != null
? parsedHeaders.get(type).toArray(new UpnpHeader[parsedHeaders.get(type).size()])
: new UpnpHeader[0];
}
示例10: getFirstHeaderString
import org.fourthline.cling.model.message.header.UpnpHeader; //导入方法依赖的package包/类
public String getFirstHeaderString(UpnpHeader.Type type) {
UpnpHeader header = getFirstHeader(type);
return header != null ? header.getString() : null;
}