本文整理汇总了Java中javax.ws.rs.core.MultivaluedMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMap.remove方法的具体用法?Java MultivaluedMap.remove怎么用?Java MultivaluedMap.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ws.rs.core.MultivaluedMap
的用法示例。
在下文中一共展示了MultivaluedMap.remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIsRequestValidParamMissing
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Test
public void testIsRequestValidParamMissing() {
MultivaluedMap<String,String> params1 = getValidRequestMap();
params1.remove("ckey");
assertFalse(service.isRequestValid(params1));
MultivaluedMap<String,String> params2 = getValidRequestMap();
params2.remove("lang");
assertFalse(service.isRequestValid(params2));
MultivaluedMap<String,String> params3 = getValidRequestMap();
params3.remove("declRef");
assertFalse(service.isRequestValid(params3));
MultivaluedMap<String,String> params4 = getValidRequestMap();
params4.remove("declRef");
assertFalse(service.isRequestValid(params4));
}
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:19,代码来源:RequestVerificationServiceTest.java
示例2: addResponseHeaders
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
/**
* 全てのレスポンスに共通するレスポンスヘッダーを追加する.
* Access-Control-Allow-Origin, Access-Control-Allow-Headers<br/>
* X-Personium-Version<br/>
* @param request
* @param response
*/
private void addResponseHeaders(final ContainerRequest request, final ContainerResponse response) {
MultivaluedMap<String, Object> mm = response.getHttpHeaders();
String acrh = request.getHeaderValue(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
if (acrh != null) {
mm.putSingle(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, acrh);
} else {
mm.remove(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS);
}
mm.putSingle(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, HttpHeaders.Value.ASTERISK);
// X-Personium-Version
mm.putSingle(HttpHeaders.X_PERSONIUM_VERSION, PersoniumUnitConfig.getCoreVersion());
}
示例3: 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;
}
示例4: filter
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public void filter(
ContainerRequestContext containerRequestContext,
ContainerResponseContext containerResponseContext)
throws IOException {
Object entity = containerResponseContext.getEntity();
if (entity instanceof Try.Failure) {
Try.Failure failure = (Try.Failure)entity;
Exception exception = failure.getException();
Optional<APIError> optional = _exceptionConverterManager.convert(
exception);
APIError apiError = optional.orElseThrow(
() -> new MustHaveExceptionConverter(exception.getClass()));
if (_apioLogger != null) {
_apioLogger.error(apiError);
}
ErrorMessageMapper errorMessageMapper =
_errorMessageMapperManager.getErrorMessageMapper(
apiError, _httpHeaders);
String result = ErrorWriter.writeError(
errorMessageMapper, apiError, _httpHeaders);
MultivaluedMap<String, Object> headers =
containerResponseContext.getHeaders();
headers.remove("Content-Type");
headers.add("Content-Type", errorMessageMapper.getMediaType());
containerResponseContext.setEntity(result);
containerResponseContext.setStatus(apiError.getStatusCode());
}
}
示例5: popQueryParamValue
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
public static String popQueryParamValue(String parameter, MultivaluedMap<String, String> queryParameters) {
List<String> values = queryParameters.remove(parameter);
if (values != null && values.iterator().hasNext()) {
return values.iterator().next();
}
return null;
}