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.

HttpServletRequestListener.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2011 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * 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, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.server;
  17. import java.io.Serializable;
  18. import javax.servlet.Filter;
  19. import javax.servlet.http.Cookie;
  20. import javax.servlet.http.HttpServletRequest;
  21. import javax.servlet.http.HttpServletResponse;
  22. import com.vaadin.Application;
  23. import com.vaadin.service.ApplicationContext.TransactionListener;
  24. /**
  25. * {@link Application} that implements this interface gets notified of request
  26. * start and end by terminal.
  27. * <p>
  28. * Interface can be used for several helper tasks including:
  29. * <ul>
  30. * <li>Opening and closing database connections
  31. * <li>Implementing {@link ThreadLocal}
  32. * <li>Setting/Getting {@link Cookie}
  33. * </ul>
  34. * <p>
  35. * Alternatives for implementing similar features are are Servlet {@link Filter}
  36. * s and {@link TransactionListener}s in Vaadin.
  37. *
  38. * @since 6.2
  39. * @see PortletRequestListener
  40. */
  41. public interface HttpServletRequestListener extends Serializable {
  42. /**
  43. * This method is called before {@link Terminal} applies the request to
  44. * Application.
  45. *
  46. * @param request
  47. * @param response
  48. */
  49. public void onRequestStart(HttpServletRequest request,
  50. HttpServletResponse response);
  51. /**
  52. * This method is called at the end of each request.
  53. *
  54. * @param request
  55. * @param response
  56. */
  57. public void onRequestEnd(HttpServletRequest request,
  58. HttpServletResponse response);
  59. }