ChatApplicationInitializer.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2002-2016 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package sample.config;
  17. import org.springframework.web.filter.HiddenHttpMethodFilter;
  18. import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
  19. import javax.servlet.Filter;
  20. import javax.servlet.ServletRegistration;
  21. public class ChatApplicationInitializer extends
  22. AbstractAnnotationConfigDispatcherServletInitializer {
  23. @Override
  24. protected Class<?>[] getRootConfigClasses() {
  25. // TODO Auto-generated method stub
  26. return null;
  27. }
  28. @Override
  29. protected Class<?>[] getServletConfigClasses() {
  30. return new Class[] { WebMvcConfiguration.class };
  31. }
  32. @Override
  33. protected String[] getServletMappings() {
  34. return new String[] { "/" };
  35. }
  36. @Override
  37. protected Filter[] getServletFilters() {
  38. return new Filter[] { new HiddenHttpMethodFilter() };
  39. }
  40. @Override
  41. protected void customizeRegistration(ServletRegistration.Dynamic registration) {
  42. registration.setInitParameter("dispatchOptionsRequest", "true");
  43. }
  44. }