You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NoParameterFilterConfig.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (C) 2009-2010, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.http.server.glue;
  11. import java.util.Enumeration;
  12. import java.util.NoSuchElementException;
  13. import javax.servlet.FilterConfig;
  14. import javax.servlet.ServletContext;
  15. final class NoParameterFilterConfig implements FilterConfig {
  16. private final String filterName;
  17. private final ServletContext context;
  18. NoParameterFilterConfig(String filterName, ServletContext context) {
  19. this.filterName = filterName;
  20. this.context = context;
  21. }
  22. /** {@inheritDoc} */
  23. @Override
  24. public String getInitParameter(String name) {
  25. return null;
  26. }
  27. /** {@inheritDoc} */
  28. @Override
  29. public Enumeration<String> getInitParameterNames() {
  30. return new Enumeration<String>() {
  31. @Override
  32. public boolean hasMoreElements() {
  33. return false;
  34. }
  35. @Override
  36. public String nextElement() {
  37. throw new NoSuchElementException();
  38. }
  39. };
  40. }
  41. /** {@inheritDoc} */
  42. @Override
  43. public ServletContext getServletContext() {
  44. return context;
  45. }
  46. /** {@inheritDoc} */
  47. @Override
  48. public String getFilterName() {
  49. return filterName;
  50. }
  51. }