Single, bundle-scoped instance of {@link HttpService} (this class) may manage different {@link ContextModel servlet contexts}
identified by {@link HttpContext}.
@param httpContext
@return
777508
private ContextModel getOrCreateContext(final HttpContext httpContext) {
		// org.osgi.service.http.HttpContext -> org.ops4j.pax.web.service.WebContainerContext
		final WebContainerContext context;
		if (httpContext == null) {
			context = createDefaultHttpContext();
		} else if (!(httpContext instanceof WebContainerContext)) {
			context = new WebContainerContextWrapper(serviceBundle, httpContext);
		} else {
			context = (WebContainerContext) httpContext;
		}

		// sanity check - non shared context should be associated to single bundle
		serverModel.associateHttpContext(context, serviceBundle, httpContext instanceof SharedWebContainerContext);

		ContextModel contextModel = serviceModel.getContextModel(context);
		if (contextModel == null) {
			contextModel = new ContextModel(context, serviceBundle,
					bundleClassLoader);
			contextModel.setVirtualHosts(serverController.getConfiguration()
					.getVirtualHosts());
		}
		return contextModel;
	}
692678
public static <T> T getService(BundleContext bundleContext, Class<T> serviceClass) {
        T service = null;
        if (FrameworkState.isValid()) {
            ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass);

            if (ref != null) {
                service = bundleContext.getService(ref);
            }
        }
        return service;
    }
803378
public static ServletResponse getContextResponse()
    {
        ServiceContext context = (ServiceContext) _localContext.get();

        if (context != null)
            return context._response;
        else
            return null;
    }
1025820
public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final RequestContext context) {
        val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
        return HttpRequestUtils.getService(argumentExtractors, request);
    }
156452
protected RequestContext createRequestContext(HttpServletRequest request, HttpServletResponse response) {
        return new RequestContext(request, response, getServletContext());
    }
1326053
@Bean
    public HttpHeadersProvider customHttpHeadersProvider() {
        return instance -> {
            HttpHeaders httpHeaders = new HttpHeaders();
            httpHeaders.add("X-CUSTOM", "My Custom Value");
            return httpHeaders;
        };
    }
10195
private HttpClient getClient(MethodInvocationContext<Object, Object> context, AnnotationValue<Client> clientAnn) {
        String clientId = getClientId(clientAnn);
        String path = clientAnn.get("path", String.class).orElse(null);
        String clientKey = computeClientKey(clientId, path);
        if (clientKey == null) {
            return null;
        }

        return clients.computeIfAbsent(clientKey, integer -> {
            HttpClient clientBean = beanContext.findBean(HttpClient.class, Qualifiers.byName(clientId)).orElse(null);
            if (null != clientBean) {
                return clientBean;
            }

            LoadBalancer loadBalancer = loadBalancerResolver.resolve(clientId)
                .orElseThrow(() ->
                    new HttpClientException("Invalid service reference [" + clientId + "] specified to @Client")
                );

            String contextPath = null;
            if (StringUtils.isNotEmpty(path)) {
                contextPath = path;
            } else if (StringUtils.isNotEmpty(clientId) && clientId.startsWith("/")) {
                contextPath = clientId;
            } else {
                if (loadBalancer instanceof FixedLoadBalancer) {
                    contextPath = ((FixedLoadBalancer) loadBalancer).getUrl().getPath();
                }
            }

            HttpClientConfiguration configuration;
            Optional<HttpClientConfiguration> clientSpecificConfig = beanContext.findBean(
                HttpClientConfiguration.class,
                Qualifiers.byName(clientId)
            );
            Class<HttpClientConfiguration> defaultConfiguration = clientAnn.get("configuration", Class.class).orElse(HttpClientConfiguration.class);
            configuration = clientSpecificConfig.orElseGet(() -> beanContext.getBean(defaultConfiguration));
            HttpClient client = beanContext.createBean(HttpClient.class, loadBalancer, configuration, contextPath);
            if (client instanceof DefaultHttpClient) {
                DefaultHttpClient defaultClient = (DefaultHttpClient) client;
                defaultClient.setClientIdentifiers(clientId);
                AnnotationValue<JacksonFeatures> jacksonFeatures = context.findAnnotation(JacksonFeatures.class).orElse(null);

                if (jacksonFeatures != null) {
                    Optional<MediaTypeCodec> existingCodec = defaultClient.getMediaTypeCodecRegistry().findCodec(MediaType.APPLICATION_JSON_TYPE);
                    ObjectMapper objectMapper = null;
                    if (existingCodec.isPresent()) {
                        MediaTypeCodec existing = existingCodec.get();
                        if (existing instanceof JsonMediaTypeCodec) {
                            objectMapper = ((JsonMediaTypeCodec) existing).getObjectMapper().copy();
                        }
                    }
                    if (objectMapper == null) {
                        objectMapper = new ObjectMapperFactory().objectMapper(null, null);
                    }

                    SerializationFeature[] enabledSerializationFeatures = jacksonFeatures.get("enabledSerializationFeatures", SerializationFeature[].class).orElse(null);
                    if (enabledSerializationFeatures != null) {
                        for (SerializationFeature serializationFeature : enabledSerializationFeatures) {
                            objectMapper.configure(serializationFeature, true);
                        }
                    }

                    DeserializationFeature[] enabledDeserializationFeatures = jacksonFeatures.get("enabledDeserializationFeatures", DeserializationFeature[].class).orElse(null);

                    if (enabledDeserializationFeatures != null) {
                        for (DeserializationFeature serializationFeature : enabledDeserializationFeatures) {
                            objectMapper.configure(serializationFeature, true);
                        }
                    }

                    SerializationFeature[] disabledSerializationFeatures = jacksonFeatures.get("disabledSerializationFeatures", SerializationFeature[].class).orElse(null);
                    if (disabledSerializationFeatures != null) {
                        for (SerializationFeature serializationFeature : disabledSerializationFeatures) {
                            objectMapper.configure(serializationFeature, false);
                        }
                    }

                    DeserializationFeature[] disabledDeserializationFeatures = jacksonFeatures.get("disabledDeserializationFeatures", DeserializationFeature[].class).orElse(null);

                    if (disabledDeserializationFeatures != null) {
                        for (DeserializationFeature feature : disabledDeserializationFeatures) {
                            objectMapper.configure(feature, false);
                        }
                    }

                    defaultClient.setMediaTypeCodecRegistry(
                            MediaTypeCodecRegistry.of(
                                    new JsonMediaTypeCodec(objectMapper,
                                            beanContext.getBean(ApplicationConfiguration.class),
                                            beanContext.findBean(CodecConfiguration.class, Qualifiers.byName(JsonMediaTypeCodec.CONFIGURATION_QUALIFIER)).orElse(null))));
                }
            }
            return client;
        });
    }
136522
public ParamValueType<WebAppDescriptor> getOrCreateContextParam()
   {
      List<Node> nodeList = model.get("context-param");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ParamValueTypeImpl<WebAppDescriptor>(this, "context-param", model, nodeList.get(0));
      }
      return createContextParam();
   }
1086516
public static Connector getConnector(ServletWebServerApplicationContext applicationContext) {
        final TomcatWebServer container = (TomcatWebServer) applicationContext.getWebServer();

        // Start the container to make sure all connectors are available.
        container.start();
        return container.getTomcat().getConnector();
    }
87724
protected RegisteredService resolveRegisteredServiceInRequestContext(final RequestContext requestContext) {
        val resolvedService = resolveServiceFromAuthenticationRequest(requestContext);
        if (resolvedService != null) {
            val service = getWebflowEventResolutionConfigurationContext().getServicesManager().findServiceBy(resolvedService);
            RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(resolvedService, service);
            return service;
        }
        LOGGER.debug("Authentication request is not accompanied by a service given none is specified");
        return null;
    }
48141
public static HandlerInterceptor[] lookupHandlerInterceptors(ServletContext servletContext) {
        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

        final Collection<HandlerInterceptor> allHandlerInterceptors = new ArrayList<HandlerInterceptor>();

        WebRequestInterceptor[] webRequestInterceptors = lookupWebRequestInterceptors(servletContext);
        for (WebRequestInterceptor webRequestInterceptor : webRequestInterceptors) {
            allHandlerInterceptors.add(new WebRequestHandlerInterceptorAdapter(webRequestInterceptor));
        }
        final Collection<HandlerInterceptor> handlerInterceptors = wac.getBeansOfType(HandlerInterceptor.class).values();

        allHandlerInterceptors.addAll(handlerInterceptors);
        return allHandlerInterceptors.toArray(new HandlerInterceptor[allHandlerInterceptors.size()]);
    }
571929
public Object startupService(BundleContext bundleContext)
    {
        // Good, Environment activator is up. Time to start up http services trackers
        
        for (String alias : getAliases())
        {
            Dictionary<String, String> properties = new Hashtable<String, String>();
            ServiceTracker serviceTracker = this.makeServletTracker(alias, properties);
            ((ServiceTracker)serviceTracker).open();
            context.registerService(ServiceTracker.class.getName(), serviceTracker, properties);    // Why isn't this done automatically?
        }

        return null;
    }
78388
public static HttpServletRequest getHttpServletRequestFromExternalWebflowContext(final RequestContext context) {
        Assert.isInstanceOf(ServletExternalContext.class, context.getExternalContext(),
            "Cannot obtain HttpServletRequest from event of type: "
                + context.getExternalContext().getClass().getName());

        return (HttpServletRequest) context.getExternalContext().getNativeRequest();
    }
939614
function HttpViewContext(context) {
    /**
     * Gets or sets the body of the current view
     * @type {String}
     */
    this.body='';
    /**
     * Gets or sets the title of the page if the view will be fully rendered
     * @type {String}
     */
    this.title='';
    /**
     * Gets or sets the view layout page if the view will be fully rendered
     * @type {String}
     */
    this.layout = null;
    /**
     * Gets or sets the view data
     * @type {String}
     */
    this.data = null;
    /**
     * Represents the current HTTP context
     * @type {HttpContext}
     */
    this.context = context;

    /**
     * @name HttpViewContext#writer
     * @type HtmlWriter
     * @description Gets an instance of HtmlWriter helper class
     */
    var writer;
    Object.defineProperty(this, 'writer', {
        get:function() {
            if (writer)
                return writer;
            writer = new HtmlWriter();
            writer.indent = false;
            return writer;
        }, configurable:false, enumerable:false
    });

    var self = this;
    Object.defineProperty(this, 'model', {
        get:function() {
            if (self.context.params)
                if (self.context.params.controller)
                    return self.context.model(self.context.params.controller);
            return null;
        }, configurable:false, enumerable:false
    });

    //class extension initiators
    if (typeof this.init === 'function') {
        //call init() method
        this.init();
    }
}
1005942
public static HttpServiceTracker getServiceTracker(BundleContext context, String key, String value)
    {
        String filter = "(" + key + "=" + value + ")";
        try {
            ServiceReference[] references = context.getServiceReferences(ServiceTracker.class.getName(), filter);
            if ((references == null) || (references.length == 0))
                references = context.getServiceReferences(ServiceTracker.class.getName(), null);   // Being paranoid
            if (references != null) {
                for (ServiceReference reference : references)
                {
                    Object service = context.getService(reference);
                    if (service instanceof HttpServiceTracker)    // Always
                        if (value.equals(((HttpServiceTracker)service).getProperty(key)))   // Being paranoid
                            return (HttpServiceTracker)service;
                }
            }
        } catch (InvalidSyntaxException e) {
            e.printStackTrace();
        }
        return null;    // Not found
    }
1232891
public static ProviderContext of(String provider) {
        return ProviderContextBuilder.of(provider, RateType.ANY).build();
    }
79805
protected HttpClientContext createHttpContext(InternalRequest request) {
        HttpClientContext context = HttpClientContext.create();
        context.setRequestConfig(this.requestConfigBuilder.setExpectContinueEnabled(request.isExpectContinueEnabled())
                .build());
        if (this.credentialsProvider != null) {
            context.setCredentialsProvider(this.credentialsProvider);
        }
        if (this.config.isProxyPreemptiveAuthenticationEnabled()) {
            AuthCache authCache = new BasicAuthCache();
            authCache.put(this.proxyHttpHost, new BasicScheme());
            context.setAuthCache(authCache);
        }
        return context;
    }