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


Java HiddenHttpMethodFilter类代码示例

本文整理汇总了Java中org.springframework.web.filter.HiddenHttpMethodFilter的典型用法代码示例。如果您正苦于以下问题:Java HiddenHttpMethodFilter类的具体用法?Java HiddenHttpMethodFilter怎么用?Java HiddenHttpMethodFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HiddenHttpMethodFilter类属于org.springframework.web.filter包,在下文中一共展示了HiddenHttpMethodFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDispatcherContext

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
private void addDispatcherContext(ServletContext container) {
	// Create the dispatcher servlet's Spring application context
	AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
	dispatcherContext.register(SpringDispatcherConfig.class);

	// Declare <servlet> and <servlet-mapping> for the DispatcherServlet
	ServletRegistration.Dynamic dispatcher = container.addServlet("ch03-servlet",
			new DispatcherServlet(dispatcherContext));
	dispatcher.addMapping("*.html");
	dispatcher.setLoadOnStartup(1);

	FilterRegistration.Dynamic corsFilter = container.addFilter("corsFilter", new CorsFilter());
	corsFilter.setInitParameter("cors.allowed.methods", "GET, POST, HEAD, OPTIONS, PUT, DELETE");
	corsFilter.addMappingForUrlPatterns(null, true, "/*");

	FilterRegistration.Dynamic filter = container.addFilter("hiddenmethodfilter", new HiddenHttpMethodFilter());
	filter.addMappingForServletNames(null, true, "/*");

	FilterRegistration.Dynamic multipartFilter = container.addFilter("multipartFilter", new MultipartFilter());
	multipartFilter.addMappingForUrlPatterns(null, true, "/*");

}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:23,代码来源:SpringWebInitializer.java

示例2: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters(){
    // создание фильтра кодировки, который позволит работать с русскими символами
    CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    characterEncodingFilter.setEncoding("UTF-8");
    characterEncodingFilter.setForceEncoding(true);

    // создание фильтра, который добавляет поддержку  HTTP методов(например,таких как PUT)
    HiddenHttpMethodFilter httpMethodFilter = new HiddenHttpMethodFilter();
    return new Filter[]{characterEncodingFilter, httpMethodFilter};
}
 
开发者ID:biblelamp,项目名称:JavaEE,代码行数:12,代码来源:WebInitializer.java

示例3: onServletContextStartup

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
public void onServletContextStartup(ServletContext servletContext) throws ServletException {
		//encodingFilter
		registeredEncodingFilter(servletContext, CharacterEncodingFilter.class);
		//hiddenHttpMethodFilter 
		registeredHiddenMethodFilter(servletContext, HiddenHttpMethodFilter.class);
		
		//multipartFilter
		registeredMultipartFilter(servletContext, SpringMultipartFilterProxy.class);

		//systemFilter
		registeredInitFilter(servletContext, BaseInitFilter.class);

		//ajaxAnywhere 
//		registeredAjaxAnywhere(servletContext, AAFilter.class);
		
	}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:17,代码来源:CommonWebFilterInitializer.java

示例4: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
    CharacterEncodingFilter filter1 = new CharacterEncodingFilter();
    filter1.setEncoding("utf-8");
    filter1.setForceEncoding(true);

    HttpPutFormContentFilter filter2 = new HttpPutFormContentFilter();
    HiddenHttpMethodFilter filter3 = new HiddenHttpMethodFilter();

    LOG.info("Adding filter to dispatcher servlet[CharacterEncodingFilter,HttpPutFormContentFilter,HiddenHttpMethodFilter]");
    return new Filter[]{filter1, filter2, filter3};
}
 
开发者ID:cyanqueen,项目名称:backbone,代码行数:13,代码来源:ApplicationInitializer.java

示例5: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
	return new Filter[] {
			new HiddenHttpMethodFilter(),
			new DelegatingFilterProxy("a"),
			new DelegatingFilterProxy("b"),
			new DelegatingFilterProxy("c")
	};
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AnnotationConfigDispatcherServletInitializerTests.java

示例6: filterIsOrderedHighest

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Test
public void filterIsOrderedHighest() throws Exception {
	load(OrderedConfiguration.class);
	List<Filter> beans = new ArrayList<Filter>(
			this.context.getBeansOfType(Filter.class).values());
	AnnotationAwareOrderComparator.sort(beans);
	assertThat(beans.get(0)).isInstanceOf(CharacterEncodingFilter.class);
	assertThat(beans.get(1)).isInstanceOf(HiddenHttpMethodFilter.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:HttpEncodingAutoConfigurationTests.java

示例7: initHiddenHttpMethodFilter

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
/**
 * <p>默认关闭<p>
 * 加载HiddenHttpMethodFilter用于支持  HTTP PUT、DELETE(post模拟 put/delete)
 * 在这处理过程中 HttpServletRequest对象需要修改 故此过滤器放置位置需要靠前(放在过滤字符之后)
 * @param servletContext
 * @see HiddenHttpMethodFilter
 */
protected void initHiddenHttpMethodFilter(ServletContext servletContext){
	String enableHiddenHttpMethod  = servletContext.getInitParameter("enableHiddenHttpMethod");
	if(BooleanUtils.valueOf(enableHiddenHttpMethod)){
		//HiddenHttpMethodFilter  
		HiddenHttpMethodFilter hiddenHttpMethodFilter =  new HiddenHttpMethodFilter();
		
		FilterRegistration filterRegistration =  servletContext.addFilter("hiddenHttpMethodFilter", hiddenHttpMethodFilter);
		
		filterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "/*");
	}
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:19,代码来源:SpringWebApplicationInitializer.java

示例8: filterIsOrderedHighest

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Test
public void filterIsOrderedHighest() throws Exception {
	load(OrderedConfiguration.class);
	List<Filter> beans = new ArrayList<Filter>(
			this.context.getBeansOfType(Filter.class).values());
	AnnotationAwareOrderComparator.sort(beans);
	assertThat(beans.get(0), instanceOf(CharacterEncodingFilter.class));
	assertThat(beans.get(1), instanceOf(HiddenHttpMethodFilter.class));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:10,代码来源:HttpEncodingAutoConfigurationTests.java

示例9: hiddenHttpMethodFilter

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
	OrderedHiddenHttpMethodFilter filter = new OrderedHiddenHttpMethodFilter();
	filter.setMethodParam("_disable_spring_mvc_hidden_method_for_fucking_zuul");
	return filter;
}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:8,代码来源:ExtZuulContextConfig.java

示例10: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
    CharacterEncodingFilter charFilter = new CharacterEncodingFilter();
    charFilter.setEncoding("UTF-8");
    charFilter.setForceEncoding(true);
    return new Filter[] { new HiddenHttpMethodFilter(), charFilter, new HttpPutFormContentFilter() };
}
 
开发者ID:momega,项目名称:spacesimulator2,代码行数:8,代码来源:WebAppConfig.java

示例11: initializeWebApplication

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
/**
 * Web Application.
 * 
 * @param container
 *      {@code ServletContext}. Representation of the context that is serving
 *      the JEE application. Servlets, filters and listeners are registered
 *      via this interface.
 */
private void initializeWebApplication(ServletContext container)
{
    AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
    dispatcherContext.register(WebConfig.class);

    DispatcherServlet webDispatcher = new DispatcherServlet(dispatcherContext);
    ServletRegistration.Dynamic servletReg = container.addServlet(dispatcherWebName, webDispatcher);
    servletReg.setLoadOnStartup(1);
    servletReg.addMapping(URL_PATTERN_WEB);

    HiddenHttpMethodFilter filter = new HiddenHttpMethodFilter();
    FilterRegistration.Dynamic filterReg = container.addFilter("Hidden HTTP Method Filter", filter);
    filterReg.addMappingForServletNames(EnumSet.of(DispatcherType.REQUEST), true, dispatcherWebName);
}
 
开发者ID:ThiagoUriel,项目名称:spring-agora-web,代码行数:23,代码来源:AppInitializer.java

示例12: createFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
protected void createFilters(ServletContext ctx) {
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setEncoding("UTF-8");

        SimpleCORSFilter corsFilter = new SimpleCORSFilter();
        corsFilter.setCorsAllowCredentials("true");
        corsFilter.setCorsAllowMethods("GET, POST, PUT, PATCH, DELETE, OPTIONS");
        corsFilter.setCorsAllowHeaders("content-type, x-requested-with, origin, accept, authorization, username, password, x-app-type, x-app-version, x-auth-token, soapaction");
        corsFilter.setCorsExposeHeaders("content-type, cookie, x-requested-with, origin, accept, username, password, x-app-type, x-app-version, x-auth-token, soapaction");
        corsFilter.setCorsMaxAge("3600");

        ctx.addFilter("springSessionRepositoryFilter", DelegatingFilterProxy.class).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("simpleCORSFilter", DelegatingFilterProxy.class).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
//        ctx.addFilter("SimpleCorsFilter", corsFilter).addMappingForUrlPatterns(
//                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("JsonHttpRequestFilter", new JsonHttpRequestFilter()).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, "/api/authenticate");
        ctx.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("CharacterEncodingFilter", characterEncodingFilter).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("HiddenHttpMethodFilter", new HiddenHttpMethodFilter()).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("HttpPutFormContentFilter", new HttpPutFormContentFilter()).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);
        ctx.addFilter("ShallowEtagHeaderFilter", new ShallowEtagHeaderFilter()).addMappingForUrlPatterns(
                EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, FILTER_MAPPING);

    }
 
开发者ID:bjornharvold,项目名称:bearchoke,代码行数:32,代码来源:AbstractWebApplicationInitializer.java

示例13: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
    CharacterEncodingFilter charFilter = new CharacterEncodingFilter();
    charFilter.setEncoding("UTF-8");
    charFilter.setForceEncoding(true);
    return new Filter[] { new HiddenHttpMethodFilter(), charFilter,
        new HttpPutFormContentFilter() };
}
 
开发者ID:momega,项目名称:spacesimulator,代码行数:9,代码来源:WebApp.java

示例14: getServletFilters

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
	HiddenHttpMethodFilter httpMethodFilter = new HiddenHttpMethodFilter();

	CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
	encodingFilter.setEncoding("UTF-8");
	encodingFilter.setForceEncoding(true);

	return new Filter[] { httpMethodFilter, encodingFilter };
}
 
开发者ID:hantsy,项目名称:spring4-sandbox,代码行数:11,代码来源:AppInitializer.java

示例15: onStartup

import org.springframework.web.filter.HiddenHttpMethodFilter; //导入依赖的package包/类
@Override
public void onStartup(final ServletContext container) throws ServletException {
    // Create the root Spring application context
    final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(RootConfig.class);

    // Manage the lifecycle of the root application context
    final ContextLoaderListener contextLoaderListener = new ContextLoaderListener(rootContext);
    container.addListener(contextLoaderListener);

    // Create the dispatcher servlet's Spring application context
    final AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
    dispatcherContext.register(DispatcherConfig.class);

    // Register and map the dispatcher servlet
    final Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));
    dispatcher.setLoadOnStartup(1);

    // Make the dispatcher the default servlet (using "/" as per the Servlet 3.0 specification)
    dispatcher.addMapping("/");

    // Enables support for DELETE and PUT request methods with web browsers
    container.addFilter("hiddenHttpMethodFilter", HiddenHttpMethodFilter.class).addMappingForUrlPatterns(null,
                                                                                                         false,
                                                                                                         "/*");

    // Add Spring Security support
    container.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class).addMappingForUrlPatterns(null,
                                                                                                           false,
                                                                                                           "/*");
}
 
开发者ID:jegbjerg,项目名称:webapp-base,代码行数:32,代码来源:ServletConfig.java


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