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

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

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

Request.getProperties介绍

暂无

代码示例

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

@Override
default boolean interceptRequest(Request request, Response response) throws Exception {
  Method method = (Method) request.getProperty(MSF4JConstants.METHOD_PROPERTY_NAME);
  ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(method.getName(), method, request);
  request.getProperties().forEach(serviceMethodInfo::setAttribute);
  return preCall(request, response, serviceMethodInfo);
}

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

@Override
default boolean interceptRequest(Request request, Response response) throws Exception {
  Method method = (Method) request.getProperty(MSF4JConstants.METHOD_PROPERTY_NAME);
  ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(method.getName(), method, request);
  request.getProperties().forEach(serviceMethodInfo::setAttribute);
  return preCall(request, response, serviceMethodInfo);
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.rest.api.webserver

String hostName = String.valueOf(request.getProperties().get("HOST"));
String port = String.valueOf(request.getProperties().get("LISTENER_PORT"));
String protocol = String.valueOf(request.getProperties().get("PROTOCOL"));
String absURL = protocol + "://" + hostName + ":" + port + rawUri;
String path;

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.business.rules.core

private Role getUserRole(Request request) {
  PermissionProvider permissionProvider = DataHolder.getInstance().getPermissionProvider();
  String userName = request.getProperties().get(USER_NAME).toString();
  if (permissionProvider.hasPermission(userName, managerPermission)) {
    return Role.MANAGER;
  }
  return Role.VIEWER;
}

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

@Override
default boolean interceptResponse(Request request, Response response) throws Exception {
  Method method = (Method) request.getProperty(MSF4JConstants.METHOD_PROPERTY_NAME);
  ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(method.getName(), method, request);
  request.getProperties().forEach(serviceMethodInfo::setAttribute);
  postCall(request, response.getStatusCode(), serviceMethodInfo);
  return true;
}

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

@Override
default boolean interceptResponse(Request request, Response response) throws Exception {
  Method method = (Method) request.getProperty(MSF4JConstants.METHOD_PROPERTY_NAME);
  ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(method.getName(), method, request);
  request.getProperties().forEach(serviceMethodInfo::setAttribute);
  postCall(request, response.getStatusCode(), serviceMethodInfo);
  return true;
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.business.rules.core

private boolean hasPermission(Request request, RequestMethod method) {
    PermissionProvider permissionProvider = DataHolder.getInstance().getPermissionProvider();
    String userName = request.getProperties().get("username").toString();
    if (permissionProvider.hasPermission(userName, managerPermission)) {
      return true;
    } else if (permissionProvider.hasPermission(userName, viewerPermission)) {
      switch (method) {
        case GET_BUSINESS_RULES:
        case LOAD_BUSINESS_RULE:
        case GET_RULE_TEMPLATES:
        case GET_RULE_TEMPLATE:
        case GET_TEMPLATE_GROUP:
          return true;
      }
    }
    return 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.");
  }
}

相关文章