1 11 package org.eclipse.help.internal.webapp.data; 12 13 import javax.servlet.*; 14 import javax.servlet.http.*; 15 16 import org.eclipse.help.internal.base.*; 17 18 21 public class RequestData { 22 public final static int MODE_WORKBENCH = BaseHelpSystem.MODE_WORKBENCH; 23 public final static int MODE_INFOCENTER = BaseHelpSystem.MODE_INFOCENTER; 24 public final static int MODE_STANDALONE = BaseHelpSystem.MODE_STANDALONE; 25 26 protected ServletContext context; 27 protected HttpServletRequest request; 28 protected HttpServletResponse response; 29 protected String locale; 30 protected WebappPreferences preferences; 31 protected boolean advancedUI; 32 38 public RequestData(ServletContext context, HttpServletRequest request, 39 HttpServletResponse response) { 40 this.context = context; 41 this.request = request; 42 this.response = response; 43 preferences = new WebappPreferences(); 44 45 locale = UrlUtil.getLocale(request, response); 46 String agent = request.getHeader("User-Agent"); advancedUI = UrlUtil.isAdvanced(agent); 48 } 49 50 53 public WebappPreferences getPrefs() { 54 return preferences; 55 } 56 57 public boolean isBot() { 58 return UrlUtil.isBot(request); 59 } 60 61 public boolean isGecko() { 62 return UrlUtil.isGecko(request); 63 } 64 65 public boolean isIE() { 66 return UrlUtil.isIE(request); 67 } 68 69 public String getIEVersion() { 70 return UrlUtil.getIEVersion(request); 71 } 72 73 public boolean isKonqueror() { 74 return UrlUtil.isKonqueror(request); 75 } 76 77 public boolean isMozilla() { 78 return UrlUtil.isMozilla(request); 79 } 80 81 public String getMozillaVersion() { 82 return UrlUtil.getMozillaVersion(request); 83 } 84 85 public boolean isSafari() { 86 return UrlUtil.isSafari(request); 87 } 88 89 public String getSafariVersion() { 90 return UrlUtil.getSafariVersion(request); 91 } 92 93 public boolean isOpera() { 94 return UrlUtil.isOpera(request); 95 } 96 97 public String getLocale() { 98 return locale; 99 } 100 101 public int getMode() { 102 return BaseHelpSystem.getMode(); 103 } 104 public boolean isAdvancedUI() { 105 return advancedUI; 106 } 107 108 } 109 | Popular Tags |