Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Transport.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.shared.ui.ui;
  17. /**
  18. * Transport modes for Push
  19. *
  20. * @since 7.1
  21. * @author Vaadin Ltd
  22. */
  23. public enum Transport {
  24. /**
  25. * Websockets
  26. */
  27. WEBSOCKET("websocket"),
  28. /**
  29. * Websockets for server to client, XHR for client to server
  30. *
  31. * @since 7.6
  32. */
  33. WEBSOCKET_XHR("websocket-xhr"),
  34. /**
  35. * HTTP streaming
  36. *
  37. * @deprecated Use the more reliable {@link Transport#LONG_POLLING} instead.
  38. */
  39. @Deprecated
  40. STREAMING("streaming"),
  41. /**
  42. * HTTP long polling
  43. */
  44. LONG_POLLING("long-polling");
  45. private String identifier;
  46. private Transport(String identifier) {
  47. this.identifier = identifier;
  48. }
  49. public String getIdentifier() {
  50. return identifier;
  51. }
  52. /**
  53. * Returns a Transport by its identifier. Returns null if no value is found
  54. * for the given identifier.
  55. *
  56. * @since 7.3.10
  57. */
  58. public static Transport getByIdentifier(String identifier) {
  59. for (Transport t : values()) {
  60. if (t.getIdentifier().equals(identifier)) {
  61. return t;
  62. }
  63. }
  64. return null;
  65. }
  66. }