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


Java MultivaluedMap.containsKey方法代码示例

本文整理汇总了Java中javax.ws.rs.core.MultivaluedMap.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMap.containsKey方法的具体用法?Java MultivaluedMap.containsKey怎么用?Java MultivaluedMap.containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.core.MultivaluedMap的用法示例。


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

示例1: filter

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public void filter(ContainerRequestContext reqCtx, ContainerResponseContext respCtx) throws IOException {
    final UriInfo uriInfo = reqCtx.getUriInfo();
    final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
    if (queryParameters.containsKey("pretty")) {
        ObjectWriterInjector.set(new IndentingModifier());
    }
}
 
开发者ID:stevespringett,项目名称:Alpine,代码行数:9,代码来源:PrettyPrintFilter.java

示例2: getQueryParameterValue

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
/**
 * Get a URI query parameter value by name
 * @param queryParameters URI query parameters
 * @param name Parameter name
 * @return Parameter value, or <code>null</code> if not found
 */
public static Optional<String> getQueryParameterValue(MultivaluedMap<String, String> queryParameters, String name) {
	if (name != null) {
		if (queryParameters != null && queryParameters.containsKey(name)) {
			List<String> values = queryParameters.get(name);
			if (values != null && !values.isEmpty()) {
				if (values.size() == 1) {
					return Optional.ofNullable(values.get(0));
				} else {
					StringBuilder sb = new StringBuilder();
					for (String value : values) {
						if (sb.length() > 0) {
							sb.append(',');
						}
						sb.append(value);
					}
					return Optional.of(sb.toString());
				}
			}
		}
	}
	return Optional.empty();
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:29,代码来源:RequestUtils.java

示例3: filter

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public void filter(ContainerRequestContext ctx) throws IOException {

    MultivaluedMap<String, String> headers = ctx.getHeaders();

    if(headers == null) {
        handleError(ctx);
    }

    if(!headers.containsKey("X-Username")) {
        handleError(ctx);
    }

    String username = headers.getFirst("X-Username");

    if(username == null) {
        handleError(ctx);
    }

    // Set the Username in the current Request Scope:
    RequestContextHolder
            .currentRequestAttributes()
            .setAttribute("Username", username, SCOPE_REQUEST);
}
 
开发者ID:bytefish,项目名称:VersioningWithEnvers,代码行数:25,代码来源:UserNameFilter.java

示例4: equalsRequestHeader

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
private boolean equalsRequestHeader(ContainerRequestContext containerRequestContext) {

        MultivaluedMap<String, String> requestHeader = containerRequestContext.getHeaders();
        MultivaluedMap<String, Object> desiredHeader = endpoint.getHeader().getContent();

        if (!StringUtils.isEmpty(desiredHeader)) {

            if (!requestHeader.isEmpty()) {

                for (Map.Entry<String, List<Object>> map : desiredHeader.entrySet()) {
                    if (!requestHeader.containsKey(map.getKey()) || !requestHeader.get(map.getKey()).containsAll(map.getValue()))
                        return false;
                }

            } else
                return false;
        }

        return true;
    }
 
开发者ID:groovylabs,项目名称:lyre,代码行数:21,代码来源:APIxInflector.java

示例5: getArgumentValue

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
private Object getArgumentValue(String parameterName, MultivaluedMap<String, String> queryParameters, Type type) throws Exception {
	if (overrides.containsKey(parameterName)) {
		return overrides.get(parameterName);
	} else if (queryParameters.containsKey(parameterName)) {
		String value = ResourceUtils.popQueryParamValue(parameterName, queryParameters);
		if (type != null) {
			return StringConverter.getConverter(type).convert(value);
		} else {
			if (excludePrimitiveConversion.contains(parameterName)) {
				return value;
			}
			return StringConverter.convert(value, primitiveConversionPrecedence);
		}
	} else if (defaults.containsKey(parameterName)) {
		return defaults.get(parameterName);
	} else {
		return null;
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:20,代码来源:ArgsUriPart.java

示例6: build

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@GET
public Response build() {
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    String service = params.getFirst(CASLoginProtocol.SERVICE_PARAM);
    boolean renew = params.containsKey(CASLoginProtocol.RENEW_PARAM);
    boolean gateway = params.containsKey(CASLoginProtocol.GATEWAY_PARAM);

    checkSsl();
    checkRealm();
    checkClient(service);

    AuthorizationEndpointChecks checks = getOrCreateAuthenticationSession(client, null);
    if (checks.response != null) {
        return checks.response;
    }

    authenticationSession = checks.authSession;
    updateAuthenticationSession();

    // So back button doesn't work
    CacheControlUtil.noBackButtonCacheControlHeader();

    if (renew) {
        authenticationSession.setClientNote(CASLoginProtocol.RENEW_PARAM, "true");
    }

    this.event.event(EventType.LOGIN);
    return handleBrowserAuthenticationRequest(authenticationSession, new CASLoginProtocol(session, realm, uriInfo, headers, event), gateway, false);
}
 
开发者ID:Doccrazy,项目名称:keycloak-protocol-cas,代码行数:30,代码来源:AuthorizationEndpoint.java

示例7: writeTo

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
@Override
public void writeTo(DatasetConfig datasetConfig, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
    MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
    throws IOException, WebApplicationException {
  final String hostname;
  if (httpHeaders.containsKey(WebServer.X_DREMIO_HOSTNAME)) {
    hostname = (String) httpHeaders.getFirst(WebServer.X_DREMIO_HOSTNAME);
  } else {
    hostname = masterNode;
  }

  // Change headers to force download and suggest a filename.
  String fullPath = Joiner.on(".").join(datasetConfig.getFullPathList());
  httpHeaders.putSingle(HttpHeaders.CONTENT_DISPOSITION, format("attachment; filename=\"%s.tds\"", fullPath));

  try {
    final XMLStreamWriter xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(entityStream, "UTF-8");

    xmlStreamWriter.writeStartDocument("utf-8", "1.0");
    writeDatasource(xmlStreamWriter, datasetConfig, hostname, mediaType);
    xmlStreamWriter.writeEndDocument();

    xmlStreamWriter.close();
  } catch (XMLStreamException e) {
    throw UserExceptionMapper.withStatus(
      UserException.dataWriteError(e)
        .message("Cannot generate TDS file")
        .addContext("Details", e.getMessage()),
      Status.INTERNAL_SERVER_ERROR
    ).build(logger);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:33,代码来源:TableauMessageBodyGenerator.java

示例8: hasOnceNonEmpty

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
private boolean hasOnceNonEmpty(final MultivaluedMap<String, String> query, String key) {
    return query.containsKey(key) && query.get(key).size() == 1 && StringUtils.isNotBlank(query.getFirst(key));
}
 
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:4,代码来源:RequestVerificationService.java

示例9: isAttributeRequestValid

import javax.ws.rs.core.MultivaluedMap; //导入方法依赖的package包/类
public boolean isAttributeRequestValid(final MultivaluedMap<String, String> attrsParams) {
    return attrsParams.containsKey("token");
}
 
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:4,代码来源:RequestVerificationService.java


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