當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。