当前位置: 首页>>代码示例>>Java>>正文


Java OpenEntityManagerInViewFilter类代码示例

本文整理汇总了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;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:RestTestUtils.java

示例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));
}
 
开发者ID:leosilvadev,项目名称:SJPAReference,代码行数:18,代码来源:ApplicationInitializer.java

示例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);
}
 
开发者ID:qatang,项目名称:ctm,代码行数:18,代码来源:WebInitializer.java

示例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, "/*");
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:13,代码来源:RestServerTestResource.java

示例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,
            "/*");
}
 
开发者ID:webanno,项目名称:webanno,代码行数:16,代码来源:WebAnnoWebInitializer.java

示例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;
}
 
开发者ID:lumenrobot,项目名称:lumen,代码行数:8,代码来源:WicketConfig.java

示例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);
}
 
开发者ID:ThiagoUriel,项目名称:spring-agora-web,代码行数:8,代码来源:AppInitializer.java

示例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()
    };
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:11,代码来源:DispatcherServletInitializer.java

示例10: openEntityManagerInViewFilter

import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public OpenEntityManagerInViewFilter openEntityManagerInViewFilter() {
	return new OpenEntityManagerInViewFilter();
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:6,代码来源:JpaWebAutoConfiguration.java

示例11: testFilterEnabled

import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Test
public void testFilterEnabled() {
	OpenEntityManagerInViewFilter filter = this.applicationContext.getBean(OpenEntityManagerInViewFilter.class);

	assertThat(filter).isNotNull();
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:7,代码来源:JpaWebAutoConfigurationTest.java

示例12: testFilterDisabled

import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter; //导入依赖的package包/类
@Test(expected = NoSuchBeanDefinitionException.class)
public void testFilterDisabled() {
	this.applicationContext.getBean(OpenEntityManagerInViewFilter.class);
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:5,代码来源:JpaWebAutoConfigurationDisabledTest.java

示例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;
}
 
开发者ID:leosilvadev,项目名称:simplebank,代码行数:6,代码来源:Application.java

示例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();
}
 
开发者ID:pablogrela,项目名称:members_cuacfm,代码行数:10,代码来源:WebMvcConfig.java


注:本文中的org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。