Get the {@link ContextData} passed into the proxy method.

@param swaggerMethodArguments the arguments passed to the proxy method
@return the context, or null if no context was provided
769562
public ContextData contextData(Object[] swaggerMethodArguments) {
        Object firstArg = swaggerMethodArguments != null && swaggerMethodArguments.length > 0 ? swaggerMethodArguments[0] : null;
        if (firstArg instanceof ContextData) {
            return (ContextData) firstArg;
        } else {
            return ContextData.NONE;
        }
    }
14999
private String findSpringContextFileName(Object handler, Annotation[] annotations) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        String contextFileName = null;
        for (Annotation a : annotations) {
            String n = a.annotationType().getSimpleName();
            if ( n.equals("ContextConfiguration") || n.equals("SpringContext")) {
                log.trace("Found an spring context annotation " + a);
                contextFileName = getContextPathFromSpringAnnotation(handler, a, n);
                if ( contextFileName != null) {
                    break;
                }
            }
        }
        return contextFileName;
    }
1063155
@SuppressWarnings("static-access")
    private AuthData getAuthData(String authDataAlias) throws LoginException {
        return authDataProviderRef.getService().getAuthData(authDataAlias);
    }
94456
public static TemplatedURLFormatter getTemplatedURLFormatter( ServletContext servletContext )
    {
        assert servletContext != null : "The ServletContext cannot be null.";

        if ( servletContext == null )
        {
            throw new IllegalArgumentException( "The ServletContext cannot be null." );
        }

        return ( TemplatedURLFormatter ) servletContext.getAttribute( TEMPLATED_URL_FORMATTER_ATTR );
    }
1278543
public static RequestContextV1 get() {
        RequestContextV1 ret = CURRENT_CONTEXT.get();

        if (ret == null) {
            ret = new RequestContextV1();
            CURRENT_CONTEXT.set(ret);
        }

        return ret;
    }
590551
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)
        context['question'] = self.question
        topic = self.get_object()
        context['forum'] = topic.forum
        return context
75071
private void parseControllerMethod(JaxrsApplicationParser.Result result, JaxrsApplicationParser.ResourceContext context, Class<?> controllerClass, Method method) {
        final RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class);
        if (requestMapping != null) {

            // subContext
            context = context.subPath(requestMapping.path().length == 0 ? "" : requestMapping.path()[0]);
            final Map<String, Type> pathParamTypes = new LinkedHashMap<>();
            for (Parameter parameter : method.getParameters()) {
                final PathVariable pathVariableAnnotation = parameter.getAnnotation(PathVariable.class);
                if (pathVariableAnnotation != null) {
                    pathParamTypes.put(pathVariableAnnotation.value(), parameter.getParameterizedType());
                }
            }
            context = context.subPathParamTypes(pathParamTypes);
            final RequestMethod httpMethod = requestMapping.method().length == 0 ? RequestMethod.GET : requestMapping.method()[0];

            // path parameters
            final PathTemplate pathTemplate = PathTemplate.parse(context.path);
            final Map<String, Type> contextPathParamTypes = context.pathParamTypes;
            final List<MethodParameterModel> pathParams = pathTemplate.getParts().stream()
                    .filter(PathTemplate.Parameter.class::isInstance)
                    .map(PathTemplate.Parameter.class::cast)
                    .map(parameter -> {
                        final Type type = contextPathParamTypes.get(parameter.getOriginalName());
                        final Type paramType = type != null ? type : String.class;
                        foundType(result, paramType, controllerClass, method.getName());
                        return new MethodParameterModel(parameter.getValidName(), paramType);
                    })
                    .collect(Collectors.toList());

            // query parameters
            final List<RestQueryParam> queryParams = new ArrayList<>();
            for (Parameter param : method.getParameters()) {
                final RequestParam requestParamAnnotation = param.getAnnotation(RequestParam.class);
                if (requestParamAnnotation != null) {
                    queryParams.add(new RestQueryParam.Single(new MethodParameterModel(requestParamAnnotation.value(), param.getParameterizedType())));
                    foundType(result, param.getParameterizedType(), controllerClass, method.getName());
                }
            }

            // entity parameter
            final MethodParameterModel entityParameter = getEntityParameter(method);
            if (entityParameter != null) {
                foundType(result, entityParameter.getType(), controllerClass, method.getName());
            }

            // return Type
            final Class<?> returnType = method.getReturnType();
            final Type genericReturnType = method.getGenericReturnType();
            final Type modelReturnType;
            if (genericReturnType instanceof ParameterizedType && returnType == ResponseEntity.class) {
                final ParameterizedType parameterizedReturnType = (ParameterizedType) genericReturnType;
                modelReturnType = parameterizedReturnType.getActualTypeArguments()[0];
                foundType(result, modelReturnType, controllerClass, method.getName());
            } else {
                modelReturnType = genericReturnType;
                foundType(result, modelReturnType, controllerClass, method.getName());
            }

            model.getMethods().add(new RestMethodModel(controllerClass, method.getName(), modelReturnType,
                    controllerClass, httpMethod.name(), context.path, pathParams, queryParams, entityParameter, null));
        }
    }
522083
public static String getManifestMetadataString(Context context, String key) {
		if (context == null) {
			throw new IllegalArgumentException("Context is null");
		}

		if (key == null) {
			throw new IllegalArgumentException("Key is null");
		}

		try {
			String appPackageName = context.getPackageName();
			PackageManager packageManager = context.getPackageManager();
			PackageInfo packageInfo = packageManager.getPackageInfo(appPackageName, PackageManager.GET_META_DATA | PackageManager.GET_RECEIVERS);
			Bundle metaData = packageInfo.applicationInfo.metaData;
			if (metaData != null) {
				return Util.trim(metaData.getString(key));
			}
		} catch (Exception e) {
			ApptentiveLog.e(e, "Unexpected error while reading application or package info.");
			logException(e);
		}

		return null;
	}
30803
protected String getBinding(ProfileRequestContext<?, ?> context) {
    SAMLBindingContext samlBinding = this.samlBindingContextLookupStrategy.apply(context);
    return samlBinding != null ? samlBinding.getBindingUri() : null;
  }
455718
private function getRequestDataAndMethodOptions(RequestContext $context)
    {
        $curlOptions = array();

        $requestData = $context->getRequestData();

        $url = $context->getRequestUrl();

        switch ($context->getMethod()) {
            case RequestContext::METHOD_GET:
                $curlOptions[CURLOPT_HTTPGET] = 1;
                $url = $context->attachQueryToUrl($url, $requestData);
                break;
            case RequestContext::METHOD_POST:
                $curlOptions[CURLOPT_POST] = 1;
                $curlOptions[CURLOPT_POSTFIELDS] = $requestData;
                break;
            default:
                $curlOptions[CURLOPT_CUSTOMREQUEST] = $context->getMethod();
                $curlOptions[CURLOPT_POSTFIELDS] = $requestData;
        }

        $curlOptions[CURLOPT_URL] = $url;

        return $curlOptions;
    }
1190388
static List<NamedArgument> getNamedArgs( ExtensionContext context ) {
        List<NamedArgument> namedArgs = new ArrayList<>();

        if( context.getTestMethod().get().getParameterCount() > 0 ) {
            try {
                if( context.getClass().getCanonicalName().equals( METHOD_EXTENSION_CONTEXT ) ) {
                    Field field = context.getClass().getSuperclass().getDeclaredField( "testDescriptor" );
                    Object testDescriptor = ReflectionUtil.getFieldValueOrNull( field, context, ERROR );
                    if( testDescriptor != null
                            && testDescriptor.getClass().getCanonicalName().equals( TEST_TEMPLATE_INVOCATION_TEST_DESCRIPTOR ) ) {
                        Object invocationContext = ReflectionUtil.getFieldValueOrNull( "invocationContext", testDescriptor, ERROR );
                        if( invocationContext != null
                                && invocationContext.getClass().getCanonicalName().equals( PARAMETERIZED_TEST_INVOCATION_CONTEXT ) ) {
                            Object arguments = ReflectionUtil.getFieldValueOrNull( "arguments", invocationContext, ERROR );
                            List<Object> args = Arrays.asList( (Object[]) arguments );
                            namedArgs = ParameterNameUtil.mapArgumentsWithParameterNames( context.getTestMethod().get(), args );
                        }
                    }
                }
            } catch( Exception e ) {
                log.warn( ERROR, e );
            }
        }

        return namedArgs;
    }
900983
def get_context_data(self, **kwargs):
        
        context = super(SmartDeleteView, self).get_context_data(**kwargs)
        context['name_field'] = self.name_field
        context['cancel_url'] = self.get_cancel_url()
        return context
927867
private Context getContext(ExecutionContext executionContext) {
        // Get context id.
        HttpServletRequest request = executionContext.getActionBeanContext().getRequest();
        String parameter = request.getParameter(ID_PARAMETER);
        
        // Return context.
        if (parameter != null) {
            int id = Integer.parseInt(parameter, 16);
            return contexts.get(id);
        }
        
        return null;
    }
171633
protected Set<ResponseMessage> read(OperationContext context) {
    Set<ResponseMessage> ret;
    try {
      PathMatchingResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
      Resource[] resources = resourceResolver.getResources(
          "classpath*:"
              + context.getName()
              + "*/http-response.springfox");
      // TODO: restdocs in safe package name, not directly under restdocs

      ret = Arrays.stream(resources)
          .map(toRawHttpResponse())
          .filter(Objects::nonNull)
          .collect(Collectors.collectingAndThen(
              toMap(
                  RawHttpResponse::getStatusCode,
                  mappingResponseToResponseMessageBuilder(),
                  mergingExamples()
              ),
              responseMessagesMap -> responseMessagesMap.values()
                  .stream()
                  .map(ResponseMessageBuilder::build)
                  .collect(Collectors.toSet())));
    } catch (
        Exception e) {
      LOG.warn("Failed to read restdocs example for {} " + context.getName() + " caused by: " + e.toString());
      ret = Collections.emptySet();
    }
    return ret;

  }
361716
function requestMetadata (context, router) {
  router = router || context.router;

  return [
    swaggerMetadata,
    swaggerApiMetadata,
    swaggerPathMetadata,
    swaggerOperationMetadata,
    swaggerParamsMetadata,
    swaggerSecurityMetadata
  ];

  /**
   * Sets `req.swagger.api`
   */
  function swaggerApiMetadata (req, res, next) {
    // Only set req.swagger.api if the request is under the API's basePath
    if (context.api) {
      let basePath = util.normalizePath(context.api.basePath, router);
      let reqPath = util.normalizePath(req.path, router);
      if (_.startsWith(reqPath, basePath)) {
        req.swagger.api = context.api;
      }
    }

    next();
  }

  /**
   * Sets `req.swagger.path`
   */
  function swaggerPathMetadata (req, res, next) {
    if (req.swagger.api) {
      let relPath = getRelativePath(req);
      let relPathNormalized = util.normalizePath(relPath, router);

      // Search for a matching path
      Object.keys(req.swagger.api.paths).some((swaggerPath) => {
        let swaggerPathNormalized = util.normalizePath(swaggerPath, router);

        if (swaggerPathNormalized === relPathNormalized) {
          // We found an exact match (i.e. a path with no parameters)
          req.swagger.path = req.swagger.api.paths[swaggerPath];
          req.swagger.pathName = swaggerPath;
          return true;
        }
        else if (req.swagger.path === null && pathMatches(relPathNormalized, swaggerPathNormalized)) {
          // We found a possible match, but keep searching in case we find an exact match
          req.swagger.path = req.swagger.api.paths[swaggerPath];
          req.swagger.pathName = swaggerPath;
        }
      });

      if (req.swagger.path) {
        util.debug("%s %s matches Swagger path %s", req.method, req.path, req.swagger.pathName);
      }
      else {
        util.warn('WARNING! Unable to find a Swagger path that matches "%s"', req.path);
      }
    }

    next();
  }
}
549126
def get_context_data(self, **kwargs):
        
        context = super(BaseAuthorDetail, self).get_context_data(**kwargs)
        context['author'] = self.author
        return context
850496
public List<String> buildMessageHeaderData(final TestContext context) {
        final List<String> headerDataList = new ArrayList<>();
        for (final String headerResourcePath : headerResources) {
            try {
                headerDataList.add(
                        context.replaceDynamicContentInString(
                                FileUtils.readToString(
                                        FileUtils.getFileResource(headerResourcePath, context),
                                        FileUtils.getCharset(headerResourcePath))));
            } catch (final IOException e) {
                throw new CitrusRuntimeException("Failed to read message header data resource", e);
            }
        }

        for (final String data : headerData) {
            headerDataList.add(context.replaceDynamicContentInString(data.trim()));
        }

        return headerDataList;
    }