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.

RequestHandler.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2000-2014 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.IOException;
  18. import java.io.Serializable;
  19. import com.vaadin.ui.UI;
  20. /**
  21. * Handler for producing a response to HTTP requests. Handlers can be either
  22. * added on a {@link VaadinService service} level, common for all users, or on a
  23. * {@link VaadinSession session} level for only a single user.
  24. */
  25. public interface RequestHandler extends Serializable {
  26. /**
  27. * Called when a request needs to be handled. If a response is written, this
  28. * method should return <code>true</code> to indicate that no more request
  29. * handlers should be invoked for the request.
  30. * <p>
  31. * Note that request handlers by default do not lock the session. If you are
  32. * using VaadinSession or anything inside the VaadinSession you must ensure
  33. * the session is locked. This can be done by extending
  34. * {@link SynchronizedRequestHandler} or by using
  35. * {@link VaadinSession#accessSynchronously(Runnable)} or
  36. * {@link UI#accessSynchronously(Runnable)}.
  37. * </p>
  38. *
  39. * @param session
  40. * The session for the request
  41. * @param request
  42. * The request to handle
  43. * @param response
  44. * The response object to which a response can be written.
  45. * @return true if a response has been written and no further request
  46. * handlers should be called, otherwise false
  47. * @throws IOException
  48. * If an IO error occurred
  49. */
  50. boolean handleRequest(VaadinSession session, VaadinRequest request,
  51. VaadinResponse response) throws IOException;
  52. }