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.

SessionInitEvent.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2000-2018 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.util.EventObject;
  18. /**
  19. * Event gets fired when a new Vaadin service session is initialized for a
  20. * Vaadin service.
  21. * <p>
  22. * Because of the way different service instances share the same session, the
  23. * event is not necessarily fired immediately when the session is created but
  24. * only when the first request for that session is handled by a specific
  25. * service.
  26. *
  27. * @see SessionInitListener#sessionInit(SessionInitEvent)
  28. *
  29. * @author Vaadin Ltd
  30. * @since 7.0.0
  31. */
  32. public class SessionInitEvent extends EventObject {
  33. private final VaadinSession session;
  34. private final VaadinRequest request;
  35. /**
  36. * Creates a new event.
  37. *
  38. * @param service
  39. * the Vaadin service from which the event originates
  40. * @param session
  41. * the Vaadin service session that has been initialized
  42. * @param request
  43. * the request that triggered the initialization
  44. */
  45. public SessionInitEvent(VaadinService service, VaadinSession session,
  46. VaadinRequest request) {
  47. super(service);
  48. this.session = session;
  49. this.request = request;
  50. }
  51. @Override
  52. public VaadinService getSource() {
  53. return (VaadinService) super.getSource();
  54. }
  55. /**
  56. * Gets the Vaadin service from which this event originates.
  57. *
  58. * @return the Vaadin service instance
  59. */
  60. public VaadinService getService() {
  61. return getSource();
  62. }
  63. /**
  64. * Gets the Vaadin service session that has been initialized.
  65. *
  66. * @return the Vaadin service session
  67. */
  68. public VaadinSession getSession() {
  69. return session;
  70. }
  71. /**
  72. * Gets the request that triggered the initialization.
  73. *
  74. * @return the request
  75. */
  76. public VaadinRequest getRequest() {
  77. return request;
  78. }
  79. }