Add RequestResponseContextHolder which hold the current response and

request.

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-04-22 17:49:33 +02:00
parent 946befb038
commit c17bc98ecb
7 changed files with 191 additions and 16 deletions

View File

@@ -8,12 +8,20 @@
*/
package org.eclipse.hawkbit.autoconfigure.web;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.hawkbit.ddi.annotation.EnableDdiApi;
import org.eclipse.hawkbit.mgmt.annotation.EnableMgmtApi;
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
import org.eclipse.hawkbit.rest.util.HttpResponseFactoryBean;
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
import org.eclipse.hawkbit.system.annotation.EnableSystemApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Scope;
import org.springframework.web.context.WebApplicationContext;
/**
* Auto-Configuration for enabling the REST-Resources.
@@ -24,4 +32,29 @@ import org.springframework.context.annotation.Import;
@Import({ EnableDdiApi.class, EnableMgmtApi.class, EnableSystemApi.class })
public class ResourceControllerAutoConfiguration {
/**
* Create filter for {@link HttpServletResponse}.
*/
@Bean
public FilterHttpResponse filterHttpResponse() {
return new FilterHttpResponse();
}
/**
* Create factory bean for {@link HttpServletResponse}.
*/
@Bean
public HttpResponseFactoryBean httpResponseFactoryBean() {
return new HttpResponseFactoryBean();
}
/**
* Create factory bean for {@link HttpServletResponse}.
*/
@Bean
@Scope(value = WebApplicationContext.SCOPE_REQUEST)
public RequestResponseContextHolder requestResponseContextHolder() {
return new RequestResponseContextHolder();
}
}