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

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

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

Request.getProperty介绍

[英]Set a property in the underlining Carbon Message.
[中]在带下划线的碳素消息中设置属性。

代码示例

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

/**
 * Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
 *
 * @param name a {@link String} specifying the name of the attribute
 * @return an {@link Object} containing the value of the attribute, or null if the attribute does not exist
 */
public Object getAttribute(String name) {
  return request.getProperty(name);
}

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

/**
 * Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
 *
 * @param name a {@link String} specifying the name of the attribute
 * @return an {@link Object} containing the value of the attribute, or null if the attribute does not exist
 */
public Object getAttribute(String name) {
  return request.getProperty(name);
}

代码示例来源:origin: org.wso2.carbon.uis/org.wso2.carbon.uis.core

@Override
public String getLocalAddress() {
  return (String) msf4jRequest.getProperty(PROPERTY_LOCAL_NAME);
}

代码示例来源:origin: org.wso2.carbon.uiserver/org.wso2.carbon.uiserver

@Override
public String getProtocol() {
  return (String) msf4jRequest.getProperty(PROPERTY_HTTP_VERSION);
}

代码示例来源:origin: org.wso2.carbon.uuf/org.wso2.carbon.uuf.httpconnector.msf4j

@Override
public String getProtocol() {
  return (String) msf4jRequest.getProperty(PROPERTY_HTTP_VERSION);
}

代码示例来源:origin: org.wso2.carbon.uuf/org.wso2.carbon.uuf.httpconnector.msf4j

@Override
public String getRemoteAddress() {
  return (String) msf4jRequest.getProperty(PROPERTY_REMOTE_HOST);
}

代码示例来源:origin: org.wso2.carbon.uis/org.wso2.carbon.uis.core

@Override
public int getRemotePort() {
  return (Integer) msf4jRequest.getProperty(PROPERTY_REMOTE_PORT);
}

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

@Override
  public boolean interceptResponse(Request request, Response response) throws Exception {
    String propertyName = "SampleProperty";
    String property = (String) request.getProperty(propertyName);
    log.info("Value of property {} is {} ", propertyName, property);
    return true;
  }
}

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

@Override
  public boolean interceptResponse(Request request, Response response) throws Exception {
    String propertyName = "SampleProperty";
    String property = (String) request.getProperty(propertyName);
    log.info("Value of property {} is {} ", propertyName, property);
    return true;
  }
}

代码示例来源:origin: org.wso2.msf4j.samples/interceptor-common

@Override
  public boolean interceptResponse(Request request, Response response) throws Exception {
    String propertyName = "SampleProperty";
    String property = (String) request.getProperty(propertyName);
    log.info("Value of property {} is {} ", propertyName, property);
    return true;
  }
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

private static String getUserName(org.wso2.msf4j.Request request) {
  Object username = request.getProperty("username");
  return username != null ? username.toString() : null;
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.event.simulator.core

private static String getUserName(Request request) {
  Object username = request.getProperty("username");
  return username != null ? username.toString() : null;
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

private static String getUserName(Request request) {
  Object username = request.getProperty("username");
  return username != null ? username.toString() : null;
}

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

public static String getParameter(Request request, String paramName) {
  Map<String, String> queryParams = (Map<String, String>) request.getProperty(
      org.wso2.carbon.identity.gateway.common.util.Constants.QUERY_PARAMETERS);
  Map<String, String> bodyParams = (Map<String, String>) request.getProperty(
      org.wso2.carbon.identity.gateway.common.util.Constants.BODY_PARAMETERS);
  if (queryParams.get(paramName) != null) {
    return queryParams.get(paramName);
  } else {
    return bodyParams.get(paramName);
  }
}

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

private void setBaseUri(Request request) {
  StringBuilder builder = new StringBuilder();
  builder.append(request.getProperty(Constants.PROTOCOL).toString().toLowerCase(Locale.US)).append("://")
      .append(request.getHeader(HttpHeaderNames.HOST.toString()));
  if (builder.charAt(builder.length() - 1) != '/') {
    builder.append("/");
  }
  try {
    MSF4JResponse.setBaseUri(new URI(builder.toString()));
  } catch (URISyntaxException e) {
    log.error("Error while setting the Base URI. " + e.getMessage(), e);
  }
}

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

private void setBaseUri(Request request) {
  StringBuilder builder = new StringBuilder();
  builder.append(request.getProperty(Constants.PROTOCOL).toString().toLowerCase(Locale.US)).append("://")
      .append(request.getHeader(HttpHeaderNames.HOST.toString()));
  if (builder.charAt(builder.length() - 1) != '/') {
    builder.append("/");
  }
  try {
    MSF4JResponse.setBaseUri(new URI(builder.toString()));
  } catch (URISyntaxException e) {
    log.error("Error while setting the Base URI. " + e.getMessage(), e);
  }
}

代码示例来源: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.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: 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;
}

相关文章