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

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

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

Request.setProperty介绍

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

代码示例

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

  1. /**
  2. * Stores an attribute in this request.
  3. *
  4. * @param name a {@link String} specifying the name of the attribute
  5. * @param obj the {@link Object} to be stored
  6. */
  7. public void setAttribute(String name, Object obj) {
  8. request.setProperty(name, obj);
  9. }
  10. }

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

  1. /**
  2. * Stores an attribute in this request.
  3. *
  4. * @param name a {@link String} specifying the name of the attribute
  5. * @param obj the {@link Object} to be stored
  6. */
  7. public void setAttribute(String name, Object obj) {
  8. request.setProperty(name, obj);
  9. }
  10. }

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

  1. @Override
  2. public boolean interceptRequest(Request request, Response response) throws Exception {
  3. String propertyName = "SampleProperty";
  4. String property = "Sample Object";
  5. request.setProperty(propertyName, property);
  6. log.info("Property {} set to request", propertyName);
  7. return true;
  8. }
  9. }

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

  1. @Override
  2. public boolean interceptRequest(Request request, Response response) throws Exception {
  3. String propertyName = "SampleProperty";
  4. String property = "Sample Object";
  5. request.setProperty(propertyName, property);
  6. log.info("Property {} set to request", propertyName);
  7. return true;
  8. }
  9. }

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

  1. @Override
  2. public boolean interceptRequest(Request request, Response response) throws Exception {
  3. String propertyName = "SampleProperty";
  4. String property = "Sample Object";
  5. request.setProperty(propertyName, property);
  6. log.info("Property {} set to request", propertyName);
  7. return true;
  8. }
  9. }

代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.rest.api.commons

  1. boolean authenticated = userStoreManager.doAuthenticate(username, password);
  2. if (authenticated) {
  3. request.setProperty(RestAPIConstants.LOGGED_IN_USER, username);
  4. request.setProperty(RestAPIConstants.LOGGED_IN_PSEUDO_USER, userNameMapper
  5. .getLoggedInPseudoNameFromUserID(username));
  6. return true;

代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.rest.api.commons

  1. boolean authenticated = introspectionResponse.isActive();
  2. if (authenticated) {
  3. request.setProperty(RestAPIConstants.LOGGED_IN_USER, introspectionResponse.getUsername());
  4. try {
  5. request.setProperty(RestAPIConstants.LOGGED_IN_PSEUDO_USER, userNameMapper
  6. .getLoggedInPseudoNameFromUserID(introspectionResponse.getUsername()));
  7. } catch (AuthException e) {

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

  1. Request request, MicroservicesRegistryImpl microservicesRegistry, boolean isSubResource) throws Exception {
  2. Class<?> clazz = httpMethodInfo.method.getDeclaringClass();
  3. request.setProperty(MSF4JConstants.METHOD_PROPERTY_NAME, httpMethodInfo.method); // Required for analytics

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

  1. Request request, MicroservicesRegistryImpl microservicesRegistry, boolean isSubResource) throws Exception {
  2. Class<?> clazz = httpMethodInfo.method.getDeclaringClass();
  3. request.setProperty(MSF4JConstants.METHOD_PROPERTY_NAME, httpMethodInfo.method); // Required for analytics

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

  1. String username = idPClient.authenticate(accessToken);
  2. if (username != null) {
  3. request.setProperty(InterceptorConstants.PROPERTY_USERNAME, username);
  4. return true;
  5. return false;
  6. request.setProperty(InterceptorConstants.PROPERTY_USERNAME, userName);
  7. return true;
  8. } else {

代码示例来源:origin: org.wso2.carbon.auth/org.wso2.carbon.auth.rest.api.authenticators

  1. /**
  2. * Get defined HTTP methods in the swagger definition as a comma separated string
  3. *
  4. * @param request Request
  5. * @return Http Methods as a comma separated string
  6. */
  7. public static RestAPIInfo getElectedRestApiInfo(Request request) {
  8. if (request.getProperty(RestAPIConstants.ELECTED_BASE_PATH) != null) {
  9. return ServiceReferenceHolder.getInstance().getSwaggerDefinitionMap().get(request.getProperty
  10. (RestAPIConstants.ELECTED_BASE_PATH));
  11. }
  12. String requestURI = request.getUri().toLowerCase(Locale.ENGLISH);
  13. RestAPIInfo electedSwagger = null;
  14. for (String basePath : ServiceReferenceHolder.getInstance().getSwaggerDefinitionMap().keySet()) {
  15. if (requestURI.contains(basePath)) {
  16. electedSwagger = ServiceReferenceHolder.getInstance().getSwaggerDefinitionMap().get(basePath);
  17. break;
  18. }
  19. }
  20. if (electedSwagger != null) {
  21. request.setProperty(RestAPIConstants.ELECTED_BASE_PATH, electedSwagger.getBasePath());
  22. }
  23. return electedSwagger;
  24. }

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

  1. /**
  2. * Calls the http resource method.
  3. *
  4. * @param destination matching Destinations for the route
  5. * @param request original request
  6. * @param httpMethodInfo http method information
  7. * @param microservicesRegistry micro-services registry
  8. * @throws Exception if error occurs while invoking the resource method
  9. */
  10. public void invoke(PatternPathRouter.RoutableDestination<HttpResourceModel> destination, Request request,
  11. HttpMethodInfo httpMethodInfo, MicroservicesRegistryImpl microservicesRegistry)
  12. throws Exception {
  13. request.setProperty(DECLARING_CLASS_LIST_CONSTANT, new ArrayList<Class<?>>());
  14. request.setProperty(RESOURCE_METHOD_LIST_CONSTANT, new ArrayList<Method>());
  15. ImmutablePair<Boolean, Object> returnVal =
  16. invokeResource(destination, httpMethodInfo, request, microservicesRegistry, false);
  17. // Execute method level interceptors of sub-resources and resources (first in - last out order)
  18. if (returnVal.getFirst()
  19. && InterceptorExecutor.executeMethodResponseInterceptorsForMethods(request, httpMethodInfo.responder,
  20. (ArrayList<Method>) request.getProperty(RESOURCE_METHOD_LIST_CONSTANT))
  21. // Execute class level interceptors of sub-resources and resources (first in - last out order)
  22. && InterceptorExecutor.executeClassResponseInterceptorsForClasses(request, httpMethodInfo.responder,
  23. (ArrayList<Class<?>>) request.getProperty(DECLARING_CLASS_LIST_CONSTANT))
  24. // Execute global interceptors
  25. && InterceptorExecutor.executeGlobalResponseInterceptors(microservicesRegistry, request,
  26. httpMethodInfo.responder)) {
  27. responder.setEntity(returnVal.getSecond());
  28. }
  29. responder.send();
  30. }

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.analytics.msf4j.interceptor.common

  1. String username = idPClient.authenticate(accessToken);
  2. if (username != null) {
  3. request.setProperty(InterceptorConstants.PROPERTY_USERNAME, username);
  4. return true;
  5. return false;
  6. request.setProperty(InterceptorConstants.PROPERTY_USERNAME, userName);
  7. return true;

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

  1. /**
  2. * Calls the http resource method.
  3. *
  4. * @param destination matching Destinations for the route
  5. * @param request original request
  6. * @param httpMethodInfo http method information
  7. * @param microservicesRegistry micro-services registry
  8. * @throws Exception if error occurs while invoking the resource method
  9. */
  10. public void invoke(PatternPathRouter.RoutableDestination<HttpResourceModel> destination, Request request,
  11. HttpMethodInfo httpMethodInfo, MicroservicesRegistryImpl microservicesRegistry)
  12. throws Exception {
  13. request.setProperty(DECLARING_CLASS_LIST_CONSTANT, new ArrayList<Class<?>>());
  14. request.setProperty(RESOURCE_METHOD_LIST_CONSTANT, new ArrayList<Method>());
  15. ImmutablePair<Boolean, Object> returnVal =
  16. invokeResource(destination, httpMethodInfo, request, microservicesRegistry, false);
  17. // Execute method level interceptors of sub-resources and resources (first in - last out order)
  18. if (returnVal.getFirst()
  19. && InterceptorExecutor.executeMethodResponseInterceptorsForMethods(request, httpMethodInfo.responder,
  20. (ArrayList<Method>) request.getProperty(RESOURCE_METHOD_LIST_CONSTANT))
  21. // Execute class level interceptors of sub-resources and resources (first in - last out order)
  22. && InterceptorExecutor.executeClassResponseInterceptorsForClasses(request, httpMethodInfo.responder,
  23. (ArrayList<Class<?>>) request.getProperty(DECLARING_CLASS_LIST_CONSTANT))
  24. // Execute global interceptors
  25. && InterceptorExecutor.executeGlobalResponseInterceptors(microservicesRegistry, request,
  26. httpMethodInfo.responder)) {
  27. responder.setEntity(returnVal.getSecond());
  28. }
  29. responder.send();
  30. }

相关文章