本文整理汇总了Java中javax.ws.rs.core.MultivaluedMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMap.size方法的具体用法?Java MultivaluedMap.size怎么用?Java MultivaluedMap.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ws.rs.core.MultivaluedMap
的用法示例。
在下文中一共展示了MultivaluedMap.size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleIvrEvent
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@POST
public Response handleIvrEvent(
@Context UriInfo uriInfo,
JsonNode payload) {
StringBuilder builder = new StringBuilder();
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
if (params != null && params.size() > 0) {
params.keySet().forEach(key -> {
List<String> list = params.get(key);
list.forEach(value -> {
builder.append("&").append(key).append("=").append(value);
});
});
}
LOGGER.debug("/event_ivr{}", builder.toString());
LOGGER.debug("payload: {}", payload);
Response response = null;
try {
String answerNcco = strategy.continueAnswerInboundCall(payload, params);
LOGGER.debug("/event_ivr ncco: {}", answerNcco);
response = Response.ok(answerNcco, MediaType.APPLICATION_JSON).build();
} catch (Exception ex) {
LOGGER.error("failed to handle event_ivr {}", ex.getMessage());
response = Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(ex.getMessage()).build();
}
LOGGER.debug("/event_ivr response: {}", response.toString());
return response;
}
示例2: 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;
}
示例3: toResponse
import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public Response toResponse(WebApplicationException exception) {
LOGGER.error("WebApplicationException:", exception);
LOGGER.debug("Constructing Error Response for: [{}]", exception.toString());
ErrorResponse errorResponse = new ErrorResponse();
Response exceptionResponse = exception.getResponse();
Response.StatusType statusInfo = exceptionResponse.getStatusInfo();
errorResponse.setCode(statusInfo.getStatusCode());
errorResponse.setStatus(statusInfo.getReasonPhrase());
errorResponse.setMessage(exception.getMessage());
Response.ResponseBuilder responseBuilder = Response.status(statusInfo)
.entity(errorResponse)
.type(MediaType.APPLICATION_JSON);
MultivaluedMap<String, Object> headers = exceptionResponse.getHeaders();
if (headers.size() > 0) {
LOGGER.debug("Adding headers:");
for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
String headerKey = entry.getKey();
List<Object> headerValues = entry.getValue();
LOGGER.debug(" {} -> {}", headerKey, headerValues);
if (headerValues.size() == 1) {
responseBuilder.header(headerKey, headerValues.get(0));
} else {
responseBuilder.header(headerKey, headerValues);
}
}
}
return responseBuilder.build();
}
开发者ID:durimkryeziu,项目名称:jersey-2.x-webapp-for-servlet-container,代码行数:36,代码来源:WebApplicationExceptionMapper.java