Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestData.java')
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestData.java108
1 files changed, 108 insertions, 0 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestData.java
new file mode 100644
index 000000000..5fd825b31
--- /dev/null
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestData.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.help.internal.webapp.data;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.eclipse.help.internal.base.*;
+
+/**
+ * Helper class for contents.jsp initialization
+ */
+public class RequestData {
+ public final static int MODE_WORKBENCH = BaseHelpSystem.MODE_WORKBENCH;
+ public final static int MODE_INFOCENTER = BaseHelpSystem.MODE_INFOCENTER;
+ public final static int MODE_STANDALONE = BaseHelpSystem.MODE_STANDALONE;
+
+ protected ServletContext context;
+ protected HttpServletRequest request;
+ protected HttpServletResponse response;
+ protected String locale;
+ protected WebappPreferences preferences;
+ protected boolean advancedUI;
+ /**
+ * Constructs the data for a request.
+ *
+ * @param context
+ * @param request
+ */
+ public RequestData(ServletContext context, HttpServletRequest request,
+ HttpServletResponse response) {
+ this.context = context;
+ this.request = request;
+ this.response = response;
+ preferences = new WebappPreferences();
+
+ locale = UrlUtil.getLocale(request, response);
+ String agent = request.getHeader("User-Agent"); //$NON-NLS-1$
+ advancedUI = UrlUtil.isAdvanced(agent);
+ }
+
+ /**
+ * Returns the preferences object
+ */
+ public WebappPreferences getPrefs() {
+ return preferences;
+ }
+
+ public boolean isBot() {
+ return UrlUtil.isBot(request);
+ }
+
+ public boolean isGecko() {
+ return UrlUtil.isGecko(request);
+ }
+
+ public boolean isIE() {
+ return UrlUtil.isIE(request);
+ }
+
+ public String getIEVersion() {
+ return UrlUtil.getIEVersion(request);
+ }
+
+ public boolean isKonqueror() {
+ return UrlUtil.isKonqueror(request);
+ }
+
+ public boolean isMozilla() {
+ return UrlUtil.isMozilla(request);
+ }
+
+ public String getMozillaVersion() {
+ return UrlUtil.getMozillaVersion(request);
+ }
+
+ public boolean isSafari() {
+ return UrlUtil.isSafari(request);
+ }
+
+ public String getSafariVersion() {
+ return UrlUtil.getSafariVersion(request);
+ }
+
+ public boolean isOpera() {
+ return UrlUtil.isOpera(request);
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public int getMode() {
+ return BaseHelpSystem.getMode();
+ }
+ public boolean isAdvancedUI() {
+ return advancedUI;
+ }
+
+}

Back to the top