@Test public void testServerMessageContext() { Mockery mockery = new Mockery(); final HttpServletRequest request = mockery.mock(HttpServletRequest.class); final HttpServletResponse response = mockery.mock(HttpServletResponse.class); DeploymentConfiguration config = new DeploymentConfiguration(); mockery.checking(new Expectations() { { allowing(request).getMethod(); will(returnValue(HttpMethod.GET)); } }); ServerMessageContext smc = new ServerMessageContext(request, response, config); assertTrue(smc.getAttribute(WinkConfiguration.class) == smc.getAttribute(DeploymentConfiguration.class)); }
public ServerMessageContext(HttpServletRequest servletRequest, HttpServletResponse servletResponse, DeploymentConfiguration configuration) { this.httpMethod = buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest); this.responseStatusCode = -1; setAttribute(HttpServletRequest.class, servletRequest); setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest)); HttpServletResponseWrapper responseWrapper = new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper()); setAttribute(HttpServletResponse.class, responseWrapper); setAttribute(HttpServletResponseWrapper.class, responseWrapper); setAttribute(ServletContext.class, configuration.getServletContext()); setAttribute(ServletConfig.class, configuration.getServletConfig()); setAttribute(FilterConfig.class, configuration.getFilterConfig()); setAttribute(WinkConfiguration.class, configuration); setAttribute(DeploymentConfiguration.class, configuration); setAttribute(ResourceRegistry.class, configuration.getResourceRegistry()); setAttribute(ProvidersRegistry.class, configuration.getProvidersRegistry()); if (configuration.isDefaultResponseCharset() || configuration.isUseAcceptCharset()) { setAttribute(MediaTypeCharsetAdjuster.class, ServerMediaTypeCharsetAdjuster.getInstance()); } initContexts(); List<Application> apps = configuration.getApplications(); if (apps != null && !apps.isEmpty()) { setAttribute(Application.class, apps.get(0)); } }
ServerMessageContext extends AbstractRuntimeContext implements MessageContext { public ServerMessageContext(HttpServletRequest servletRequest, HttpServletResponse servletResponse, DeploymentConfiguration configuration) { this.httpMethod = buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest); this.responseStatusCode = -1; setAttribute(HttpServletRequest.class, servletRequest); setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest)); HttpServletResponseWrapper responseWrapper = new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper()); setAttribute(HttpServletResponse.class, responseWrapper); setAttribute(HttpServletResponseWrapper.class, responseWrapper); setAttribute(ServletContext.class, configuration.getServletContext()); setAttribute(ServletConfig.class, configuration.getServletConfig()); setAttribute(FilterConfig.class, configuration.getFilterConfig()); setAttribute(WinkConfiguration.class, configuration); setAttribute(DeploymentConfiguration.class, configuration); setAttribute(ResourceRegistry.class, configuration.getResourceRegistry()); setAttribute(ProvidersRegistry.class, configuration.getProvidersRegistry()); if (configuration.isDefaultResponseCharset() || configuration.isUseAcceptCharset()) { setAttribute(MediaTypeCharsetAdjuster.class, ServerMediaTypeCharsetAdjuster.getInstance()); } initContexts(); List<Application> apps = configuration.getApplications(); if (apps != null && !apps.isEmpty()) { setAttribute(Application.class, apps.get(0)); } } }
ServerMessageContext extends AbstractRuntimeContext implements MessageContext { public ServerMessageContext(HttpServletRequest servletRequest, HttpServletResponse servletResponse, DeploymentConfiguration configuration) { this.httpMethod = buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest); this.responseStatusCode = -1; setAttribute(HttpServletRequest.class, servletRequest); setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest)); HttpServletResponseWrapper responseWrapper = new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper()); setAttribute(HttpServletResponse.class, responseWrapper); setAttribute(HttpServletResponseWrapper.class, responseWrapper); setAttribute(ServletContext.class, configuration.getServletContext()); setAttribute(ServletConfig.class, configuration.getServletConfig()); setAttribute(FilterConfig.class, configuration.getFilterConfig()); setAttribute(WinkConfiguration.class, configuration); setAttribute(DeploymentConfiguration.class, configuration); setAttribute(ResourceRegistry.class, configuration.getResourceRegistry()); setAttribute(ProvidersRegistry.class, configuration.getProvidersRegistry()); if (configuration.isDefaultResponseCharset() || configuration.isUseAcceptCharset()) { setAttribute(MediaTypeCharsetAdjuster.class, ServerMediaTypeCharsetAdjuster.getInstance()); } initContexts(); List<Application> apps = configuration.getApplications(); if (apps != null && !apps.isEmpty()) { setAttribute(Application.class, apps.get(0)); } } ServerMessageContext(HttpServletRequest servletRequest,
                                HttpServletResponse servletResponse,
                                DeploymentConfiguration configuration); }
ServerMessageContext extends AbstractRuntimeContext implements MessageContext { public ServerMessageContext(HttpServletRequest servletRequest, HttpServletResponse servletResponse, DeploymentConfiguration configuration) { this.httpMethod = buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest); this.responseStatusCode = -1; setAttribute(HttpServletRequest.class, servletRequest); setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest)); HttpServletResponseWrapper responseWrapper = new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper()); setAttribute(HttpServletResponse.class, responseWrapper); setAttribute(HttpServletResponseWrapper.class, responseWrapper); setAttribute(ServletContext.class, configuration.getServletContext()); setAttribute(ServletConfig.class, configuration.getServletConfig()); setAttribute(FilterConfig.class, configuration.getFilterConfig()); setAttribute(WinkConfiguration.class, configuration); setAttribute(DeploymentConfiguration.class, configuration); setAttribute(ResourceRegistry.class, configuration.getResourceRegistry()); setAttribute(ProvidersRegistry.class, configuration.getProvidersRegistry()); if (configuration.isDefaultResponseCharset() || configuration.isUseAcceptCharset()) { setAttribute(MediaTypeCharsetAdjuster.class, ServerMediaTypeCharsetAdjuster.getInstance()); } initContexts(); List<Application> apps = configuration.getApplications(); if (apps != null && !apps.isEmpty()) { setAttribute(Application.class, apps.get(0)); } } ServerMessageContext(HttpServletRequest servletRequest,
                                HttpServletResponse servletResponse,
                                DeploymentConfiguration configuration); Properties getProperties(); void setResponseStatusCode(int responseStatusCode); int getResponseStatusCode(); void setResponseEntity(Object entity); Object getResponseEntity(); void setResponseMediaType(MediaType responseMediaType); MediaType getResponseMediaType(); void setHttpMethod(String method); String getHttpMethod(); @Override String toString(); LinkBuilders getLinkBuilders(); InputStream getInputStream(); OutputStream getOutputStream(); }
ServerMessageContext extends AbstractRuntimeContext implements MessageContext { public ServerMessageContext(HttpServletRequest servletRequest, HttpServletResponse servletResponse, DeploymentConfiguration configuration) { this.httpMethod = buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest); this.responseStatusCode = -1; setAttribute(HttpServletRequest.class, servletRequest); setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest)); HttpServletResponseWrapper responseWrapper = new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper()); setAttribute(HttpServletResponse.class, responseWrapper); setAttribute(HttpServletResponseWrapper.class, responseWrapper); setAttribute(ServletContext.class, configuration.getServletContext()); setAttribute(ServletConfig.class, configuration.getServletConfig()); setAttribute(FilterConfig.class, configuration.getFilterConfig()); setAttribute(WinkConfiguration.class, configuration); setAttribute(DeploymentConfiguration.class, configuration); setAttribute(ResourceRegistry.class, configuration.getResourceRegistry()); setAttribute(ProvidersRegistry.class, configuration.getProvidersRegistry()); if (configuration.isDefaultResponseCharset() || configuration.isUseAcceptCharset()) { setAttribute(MediaTypeCharsetAdjuster.class, ServerMediaTypeCharsetAdjuster.getInstance()); } initContexts(); List<Application> apps = configuration.getApplications(); if (apps != null && !apps.isEmpty()) { setAttribute(Application.class, apps.get(0)); } } ServerMessageContext(HttpServletRequest servletRequest,
                                HttpServletResponse servletResponse,
                                DeploymentConfiguration configuration); Properties getProperties(); void setResponseStatusCode(int responseStatusCode); int getResponseStatusCode(); void setResponseEntity(Object entity); Object getResponseEntity(); void setResponseMediaType(MediaType responseMediaType); MediaType getResponseMediaType(); void setHttpMethod(String method); String getHttpMethod(); @Override String toString(); LinkBuilders getLinkBuilders(); InputStream getInputStream(); OutputStream getOutputStream();  }