本文整理汇总了Java中javax.ws.rs.core.MultivaluedMap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMap.keySet方法的具体用法?Java MultivaluedMap.keySet怎么用?Java MultivaluedMap.keySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ws.rs.core.MultivaluedMap
的用法示例。
在下文中一共展示了MultivaluedMap.keySet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPodsByLabels
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public PodList getPodsByLabels(String targetCluster, String namespace, MultivaluedMap<String, String> selector) {
String path = "/api/v1/namespaces/" + namespace + "/pods?labelSelector=";
for(String label : selector.keySet()){ // NOSONAR need to iterate through keySet
path += label + "=" +selector.get(label).get(0) + ",";
}
path = path.substring(0, path.length() - 1);
return kubernetesService.apiGetRequest(targetCluster, path, new PodList());
}
示例2: filter
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public void filter(ClientRequestContext clientRequestContext) throws IOException {
String method = clientRequestContext.getMethod();
URI uri = clientRequestContext.getUri();
MultivaluedMap<String, Object> headers = clientRequestContext.getHeaders();
System.out.printf("Sending %s to: %s\n", method, uri);
System.out.printf("Headers:\n");
for(String key : headers.keySet()) {
System.out.printf(" %s: %s\n", key, headers.getFirst(key));
}
if(clientRequestContext.hasEntity()) {
final OutputStream stream = new LoggingStream(clientRequestContext.getEntityStream());
clientRequestContext.setEntityStream(stream);
clientRequestContext.setProperty("client.LoggingStream", stream);
}
}
示例3: getHeaderValues
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
/**
* Get the values of a response header.
* It returns null if no header is found with the provided name.
*
* @param name the header name.
* It is case-insensitive according to HTTP/1.1 specification (rfc2616#sec4.2)
* @return the header values
*/
@PublicAtsApi
public String[] getHeaderValues( String name ) {
MultivaluedMap<String, Object> respHeaders = response.getHeaders();
for (String hName : respHeaders.keySet()) {
if (hName.equalsIgnoreCase(name)) {
List<String> values = new ArrayList<String>();
for (Object valueObject : respHeaders.get(name)) {
values.add(valueObject.toString());
}
return values.toArray(new String[values.size()]);
}
}
return null;
}
示例4: startServerSpan
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
public static Scope startServerSpan(Tracer tracer, javax.ws.rs.core.HttpHeaders httpHeaders,
String operationName) {
// format the headers for extraction
MultivaluedMap<String, String> rawHeaders = httpHeaders.getRequestHeaders();
final HashMap<String, String> headers = new HashMap<String, String>();
for (String key : rawHeaders.keySet()) {
headers.put(key, rawHeaders.get(key).get(0));
}
Tracer.SpanBuilder spanBuilder;
try {
SpanContext parentSpanCtx = tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapExtractAdapter(headers));
if (parentSpanCtx == null) {
spanBuilder = tracer.buildSpan(operationName);
} else {
spanBuilder = tracer.buildSpan(operationName).asChildOf(parentSpanCtx);
}
} catch (IllegalArgumentException e) {
spanBuilder = tracer.buildSpan(operationName);
}
// TODO could add more tags like http.url
return spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER).startActive(true);
}
示例5: checkRequestHeader
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
/**
* リクエストヘッダーの値をチェックする.
* 現在は、Acceptヘッダーのみ(US-ASCII文字以外かどうか)をチェックする
* @param request フィルター前リクエスト
*/
private void checkRequestHeader(ContainerRequest request) {
// ヘッダーのキー名に全角文字が含まれる場合は、その文字を含めたキー名となるため、実際にはこの指定は無視される。
// Jersey1.10では、Acceptヘッダーのキー名と値にUS-ASCII文字以外が含まれる場合に異常終了するため以下を対処
// (Acceptを含む他のヘッダーにも同様の処理が行われるが、上記理由により動作上は問題ないと判断)
// -キー名に含まれる場合は、その指定を無効(Accept:*/*)とする(Jerseryで組み込み済み)。
// -値に含まれる場合は、400エラーとする。
InBoundHeaders newHeaders = new InBoundHeaders();
MultivaluedMap<String, String> headers = request.getRequestHeaders();
for (String header : headers.keySet()) {
if (header.contains(org.apache.http.HttpHeaders.ACCEPT)
&& !acceptHeaderValueRegex.matcher(header).matches()) {
continue;
} else {
newHeaders.put(header, request.getRequestHeader(header));
}
}
request.setHeaders(newHeaders);
String acceptValue = request.getHeaderValue(org.apache.http.HttpHeaders.ACCEPT);
if (acceptValue != null && !acceptHeaderValueRegex.matcher(acceptValue).matches()) {
PersoniumCoreException exception = PersoniumCoreException.OData.BAD_REQUEST_HEADER_VALUE.params(
org.apache.http.HttpHeaders.ACCEPT, acceptValue);
throw exception;
}
}
示例6: getHeader
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
/**
* Get a response header
*
* @param name the header name
* It is case-insensitive according to HTTP/1.1 specification (rfc2616#sec4.2)
* @return the header
*/
@PublicAtsApi
public RestHeader getHeader( String name ) {
MultivaluedMap<String, Object> respHeaders = response.getHeaders();
for (String hName : respHeaders.keySet()) {
if (hName.equalsIgnoreCase(name)) {
return (RestHeader.constructRESTHeader(name, respHeaders.get(name)));
}
}
return null;
}
示例7: logHeaders
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
private static void logHeaders(StringBuilder sb, int id, char prefix, MultivaluedMap<String, String> headers, HttpRequest actual) {
Set<String> keys = new TreeSet(headers.keySet());
for (String key : keys) {
List<String> entries = headers.get(key);
sb.append(id).append(' ').append(prefix).append(' ')
.append(key).append(": ").append(entries.size() == 1 ? entries.get(0) : entries).append('\n');
if (actual != null) {
actual.putHeader(key, entries);
}
}
}
示例8: getHeaders
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
private Header[] getHeaders(MultivaluedMap<String, String> headers) {
if (headers == null || headers.isEmpty()) {
return new Header[0];
}
int i = 0;
headers.remove(CONTENT_LENGTH);
Header[] headerz = new Header[headers.size()];
for (String key : headers.keySet()) {
headerz[i] = new BasicHeader(key, headers.getFirst(key));
i++;
}
return headerz;
}
示例9: putAll
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
void putAll(@NonNull MultivaluedMap<String, String> sourceParams) {
for (String key : sourceParams.keySet()) {
parameters.put(key, sourceParams.getFirst(key));
}
}