001
014
015 package com.liferay.portal.kernel.servlet;
016
017 import javax.servlet.ServletContext;
018 import javax.servlet.http.Cookie;
019
020
024 public class ServletVersionDetector {
025
026 public static boolean is2_5() {
027 if (_2_5 != null) {
028 return _2_5.booleanValue();
029 }
030
031 try {
032 ServletContext.class.getMethod("getContextPath");
033
034 _2_5 = Boolean.TRUE;
035 }
036 catch (Exception e) {
037 _2_5 = Boolean.FALSE;
038 }
039
040 return _2_5.booleanValue();
041 }
042
043 public static boolean is3_0() {
044 if (_3_0 != null) {
045 return _3_0.booleanValue();
046 }
047
048 try {
049 Cookie.class.getMethod("isHttpOnly");
050
051 _3_0 = Boolean.TRUE;
052 }
053 catch (Exception e) {
054 _3_0 = Boolean.FALSE;
055 }
056
057 return _3_0.booleanValue();
058 }
059
060 private static Boolean _2_5;
061 private static Boolean _3_0;
062
063 }