本文整理汇总了Java中org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter类的典型用法代码示例。如果您正苦于以下问题:Java OpenEntityManagerInViewFilter类的具体用法?Java OpenEntityManagerInViewFilter怎么用?Java OpenEntityManagerInViewFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpenEntityManagerInViewFilter类属于org.springframework.orm.jpa.support包,在下文中一共展示了OpenEntityManagerInViewFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRestTestServletAdapter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
public static ServletAdapter initRestTestServletAdapter(Class<?> applicationConfigClass, int testServerPort,
String testContextPath, String testServletPath, boolean enableJPA) {
final ServletAdapter adapter = new ServletAdapter();
adapter.addInitParameter(ServletContainer.APPLICATION_CONFIG_CLASS, applicationConfigClass.getName());
adapter.addInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters", LoggingFilter.class.getName());
adapter.addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", LoggingFilter.class.getName());
adapter.addServletListener(ContextLoaderListener.class.getName());
if (enableJPA) {
adapter.addFilter(new OpenEntityManagerInViewFilter(), "openEntityManagerInViewFilter", null);
}
adapter.setServletInstance(new SpringServlet());
adapter.setContextPath(testContextPath);
adapter.setServletPath(testServletPath);
return adapter;
}
示例2: onStartup
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext webAppContext = new AnnotationConfigWebApplicationContext();
webAppContext.setConfigLocation(getClass().getPackage().getName());
ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(webAppContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);
OpenEntityManagerInViewFilter openEntityManagerInViewFilter = new OpenEntityManagerInViewFilter();
openEntityManagerInViewFilter.setEntityManagerFactoryBeanName("entityManagerFactory");
Dynamic dynamic = servletContext.addFilter("openEntityManagerInViewFilter", openEntityManagerInViewFilter);
dynamic.addMappingForUrlPatterns(getDispatcherTypes(), false, DISPATCHER_SERVLET_MAPPING);
servletContext.addListener(new ContextLoaderListener(webAppContext));
}
示例3: onStartup
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8");
filter.setForceEncoding(true);
servletContext.addFilter("characterEncodingFilter", filter).addMappingForUrlPatterns(null, false, "/*");
servletContext.addFilter("openEntityManagerInViewFilter", new OpenEntityManagerInViewFilter()).addMappingForUrlPatterns(null, false, "/*");
DelegatingFilterProxy delegatingFilterProxy = new DelegatingFilterProxy();
delegatingFilterProxy.setTargetFilterLifecycle(true);
servletContext.addFilter("shiroFilter", delegatingFilterProxy).addMappingForUrlPatterns(null, false, "/*");
servletContext.addServlet("kaptcha", new KaptchaServlet()).addMapping("/kaptcha");
super.onStartup(servletContext);
}
示例4: getServletFilters
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
return new Filter[]{
new OpenEntityManagerInViewFilter(),
new RecaptchaResponseFilter(),
new ErrorHandlerFilter()
};
}
开发者ID:mattpwest,项目名称:entelect-spring-webapp-template,代码行数:9,代码来源:SpringDispatcherServletInitializer.java
示例5: configureContext
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
protected void configureContext(WebappContext context) {
context.setInitParameter(ContextLoader.CONTEXT_CLASS_PARAM, AnnotationConfigWebApplicationContext.class.getName());
context.setInitParameter(ContextLoader.CONTEXT_INITIALIZER_CLASSES_PARAM, ExtendedApplicationContextInitializer.class.getName());
if (javaConfigClass != null) {
context.setInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, javaConfigClass.getName());
}
context.addListener(SLF4JLoggingListener.class);
context.addListener(ContextLoaderListener.class);
context.addFilter("openEntityManagerInViewFilter", new OpenEntityManagerInViewFilter())
.addMappingForUrlPatterns(null, "/*");
}
示例6: onStartup
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Override
public void onStartup(ServletContext aServletContext) throws ServletException
{
// 2) Make username accessible to logging framework
FilterRegistration loggingFilter = aServletContext.addFilter("logging",
LoggingFilter.class);
loggingFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "/*");
// 5) Make sure we have one JPA session/transaction per request. Closes session at the
// end, without this, changed data may not be automatically saved to the DB.
FilterRegistration openSessionInViewFilter = aServletContext.addFilter("opensessioninview",
OpenEntityManagerInViewFilter.class);
openSessionInViewFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false,
"/*");
}
示例7: openEntityManagerInViewFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Bean
public FilterRegistrationBean openEntityManagerInViewFilter() {
FilterRegistrationBean reg = new FilterRegistrationBean();
reg.setName("OpenEntityManagerInViewFilter");
reg.setFilter(new OpenEntityManagerInViewFilter());
return reg;
}
示例8: initializeOpenEMInViewFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
private void initializeOpenEMInViewFilter(ServletContext container)
{
OpenEntityManagerInViewFilter sessionFilter = new OpenEntityManagerInViewFilter();
FilterRegistration.Dynamic filterReg = container.addFilter("Open EM In View Filter", sessionFilter);
filterReg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, URL_PATTERN_WEB);
filterReg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, URL_PATTERN_REST);
}
示例9: getServletFilters
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
return new Filter[]{
new MDCInsertingServletFilter(),
new HiddenHttpMethodFilter(),
new OpenEntityManagerInViewFilter(),
new RequestContextFilter(),
new SecurityContextPersistenceFilter()
};
}
示例10: openEntityManagerInViewFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public OpenEntityManagerInViewFilter openEntityManagerInViewFilter() {
return new OpenEntityManagerInViewFilter();
}
示例11: testFilterEnabled
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Test
public void testFilterEnabled() {
OpenEntityManagerInViewFilter filter = this.applicationContext.getBean(OpenEntityManagerInViewFilter.class);
assertThat(filter).isNotNull();
}
示例12: testFilterDisabled
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Test(expected = NoSuchBeanDefinitionException.class)
public void testFilterDisabled() {
this.applicationContext.getBean(OpenEntityManagerInViewFilter.class);
}
示例13: openEntityManagerInViewFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Bean
public OpenEntityManagerInViewFilter openEntityManagerInViewFilter() {
return new OpenEntityManagerInViewFilter();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:AbstractJpaAutoConfigurationTests.java
示例14: buildOpenEntityManagerFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
private OpenEntityManagerInViewFilter buildOpenEntityManagerFilter() {
OpenEntityManagerInViewFilter openEntityManagerInViewFilter = new OpenEntityManagerInViewFilter();
openEntityManagerInViewFilter.setEntityManagerFactoryBeanName("entityManagerFactory");
return openEntityManagerInViewFilter;
}
示例15: openEntityManagerInViewFilter
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
/**
* Open entity manager in view filter.
*
* @return the open entity manager in view filter
*/
@Bean
public OpenEntityManagerInViewFilter openEntityManagerInViewFilter() {
return new OpenEntityManagerInViewFilter();
}