org.wso2.msf4j.Request.getContentType()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.wso2.msf4j.Request.getContentType方法的一些代码示例,展示了Request.getContentType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getContentType方法的具体详情如下:
包路径:org.wso2.msf4j.Request
类名称:Request
方法名:getContentType

Request.getContentType介绍

暂无

代码示例

代码示例来源:origin: wso2/msf4j

private void createObject(Request request, Object[] args, int idx, HttpResourceModel.ParameterInfo<?> paramInfo)
    throws IOException {
  try (InputStream inputStream = request.getMessageContentStream()) {
    Type paramType = paramInfo.getParameterType();
    args[idx] =
        BeanConverter.getConverter((request.getContentType() != null) ? request.getContentType() :
            MediaType.WILDCARD).convertToObject(inputStream, paramType);
  }
}

代码示例来源:origin: org.wso2.msf4j/msf4j-core

private void createObject(Request request, Object[] args, int idx, HttpResourceModel.ParameterInfo<?> paramInfo)
    throws IOException {
  try (InputStream inputStream = request.getMessageContentStream()) {
    Type paramType = paramInfo.getParameterType();
    args[idx] =
        BeanConverter.getConverter((request.getContentType() != null) ? request.getContentType() :
            MediaType.WILDCARD).convertToObject(inputStream, paramType);
  }
}

代码示例来源:origin: wso2/msf4j

} else if (((Class) paramType).isAssignableFrom(MultivaluedMap.class)) {
  MultivaluedMap<String, Object> listMultivaluedMap = new MultivaluedHashMap<>();
  if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
    listMultivaluedMap = extractRequestFormParams(request, paramInfo, false);
  } else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
    try (InputStream inputStream = request.getMessageContentStream()) {
      String bodyStr = BeanConverter.getConverter(
          (request.getContentType() != null) ? request.getContentType() : MediaType.WILDCARD)
          .convertToObject(inputStream, paramInfo.getParameterType()).toString();
      QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.msf4j/msf4j-core

} else if (((Class) paramType).isAssignableFrom(MultivaluedMap.class)) {
  MultivaluedMap<String, Object> listMultivaluedMap = new MultivaluedHashMap<>();
  if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
    listMultivaluedMap = extractRequestFormParams(request, paramInfo, false);
  } else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
    try (InputStream inputStream = request.getMessageContentStream()) {
      String bodyStr = BeanConverter.getConverter(
          (request.getContentType() != null) ? request.getContentType() : MediaType.WILDCARD)
          .convertToObject(inputStream, paramInfo.getParameterType()).toString();
      QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.msf4j/msf4j-core

} else if (MediaType.TEXT_PLAIN.equalsIgnoreCase(formParamContentType.get(formDataParam.value()))) {
  return paramInfo.convert(parameter);
} else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
  return paramInfo.convert(parameter);

代码示例来源:origin: wso2/msf4j

} else if (MediaType.TEXT_PLAIN.equalsIgnoreCase(formParamContentType.get(formDataParam.value()))) {
  return paramInfo.convert(parameter);
} else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
  return paramInfo.convert(parameter);

代码示例来源:origin: wso2/msf4j

if (getFormParameters() == null) {
  MultivaluedMap<String, Object> parameters = new MultivaluedHashMap<>();
  if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
    FormParamIterator formParamIterator = new FormParamIterator(request);
    while (formParamIterator.hasNext()) {
  } else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
    try (InputStream inputStream = request.getMessageContentStream()) {
      String bodyStr = BeanConverter.getConverter(
          (request.getContentType() != null) ? request.getContentType() : MediaType.WILDCARD)
          .convertToObject(inputStream, paramInfo.getParameterType()).toString();
      QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.msf4j/msf4j-core

if (getFormParameters() == null) {
  MultivaluedMap<String, Object> parameters = new MultivaluedHashMap<>();
  if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
    FormParamIterator formParamIterator = new FormParamIterator(request);
    while (formParamIterator.hasNext()) {
  } else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
    try (InputStream inputStream = request.getMessageContentStream()) {
      String bodyStr = BeanConverter.getConverter(
          (request.getContentType() != null) ? request.getContentType() : MediaType.WILDCARD)
          .convertToObject(inputStream, paramInfo.getParameterType()).toString();
      QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.msf4j/msf4j-core

.collect(Collectors.toList());
Optional<Map.Entry<SubresourceKey, HttpResourceModel>> entry = entries.stream().filter(
    entryPair -> entryPair.getValue().matchConsumeMediaType(request.getContentType()) &&
           entryPair.getValue().matchProduceMediaType(request.getAcceptTypes()))
                                   .findFirst();
                      .getValue()
                      .matchConsumeMediaType(
                          request.getContentType()) &&
                  entryPair
                      .getValue()

代码示例来源:origin: wso2/msf4j

.collect(Collectors.toList());
Optional<Map.Entry<SubresourceKey, HttpResourceModel>> entry = entries.stream().filter(
    entryPair -> entryPair.getValue().matchConsumeMediaType(request.getContentType()) &&
           entryPair.getValue().matchProduceMediaType(request.getAcceptTypes()))
                                   .findFirst();
                      .getValue()
                      .matchConsumeMediaType(
                          request.getContentType()) &&
                  entryPair
                      .getValue()

代码示例来源:origin: wso2/msf4j

boolean addFileInfo) throws IOException {
MultivaluedMap<String, Object> parameters = new MultivaluedHashMap<>();
if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
  FormParamIterator formParamIterator = new FormParamIterator(request);
  while (formParamIterator.hasNext()) {
} else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
  try (InputStream inputStream = request.getMessageContentStream()) {
    String bodyStr = BeanConverter
        .getConverter((request.getContentType() != null) ? request.getContentType() : MediaType
            .WILDCARD).convertToObject(inputStream, paramInfo.getParameterType()).toString();
    QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.msf4j/msf4j-core

boolean addFileInfo) throws IOException {
MultivaluedMap<String, Object> parameters = new MultivaluedHashMap<>();
if (MediaType.MULTIPART_FORM_DATA.equals(request.getContentType())) {
  FormParamIterator formParamIterator = new FormParamIterator(request);
  while (formParamIterator.hasNext()) {
} else if (MediaType.APPLICATION_FORM_URLENCODED.equals(request.getContentType())) {
  try (InputStream inputStream = request.getMessageContentStream()) {
    String bodyStr = BeanConverter
        .getConverter((request.getContentType() != null) ? request.getContentType() : MediaType
            .WILDCARD).convertToObject(inputStream, paramInfo.getParameterType()).toString();
    QueryStringDecoderUtil queryStringDecoderUtil = new QueryStringDecoderUtil(bodyStr, false);

代码示例来源:origin: org.wso2.carbon.identity.gateway/org.wso2.carbon.identity.gateway.api

/**
 * Update GatewayRequestBuilder.
 *
 * @param builder Builder.
 * @param request MS4J request
 * @throws GatewayClientException GatewayClientException
 */
protected void create(T builder, Request request)
    throws GatewayClientException {
  request.getHeaders().getAll().forEach(header -> {
    builder.addHeader(header.getName(), header.getValue());
  });
  builder.setMethod(request.getHttpMethod());
  builder.setContentType(request.getContentType());
  builder.setRequestURI(request.getUri());
  builder.setMethod(request.getHttpMethod());
  builder.setAttributes((Map) request.getProperties());
  builder.addParameter(Constants.QUERY_PARAMETERS,
      (Serializable) request.getProperty(Constants.QUERY_PARAMETERS));
  builder.addParameter(Constants.BODY_PARAMETERS, (Serializable) request.getProperty(Constants.BODY_PARAMETERS));
  String[] queryStringParams = request.getUri().split("\\?");
  if (queryStringParams.length > 1) {
    builder.setQueryString(queryStringParams[1]);
  } else {
    builder.setQueryString(queryStringParams[0]);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("Successfully Updated the request builder in GatewayRequestBuilderFactory.");
  }
}

代码示例来源:origin: org.wso2.msf4j/msf4j-core

request.getUri(),
        request.getHttpMethod(),
        request.getContentType(),
        request.getAcceptTypes());
HttpResourceModel resourceModel = destination.getDestination();

代码示例来源:origin: wso2/msf4j

request.getUri(),
        request.getHttpMethod(),
        request.getContentType(),
        request.getAcceptTypes());
HttpResourceModel resourceModel = destination.getDestination();

相关文章