Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) SiteWhere, LLC. All rights reserved. http://www.sitewhere.com
  *
  * The software in this package is published under the terms of the CPAL v1.0
  * license, a copy of which has been included with this distribution in the
  * LICENSE.txt file.
  */
 package com.sitewhere.web;
 
Allows HTTP method to be override based on a header.

Author(s):
Derek Adams
public class MethodOverrideFilter extends OncePerRequestFilter {
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.web.filter.OncePerRequestFilter#doFilterInternal(
	 * javax.servlet.http.HttpServletRequest,
	 * javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)
	 */
	protected void doFilterInternal(HttpServletRequest request,
			HttpServletResponse responseFilterChain filterChain)
		String method = request.getHeader("X-HTTP-Method-Override");
		if (method != null) {
					method);
			filterChain.doFilter(wrapperresponse);
else {
			filterChain.doFilter(requestresponse);
		}
	}

Allows http method to be overriden.

Author(s):
Derek Adams
	private static class HttpMethodRequestWrapper extends
		private final String method;
				String method) {
			super(request);
			this. = method;
		}
		/*
		 * (non-Javadoc)
		 * 
		 * @see javax.servlet.http.HttpServletRequestWrapper#getMethod()
		 */
		public String getMethod() {
			return this.;
		}
	}
New to GrepCode? Check out our FAQ X