Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158598 Details for
Bug 302274
Remove browser detection from RWT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
clipboard.txt (text/plain), 165.99 KB, created by
RĂ¼diger Herrmann
on 2010-02-09 10:21:23 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
RĂ¼diger Herrmann
Created:
2010-02-09 10:21:23 EST
Size:
165.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 ResourceManagerImpl.java >--- src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java 29 Oct 2009 17:05:38 -0000 1.12 >+++ src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java 9 Feb 2010 15:18:17 -0000 >@@ -295,7 +295,6 @@ > ParamCheck.notNull( name, "name" ); > String key = createKey( name ); > String fileName = ( String )repository.get( key ); >- Assert.isNotNull( fileName, "No resource registered for key " + name ); > return createRequestURL( fileName, findVersion( name ) ); > } > >Index: src/org/eclipse/rwt/internal/engine/RWTServletContextListener.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/engine/RWTServletContextListener.java,v >retrieving revision 1.18 >diff -u -r1.18 RWTServletContextListener.java >--- src/org/eclipse/rwt/internal/engine/RWTServletContextListener.java 21 Jan 2010 16:09:47 -0000 1.18 >+++ src/org/eclipse/rwt/internal/engine/RWTServletContextListener.java 9 Feb 2010 15:18:17 -0000 >@@ -79,7 +79,7 @@ > registerResources( evt.getServletContext() ); > registerUICallBackServiceHandler(); > registerJSLibraryServiceHandler(); >- BrowserSurvey.configurer = new RWTStartupPageConfigurer(); >+ StartupPage.configurer = new RWTStartupPageConfigurer(); > ResourceUtil.startJsConcatenation(); > } > >Index: src/org/eclipse/rwt/internal/browser/Ie5_5up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie5_5up.java >diff -N src/org/eclipse/rwt/internal/browser/Ie5_5up.java >--- src/org/eclipse/rwt/internal/browser/Ie5_5up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>the implementation for Microsoft Internet Explorer 5.5 and higher.</p> >- */ >-public class Ie5_5up extends Ie5up { >- >- public Ie5_5up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie5_5up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie5_5up( final Browser browser ) { >- super( browser ); >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/browser/DetectorSafari.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorSafari.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorSafari.java >--- src/org/eclipse/rwt/internal/browser/DetectorSafari.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,33 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-/** >- * <p>The Safari Browser Detection Class</p> >- */ >-// TODO [rh] distinguish Safari versions: >-// return class Safari for version < 2 and class Safari2 for V2.0 and later >-public class DetectorSafari extends DetectorBase { >- >- private final static String idString = "safari"; >- >- public DetectorSafari() { >- super(); >- } >- >- public boolean knowsBrowserString( final String userAgent ) { >- return contains( userAgent, idString ); >- } >- >- public String getBrowserClassName( final String userAgent ) { >- return BROWSER_PACKAGE + "Safari2"; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Default.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Default.java >diff -N src/org/eclipse/rwt/internal/browser/Default.java >--- src/org/eclipse/rwt/internal/browser/Default.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** <p>A default implementation for the org.eclipse.rap.Browser class. Subclasses of >- * Browser represent vendor-specific and version-specific >- * information about the web browser that is used on the client side to >- * display the pages from the current session.</p> >- */ >-public class Default extends Browser { >- >- public Default( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Default( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Default( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/DetectorMozilla.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorMozilla.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorMozilla.java >--- src/org/eclipse/rwt/internal/browser/DetectorMozilla.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,44 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-/** >- * <p>The Mozilla Browser Detection Class</p> >- */ >-public class DetectorMozilla extends DetectorBase { >- >- public boolean knowsBrowserString( final String userAgent ) { >- // tricky: all browser contain mozilla string, so >- // we have to make sure it is no other browser >- return contains( userAgent, "mozilla/5.0" ) >- && contains( userAgent, "gecko" ) >- && !contains( userAgent, "mozilla/4" ) >- && !contains( userAgent, "konqueror" ) >- && !contains( userAgent, "msie" ) >- && !contains( userAgent, "safari" ); >- } >- >- public String getBrowserClassName( final String userAgent ) { >- return BROWSER_PACKAGE + "Mozilla" + getBrowserVersion( userAgent ); >- } >- >- public String getBrowserVersion( final String userAgent ) { >- String result = "1_6"; >- if( contains( userAgent, "rv:1.7" ) ) { >- result = "1_7"; >- } else if( contains( userAgent, "rv:1.8" ) ) { >- result = "1_7"; >- } else if( contains( userAgent, "rv:1.9" ) ) { >- result = "1_7"; >- } >- return result; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/BrowserDetector.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/BrowserDetector.java >diff -N src/org/eclipse/rwt/internal/browser/BrowserDetector.java >--- src/org/eclipse/rwt/internal/browser/BrowserDetector.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,180 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-import java.io.IOException; >-import java.io.InputStream; >-import java.net.URL; >-import java.net.URLConnection; >-import java.util.*; >- >-import javax.xml.parsers.*; >- >-import org.eclipse.rwt.internal.resources.ResourceManagerImpl; >-import org.eclipse.rwt.resources.IResourceManager; >-import org.w3c.dom.*; >-import org.xml.sax.SAXException; >- >- >-/** >- * <p>The singleton class that parses browser vendor, version info and >- * and os info of a given userAgent http header string. >- * </p> >- * <p>This class is not inteded to be used by clients.</p> >- */ >-public class BrowserDetector { >- >- private static final String BROWSERDETECTION_XML = "browserdetection.xml"; >- private static final String CLASSNAME_ELEMENT = "classname"; >- private static final String BROWSER_ELEMENT = "browser"; >- >- private static BrowserDetector _instance; >- >- private final List browserDetectors; >- >- private BrowserDetector() { >- browserDetectors = new ArrayList(); >- loadBrowserDetectors(); >- } >- >- /** >- * <p>Returns the singleton instance of the <code>BrowserDetector</code>.</p> >- */ >- public static synchronized BrowserDetector getInstance() { >- if( _instance == null ) { >- _instance = new BrowserDetector(); >- } >- return _instance; >- } >- >- /** >- * <p>Detects browser by parsing the userAgent string and returns the >- * class name of the matching <code>Browser</code> class.</p> >- */ >- public String getBrowserClassName( final String userAgent ) { >- return detectBrowser( userAgent ); >- } >- >- public String getBrowserOSName( final String userAgent ) { >- return DetectorBase.getBrowserOS( userAgent ); >- } >- >- private String detectBrowser( final String theUserAgent ) { >- String result = Default.class.getName(); >- if( theUserAgent != null ) { >- // all comparison is done in lower case >- String userAgent = theUserAgent.toLowerCase(); >- // set default in case no browser is found >- Object[] detectors = browserDetectors.toArray(); >- boolean detected = false; >- for( int i = 0; !detected && i < detectors.length; i++ ) { >- DetectorBase browserDetector = ( DetectorBase )detectors[ i ]; >- if( browserDetector.knowsBrowserString( userAgent ) ) { >- result = browserDetector.getBrowserClassName( userAgent ); >- detected = true; >- } >- } >- } >- return result; >- } >- >- private void loadBrowserDetectors() { >- try { >- // create a special URLLoader to avoid problems with other classloaders >- // that do not support getResources. >- IResourceManager manager = ResourceManagerImpl.getInstance(); >- Enumeration browserDetectionFiles; >- if( manager == null ) { >- ClassLoader loader = getClass().getClassLoader(); >- browserDetectionFiles = loader.getResources( BROWSERDETECTION_XML ); >- } else { >- browserDetectionFiles = manager.getResources( BROWSERDETECTION_XML ); >- } >- >- while( browserDetectionFiles.hasMoreElements() ) { >- int nextItem = 0; >- URL browserFile = ( URL )browserDetectionFiles.nextElement(); >- >- Document document = parseDocument( browserFile ); >- >- // extract list of browser definition (from current file) >- NodeList nodeList = document.getElementsByTagName( BROWSER_ELEMENT ); >- Node item = nodeList.item( nextItem ); >- >- // iterate over all browser definitions (in current file) >- while( item != null ) { >- // extract classname from current browser definition >- String detectorClassName = findElementValue( item, CLASSNAME_ELEMENT ); >- // create instance of the detector and store it in >- // list of browser detectors. >- Object detectorInstance >- = Class.forName( detectorClassName ).newInstance(); >- DetectorBase browserDetector = ( DetectorBase )detectorInstance; >- browserDetectors.add( browserDetector ); >- nextItem++; >- item = nodeList.item( nextItem ); >- } // while (item != null ) >- } // while (browserDetectionFiles.hasMoreElements() ) >- } catch( final Throwable thr ) { >- // too many different exceptions may occur to handle each, >- // so if something goes wrong just throw an illegal state exception >- StringBuffer msg = new StringBuffer(); >- msg.append( new Date() ); >- msg.append( " BROWSERDETECTOR error: " ); >- msg.append( "Unable to load browserdetection classes (caused by " ); >- msg.append( thr.getClass().getName() ); >- msg.append( " with message: " ); >- msg.append( thr.getMessage() ); >- msg.append( ")." ); >- System.out.println( msg ); >- thr.printStackTrace(); >- // TODO [rh] An exception thrown from here never gets through (I think >- // due to the fact that it is called during class initialization) >- // REWORK THIS! >- } >- } >- >- ///////////////////////////////// >- // Helper methods for xml parsing >- >- private static String findElementValue( final Node rootNode, >- final String elementName ) >- { >- String result = null; >- if( rootNode instanceof Element ) { >- Element rootElement = ( Element )rootNode; >- NodeList foundElements = rootElement.getElementsByTagName( elementName ); >- Node firstNode = foundElements.item( 0 ); >- if( firstNode != null && firstNode instanceof Element ) { >- Element foundElement = ( Element )firstNode; >- result = foundElement.getFirstChild().getNodeValue().trim(); >- } >- } >- return result; >- } >- >- private static Document parseDocument( final URL browserFile ) >- throws IOException, ParserConfigurationException, SAXException >- { >- URLConnection con = browserFile.openConnection(); >- con.setUseCaches( false ); >- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); >- DocumentBuilder builder = factory.newDocumentBuilder(); >- Document result; >- InputStream is = con.getInputStream(); >- try { >- result = builder.parse( is ); >- } finally { >- is.close(); >- } >- return result; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Mozilla1_7up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Mozilla1_7up.java >diff -N src/org/eclipse/rwt/internal/browser/Mozilla1_7up.java >--- src/org/eclipse/rwt/internal/browser/Mozilla1_7up.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Mozilla 1.7 and higher. >- * </p> >- */ >-public class Mozilla1_7up extends Mozilla1_6up { >- >- public Mozilla1_7up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Mozilla1_7up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Mozilla1_7up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Opera.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Opera.java >diff -N src/org/eclipse/rwt/internal/browser/Opera.java >--- src/org/eclipse/rwt/internal/browser/Opera.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,29 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** <p>the basic implementation for Opera browsers.</p> >- */ >-public class Opera extends Default { >- >- public Opera( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Opera( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Opera( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_2.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_2.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_2.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_2.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2. >- * </p> >- */ >-public class Konqueror3_2 extends Konqueror3_1up { >- >- public Konqueror3_2( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_2( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_2( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Opera8.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Opera8.java >diff -N src/org/eclipse/rwt/internal/browser/Opera8.java >--- src/org/eclipse/rwt/internal/browser/Opera8.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>The implementation for Opera 8 and higher. No AJaX suppport.</p> >- */ >-public class Opera8 extends Opera { >- >- public Opera8( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Opera8( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, true ); >- } >- >- public Opera8( final Browser browser ) { >- super( browser ); >- } >- >- public boolean isXHTMLCapable() { >- return true; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Mozilla1_6up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Mozilla1_6up.java >diff -N src/org/eclipse/rwt/internal/browser/Mozilla1_6up.java >--- src/org/eclipse/rwt/internal/browser/Mozilla1_6up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Mozilla 1.6 and higher. >- * </p> >- */ >-public class Mozilla1_6up extends Mozilla { >- >- public Mozilla1_6up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Mozilla1_6up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Mozilla1_6up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_4.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_4.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_4.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_4.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2. >- * </p> >- */ >-public class Konqueror3_4 extends Konqueror3_3up { >- >- public Konqueror3_4( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_4( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_4( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/DetectorBase.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorBase.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorBase.java >--- src/org/eclipse/rwt/internal/browser/DetectorBase.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,69 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-/** >- * <p>DetectorBase defines the base methods needed for browser detection</p> >- */ >-public abstract class DetectorBase { >- >- public static final String OS_LINUX = "linux"; >- public static final String OS_WINDOWS = "win"; >- public static final String OS_MAC = "mac"; >- public static final String OS_UNIX = "unix"; >- public static final String OS_NONE = "none"; >- public static final String OS_X11 = "x11"; >- >- protected static final String BROWSER_PACKAGE >- = "org.eclipse.rwt.internal.browser."; >- >- /** >- * <p>Must return whether the given <code>userAgent</code> known by this >- * <code>DetectorBase</code> instance.</p> >- * @param userAgent - the user agent string in <strong>lowercase</strong> >- */ >- public abstract boolean knowsBrowserString( final String userAgent ); >- >- /** >- * <p>This method is only called when a former call to >- * <code>knowsBrowserString</code> returned <code>true</code>. >- * This method must then return the fully qualified class name of the >- * <code>Browser</code> class taht represents the given >- * <code>userAgent</code>. >- * @param userAgent - the user agent string in <strong>lowercase</strong> >- */ >- // TODO [rh] Is there any reason why class name is returned as string? >- public abstract String getBrowserClassName( final String userAgent ); >- >- public static String getBrowserOS( final String userAgent ) { >- String result; >- if( contains( userAgent, OS_LINUX ) ) { >- result = OS_LINUX; >- } else if( contains( userAgent, OS_X11 ) ) { >- result = OS_UNIX; >- } else if( contains( userAgent, OS_MAC ) ) { >- result = OS_MAC; >- } else if( contains( userAgent, OS_WINDOWS ) ) { >- result = OS_WINDOWS; >- } else { >- result = OS_NONE; >- } >- return result; >- } >- >- // helper method for string detection >- protected static boolean contains( final String fullString, >- final String searchString ) >- { >- return fullString.indexOf( searchString ) != -1; >- } >- >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_4up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_4up.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_4up.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_4up.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2. >- * </p> >- */ >-public class Konqueror3_4up extends Konqueror3_3up { >- >- public Konqueror3_4up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_4up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_4up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Opera9up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Opera9up.java >diff -N src/org/eclipse/rwt/internal/browser/Opera9up.java >--- src/org/eclipse/rwt/internal/browser/Opera9up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,29 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** <p>the implementation for Opera 7 and higher.</p> >- */ >-public class Opera9up extends Opera8up { >- >- public Opera9up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Opera9up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Opera9up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Safari2.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Safari2.java >diff -N src/org/eclipse/rwt/internal/browser/Safari2.java >--- src/org/eclipse/rwt/internal/browser/Safari2.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,31 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >- >-/** >- * <p>The browser class for Safari 2 browsers.</p> >- */ >-public class Safari2 extends Safari { >- >- public Safari2( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Safari2( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Safari2( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie5up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie5up.java >diff -N src/org/eclipse/rwt/internal/browser/Ie5up.java >--- src/org/eclipse/rwt/internal/browser/Ie5up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,35 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** <p>the implementation for Microsoft Internet Explorer 5 and higher.</p> >- */ >-public class Ie5up extends Ie { >- >- public Ie5up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- this.ajaxCapable = true; >- } >- >- public Ie5up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- this.ajaxCapable = true; >- } >- >- public Ie5up( final Browser browser ) { >- super( browser ); >- } >- >- public boolean isXHTMLCapable() { >- return true; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_1up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_1up.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_1up.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_1up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.1 and higher. >- * </p> >- */ >-public class Konqueror3_1up extends Konqueror { >- >- public Konqueror3_1up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_1up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_1up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Mozilla.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Mozilla.java >diff -N src/org/eclipse/rwt/internal/browser/Mozilla.java >--- src/org/eclipse/rwt/internal/browser/Mozilla.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,38 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the basic implementation for Mozilla browsers. >- * </p> >- */ >-public class Mozilla extends Default { >- >- public Mozilla( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- this.ajaxCapable = true; >- } >- >- public Mozilla( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- this.ajaxCapable = true; >- } >- >- public Mozilla( final Browser browser ) { >- super( browser ); >- } >- >- public boolean isXHTMLCapable() { >- return true; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie6up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie6up.java >diff -N src/org/eclipse/rwt/internal/browser/Ie6up.java >--- src/org/eclipse/rwt/internal/browser/Ie6up.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>the implementation for Microsoft Internet Explorer 6 and higher.</p> >- */ >-public class Ie6up extends Ie5_5up { >- >- public Ie6up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie6up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie6up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror.java >--- src/org/eclipse/rwt/internal/browser/Konqueror.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the basic implementation for Konqueror browsers. >- * </p> >- */ >-public class Konqueror extends Default { >- >- public Konqueror( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Mozilla1_6.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Mozilla1_6.java >diff -N src/org/eclipse/rwt/internal/browser/Mozilla1_6.java >--- src/org/eclipse/rwt/internal/browser/Mozilla1_6.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Mozilla 1.6. >- * </p> >- */ >-public class Mozilla1_6 extends Mozilla { >- >- public Mozilla1_6( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Mozilla1_6( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Mozilla1_6( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie6.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie6.java >diff -N src/org/eclipse/rwt/internal/browser/Ie6.java >--- src/org/eclipse/rwt/internal/browser/Ie6.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,31 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>The implementation for Microsoft Internet Explorer 6.</p> >- */ >-public class Ie6 extends Ie5_5up { >- >- public Ie6( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie6( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie6( final Browser browser ) { >- super( browser ); >- } >- >-} >Index: src/org/eclipse/rwt/internal/browser/DetectorKonqueror.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorKonqueror.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorKonqueror.java >--- src/org/eclipse/rwt/internal/browser/DetectorKonqueror.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,82 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-/** >- * The Konqueror Browser Detection Class >- */ >-public class DetectorKonqueror extends DetectorBase { >- >- private static final String VERSION_PREFIX = "konqueror/"; >- private final static String ID_KONQUEROR = "konqueror"; >- >- >- public DetectorKonqueror() { >- super(); >- } >- >- public boolean knowsBrowserString( final String userAgent ) { >- return contains( userAgent, ID_KONQUEROR ); >- } >- >- public String getBrowserName( final String userAgent ) { >- return "Konqueror"; >- } >- >- public String getBrowserClassName( final String userAgent ) { >- String result >- = BROWSER_PACKAGE >- + getBrowserName( userAgent ) >- + getBrowserVersion( userAgent ); >- return result; >- } >- >- public String getBrowserVersion( final String userAgent ) { >- String result = ""; >- int[] versions = getVersions( userAgent ); >- if( versions[ 0 ] == 3 ) { >- if( versions[ 1 ] == 1 ) { >- result = "3_1"; >- } else if( versions[ 1 ] == 2 ) { >- result = "3_2"; >- } else if( versions[ 1 ] == 3 ) { >- result = "3_3"; >- } else if( versions[ 1 ] >= 4 ) { >- result = "3_4"; >- } >- } >- return result; >- } >- >- private int[] getVersions( final String userAgent ) { >- int result[] = new int[]{ -1, -1 }; >- int startIndex = userAgent.indexOf( VERSION_PREFIX ); >- if( startIndex != -1 ) { >- int endIndex = userAgent.substring( startIndex ).indexOf( ";" ); >- if( endIndex != -1 ) { >- int absoluteStart = startIndex + VERSION_PREFIX.length(); >- int absoluteEnd = startIndex + endIndex; >- String version = userAgent.substring( absoluteStart, absoluteEnd ); >- String[] parts = version.split( "\\.", 2 ); >- if( parts.length == 2 ) { >- try { >- result[ 0 ] = Integer.parseInt( parts[ 0 ] ); >- result[ 1 ] = Integer.parseInt( parts[ 1 ] ); >- } catch( NumberFormatException e) { >- // ignore >- } >- } >- } >- } >- return result; >- } >- >-} >Index: src/org/eclipse/rwt/internal/browser/Mozilla1_7.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Mozilla1_7.java >diff -N src/org/eclipse/rwt/internal/browser/Mozilla1_7.java >--- src/org/eclipse/rwt/internal/browser/Mozilla1_7.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Mozilla 1.7. >- * </p> >- */ >-public class Mozilla1_7 extends Mozilla1_6up { >- >- public Mozilla1_7( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Mozilla1_7( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Mozilla1_7( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/DetectorIE.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorIE.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorIE.java >--- src/org/eclipse/rwt/internal/browser/DetectorIE.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,83 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-import java.text.NumberFormat; >- >-/** >- * <p>The Internet Explorer Browser Detection Class</p> >- */ >-public class DetectorIE extends DetectorBase { >- >- private final static String ID_OPERA = "opera"; >- private final static String ID_MSIE = "msie"; >- private final static String ID_MSIE5 = "msie 5"; >- private final static String ID_MSIE5_5 = "msie 5.5"; >- private final static String ID_MSIE6 = "msie 6"; >- private final static String ID_MSIE7 = "msie 7"; >- >- public boolean knowsBrowserString( final String userAgent ) { >- return !"".equals( getBrowserVersion( userAgent ) ); >- } >- >- public String getBrowserClassName( final String userAgent ) { >- return BROWSER_PACKAGE + "Ie" + getBrowserVersion( userAgent ); >- } >- >- public String getBrowserVersion( final String userAgent ) { >- String result = ""; >- if( contains( userAgent, ID_MSIE ) && !contains( userAgent, ID_OPERA ) ) { >- if( contains( userAgent, ID_MSIE5_5 ) ) { >- result = "5_5"; >- } else if( contains( userAgent, ID_MSIE5 ) ) { >- result = "5"; >- } else if( contains( userAgent, ID_MSIE6 ) ) { >- result = "6"; >- } else if( contains( userAgent, ID_MSIE7 ) ) { >- result = "7"; >- } else if( getMajor( userAgent ) > 6 ) { >- result = "7"; >- } >- } >- return result; >- } >- >- /** >- * helper method to extract the major release number >- */ >- private static int getMajor( final String userAgent ) { >- NumberFormat nf = NumberFormat.getInstance(); >- nf.setParseIntegerOnly( true ); >- int result = -1; >- try { >- String appVersion = parseAppVersion( userAgent ); >- int index = appVersion.indexOf( "." ); >- if( index != -1 ) { >- appVersion = appVersion.substring( 0, index ); >- } >- result = nf.parse( appVersion ).intValue(); >- } catch( Exception ex ) { >- // ignore - can't determine major version number >- } >- return result; >- } >- >- /** >- * helper method to parse the userAgent String and extract the appVersion >- */ >- private static String parseAppVersion( final String userAgent ) { >- String result = ""; >- int index = userAgent.indexOf( ID_MSIE ); >- int start = index + ID_MSIE.length() + 1; >- result = userAgent.substring( start, start + 3 ); >- return result; >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/browser/DetectorOpera.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/DetectorOpera.java >diff -N src/org/eclipse/rwt/internal/browser/DetectorOpera.java >--- src/org/eclipse/rwt/internal/browser/DetectorOpera.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,42 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-/** >- * <p>The Opera Browser Detection Class</p> >- */ >-public class DetectorOpera extends DetectorBase { >- >- private final static String ID_OPERA = "opera"; >- >- public boolean knowsBrowserString( final String userAgent ) { >- return !"".equals( getBrowserVersion( userAgent ) ); >- } >- >- public String getBrowserClassName( final String userAgent ) { >- return BROWSER_PACKAGE + "Opera" + getBrowserVersion( userAgent ); >- } >- >- public String getBrowserVersion( final String userAgent ) { >- String result = ""; >- if( contains( userAgent, ID_OPERA ) ) { >- if( contains( userAgent, "opera 8" ) || contains( userAgent, "opera/8" ) ) >- { >- result = "8"; >- } else if( contains( userAgent, "opera 9" ) >- || contains( userAgent, "opera/9" ) ) >- { >- result = "9"; >- } >- } >- return result; >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/browser/Ie5_5.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie5_5.java >diff -N src/org/eclipse/rwt/internal/browser/Ie5_5.java >--- src/org/eclipse/rwt/internal/browser/Ie5_5.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>The implementation for Microsoft Internet Explorer 5.5.</p> >- */ >-public class Ie5_5 extends Ie5up { >- >- public Ie5_5( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie5_5( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie5_5( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_3.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_3.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_3.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_3.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2. >- * </p> >- */ >-public class Konqueror3_3 extends Konqueror3_2up { >- >- public Konqueror3_3( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_3( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_3( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie7.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie7.java >diff -N src/org/eclipse/rwt/internal/browser/Ie7.java >--- src/org/eclipse/rwt/internal/browser/Ie7.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >- >-/** <p>the implementation for Microsoft Internet Explorer 7.</p> >- */ >-public class Ie7 extends Ie6up { >- >- public Ie7( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie7( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie7( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_2up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_2up.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_2up.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_2up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2 and higher. >- * </p> >- */ >-public class Konqueror3_2up extends Konqueror3_1up { >- >- public Konqueror3_2up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_2up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_2up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie7up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie7up.java >diff -N src/org/eclipse/rwt/internal/browser/Ie7up.java >--- src/org/eclipse/rwt/internal/browser/Ie7up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,31 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >- >-/** >- * <p>the implementation for Microsoft Internet Explorer 7 and higher.</p> >- */ >-public class Ie7up extends Ie6up { >- >- public Ie7up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie7up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie7up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Opera8up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Opera8up.java >diff -N src/org/eclipse/rwt/internal/browser/Opera8up.java >--- src/org/eclipse/rwt/internal/browser/Opera8up.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>The implementation for Opera 8 and higher.</p> >- */ >-public class Opera8up extends Opera { >- >- public Opera8up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Opera8up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Opera8up( final Browser browser ) { >- super( browser ); >- } >- >- public boolean isXHTMLCapable() { >- return true; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_3up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_3up.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_3up.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_3up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.2. >- * </p> >- */ >-public class Konqueror3_3up extends Konqueror3_2up { >- >- public Konqueror3_3up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_3up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_3up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Konqueror3_1.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Konqueror3_1.java >diff -N src/org/eclipse/rwt/internal/browser/Konqueror3_1.java >--- src/org/eclipse/rwt/internal/browser/Konqueror3_1.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p> >- * the implementation for Konqueror 3.1. >- * </p> >- */ >-public class Konqueror3_1 extends Konqueror { >- >- public Konqueror3_1( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Konqueror3_1( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Konqueror3_1( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/BrowserLoader.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/BrowserLoader.java >diff -N src/org/eclipse/rwt/internal/browser/BrowserLoader.java >--- src/org/eclipse/rwt/internal/browser/BrowserLoader.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,161 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-import java.lang.reflect.Constructor; >-import java.util.Date; >- >-import javax.servlet.http.HttpServletRequest; >- >-import org.eclipse.rwt.internal.service.ContextProvider; >-import org.eclipse.rwt.internal.service.RequestParams; >- >- >- >-/** <p>Loads the proper subclass of Browser which represents vendor-specific >- * and version-specific information about the web browser that is used >- * on the client side to display the pages from the current session.</p> >- */ >-public final class BrowserLoader { >- >- public static final String USER_AGENT = "User-Agent"; >- >- /** >- * <p>Loads the browser object matching the browser, script- and >- * AJaX-settings extracted from the current context, or a default browser >- * with disabled script- and AJaX-settings if no matching browser could >- * be created.</p> >- * @return the Browser object matching the detected browser >- */ >- public static Browser load() { >- String browserClassName = detectBrowserClassName(); >- Browser result; >- if( browserClassName.equals( Default.class.getName() ) ) { >- result = new Default( false ); >- } else { >- result = loadClassForName( browserClassName, >- isScriptEnabled(), >- isAjaxEnabled() ); >- } >- return result; >- } >- >- /** >- * <p>Loads a browser object for a given browser class name and given >- * settings for scriptEnabled and ajaxEnabled, or a default browser if >- * matching browser class name can not be found </p> >- * >- * @param browserClassName the classname >- * @param scriptEnabled boolean true if script should be enabled >- * @param ajaxEnabled boolean true if ajax should be enabled >- * @return the matching browser object >- */ >- public static Browser loadClassForName( final String browserClassName, >- final boolean scriptEnabled, >- final boolean ajaxEnabled ) >- { >- Browser result; >- try { >- Class clazz = Class.forName( browserClassName ); >- Class[] types = new Class[]{ Boolean.TYPE, Boolean.TYPE }; >- Constructor constructor = clazz.getConstructor( types ); >- Object[] params = new Object[]{ >- Boolean.valueOf( scriptEnabled ), Boolean.valueOf( ajaxEnabled ) >- }; >- result = ( Browser )constructor.newInstance( params ); >- } catch( final Exception shouldNotHappen ) { >- System.out.println( createMessage( browserClassName ) ); >- result = new Default( scriptEnabled, ajaxEnabled ); >- } >- return result; >- } >- >- /** >- * <p>Loads a browser object for a given browser class name and given >- * browser template, or a default browser if matching >- * browser class name can not be found </p> >- * >- * @param browserClassName the class to be instantiated >- * @param browser >- */ >- public static Browser loadClassForName( final String browserClassName, >- final Browser browser ) >- { >- Browser result = null; >- try { >- Class clazz = Class.forName( browserClassName ); >- Class[] types = new Class[]{ Browser.class }; >- Constructor constructor = clazz.getConstructor( types ); >- Object[] params = new Object[]{ browser }; >- result = ( Browser )constructor.newInstance( params ); >- >- } catch( final Exception ex ) { >- System.out.println( createMessage( browserClassName ) ); >- result = loadDefaultBrowser( browser ); >- } >- return result; >- } >- >- private static String createMessage( final String browserClassName ) { >- HttpServletRequest request = ContextProvider.getRequest(); >- String userAgent = request.getHeader( USER_AGENT ); >- StringBuffer result = new StringBuffer(); >- result.append( new Date() ); >- result.append( " BROWSERLOADER: Browser instantiation fault.\n" ); >- result.append( "Could not load a valid org.eclipse.rap.Browser " ); >- result.append( "subclass for the received name '" ); >- result.append( browserClassName ); >- result.append( "'. Switch to default Browser.\n" ); >- result.append( "User-Agent: " ); >- result.append( userAgent ); >- return result.toString(); >- } >- >- // Helper methods >- ///////////////////////////// >- >- /** >- * <p>Determines the classname of the browser matching the userAgent-String >- * used in the current context </p> >- * @return className of the Browser >- */ >- private static String detectBrowserClassName() { >- String userAgent = ContextProvider.getRequest().getHeader( USER_AGENT ); >- BrowserDetector detector = BrowserDetector.getInstance(); >- return detector.getBrowserClassName( userAgent ); >- } >- >- /** >- * <p>Determines if script is enabled in the current context.</p> >- * @return true if script is enabled >- */ >- private static boolean isScriptEnabled() { >- HttpServletRequest request = ContextProvider.getRequest(); >- return "true".equals( request.getParameter( RequestParams.SCRIPT ) ); >- } >- >- /** >- * <p>Determines if AJaX is enabled in the current context.</p> >- * @return true if AJaX is enabled >- */ >- private static boolean isAjaxEnabled() { >- HttpServletRequest request = ContextProvider.getRequest(); >- return "true".equals( request.getParameter( RequestParams.AJAX_ENABLED ) ); >- } >- >- private static Browser loadDefaultBrowser( final Browser browser ) { >- return new Default( browser.isScriptEnabled(), browser.isAjaxEnabled() ); >- } >- >- private BrowserLoader() { >- // prevent instantiation >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/browser/Ie5.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie5.java >diff -N src/org/eclipse/rwt/internal/browser/Ie5.java >--- src/org/eclipse/rwt/internal/browser/Ie5.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>the implementation for Microsoft Internet Explorer 5.</p> >- */ >-public class Ie5 extends Ie { >- >- public Ie5( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie5( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie5( final Browser browser ) { >- super( browser ); >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/browser/Safari2up.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Safari2up.java >diff -N src/org/eclipse/rwt/internal/browser/Safari2up.java >--- src/org/eclipse/rwt/internal/browser/Safari2up.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >- >-/** <p>the basic implementation for Safari browsers.</p> >-*/ >-public class Safari2up extends Safari { >- >- public Safari2up( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Safari2up( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Safari2up( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Browser.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Browser.java >diff -N src/org/eclipse/rwt/internal/browser/Browser.java >--- src/org/eclipse/rwt/internal/browser/Browser.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,265 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >-import java.util.Enumeration; >-import java.util.Locale; >- >-import org.eclipse.rwt.internal.service.ContextProvider; >- >- >-/** >- * <p>Subclasses of Browser represent vendor-specific and version-specific >- * information about the web browser that is used on the client side to display >- * the pages from the current session.</p> >- * @see org.eclipse.rwt.W4TContext#getBrowser() W4TContext.getBrowser() >- */ >-public abstract class Browser { >- >- /** >- * <p> >- * Default value, if the detected browser vendor and version are unknown. >- * </p> >- */ >- public final static String DEFAULT = "Default"; >- >- /** >- * <p> >- * Netscape Navigator 6 or higher. >- * </p> >- */ >- public final static String NAVIGATOR_6_UP = "Nav6up"; >- /** >- * <p> >- * Microsoft Internet Explorer 5 or higher. >- * </p> >- */ >- public final static String INTERNETEXPLORER_5_UP = "Ie5up"; >- >- private static final String PACKAGE = "org.eclipse.rap.util.browser."; >- >- /** <p>Whether the browser represented by this Browser has javascript >- * execution enabled.</p> */ >- private final boolean scriptEnabled; >- /** <p>Whether the browser represented by this Browser has AJaX enabled.</p> >- */ >- private final boolean ajaxEnabled; >- >- /** <p>Whether AJaX mode is supported for this browser. Requires that the >- * browser can handle AJaX requests/responses and that there exist AJaX >- * rendering kits.</p> */ >- protected boolean ajaxCapable = false; >- >- /** >- * The preferred Locale that the client will accept content in, based on the >- * Accept-Language header of the first request of the client session. If the >- * first client request doesn't provide an Accept-Language header, the the >- * default locale for the server is used. >- */ >- private Locale locale; >- /** >- * an Enumeration of Locale objects indicating, in decreasing order starting >- * with the preferred locale, the locales that are acceptable to the client >- * based on the Accept-Language header of the first request of the client >- * session. If the first client request doesn't provide an Accept-Language >- * header, an Enumeration containing one Locale, the default locale for the >- * server is used. >- */ >- private Enumeration locales; >- /** >- * the Internet Protocol (IP) address of the client that sent the requests of >- * the current session. >- */ >- private String remoteAddr; >- /** >- * the fully qualified name of the client that sent the requests of the >- * current session. If the underlying engine cannot or chooses not to resolve >- * the hostname (to improve performance), this method returns the >- * dotted-string form of the IP address. >- */ >- private String remoteHost; >- >- /** >- * <p>Constructs a new Browser instance.</p> >- * <p>This constructor actually calls {@link #Browser(boolean,boolean) >- * Browser(scriptEnabled,false}}.</p> >- */ >- public Browser( final boolean scriptEnabled ) { >- this( scriptEnabled, false ); >- } >- >- /** >- * <p>Constructs a new Browser instance.</p> >- * <p>Note: you will probably not need to create Browser objects. Use >- * W4TContext.getBrowser() to retrieve the Browser object which represents >- * the browser that is used on the client side to display the pages from the >- * current session.</p> >- * @param scriptEnabled whether this browser supports execution of JavaScript. >- * @param ajaxEnabled whether this browser supports AJaX. If this argument >- * is set to <code>true</code>, the scriptEnabled argumentmust also be >- * set to <code>true</code>. >- */ >- // TODO [rh] these two args should be replaced by enum (NoScript, Script, Ajax), must preserve api-compatibility? >- public Browser( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- this.scriptEnabled = scriptEnabled; >- this.ajaxEnabled = ajaxEnabled; >- locale = ContextProvider.getRequest().getLocale(); >- locales = ContextProvider.getRequest().getLocales(); >- remoteAddr = ContextProvider.getRequest().getRemoteAddr(); >- remoteHost = ContextProvider.getRequest().getRemoteHost(); >- } >- >- /** >- * <p>Constructs a new Browser instance.</p> >- * <p>Note: you will probably not need to create Browser objects. Use >- * W4TContext.getBrowser() to retrieve the Browser object which represents >- * the browser that is used on the client side to display the pages from the >- * current session.</p> >- * <p>This constructor may be used to create e.g. the predecessor of the >- * currently set browser without loosing its session depending attributes in >- * the newly created Browser object.</p> >- */ >- public Browser( final Browser browser ) { >- this.scriptEnabled = browser.scriptEnabled; >- this.ajaxEnabled = browser.ajaxEnabled; >- // keep the ajaxCapable flag from the given browser; the RendererCache needs >- // this to work >- this.ajaxCapable = browser.ajaxCapable; >- locale = browser.getLocale(); >- locales = browser.getLocales(); >- remoteAddr = browser.getRemoteAddr(); >- remoteHost = browser.getRemoteHost(); >- } >- >- /** >- * <p> >- * returns whether this browser is either the same or a later version than >- * the browser represented by the passed browser identifier. >- * </p> >- * >- * <p> >- * <b>Example: </b> use the following code to find out whether the browser of >- * the current session is Netscape Navigator 4 or higher: >- * >- * <pre> >- * Browser browser = W4TContext.getBrowser(); >- * boolean isNetscape4up = browser.isCompatible( Browser.NAVIGATOR_4_UP ); >- * </pre> >- * >- * <p> >- * Note that a later browser is not necessarily compatible to an older >- * version. This method tells you only whether this Browser is the same or a >- * later version, nothing about actual compatibility. >- * </p> >- * >- * @param anotherBrowser >- * denotes a browser version as specified in the public field >- * definitions in {@link org.eclipse.rwt.internal.browser.Browser Browser} >- */ >- // TODO [rh] method never used, remove it? >- public boolean isCompatible( final String anotherBrowser ) { >- boolean result = false; >- String thisBrowser = toString(); >- if( thisBrowser.equals( anotherBrowser ) ) { >- result = true; >- } >- if( !result ) { >- try { >- Class anotherClass = Class.forName( PACKAGE + anotherBrowser ); >- if( this.getClass().isAssignableFrom( anotherClass ) ) { >- result = true; >- } >- if( !result && !thisBrowser.endsWith( "up" ) ) { >- String name = this.getClass().getName() + "up"; >- if( Class.forName( name ).isAssignableFrom( anotherClass ) ) { >- result = true; >- } >- } >- } catch( ClassNotFoundException cnfe ) { >- // this means nothing more than that there is no compatibility at all >- } >- } >- return result; >- } >- >- // attribute setters and getters >- //////////////////////////////// >- >- /** >- * <p>Whether the browser represented by this Browser has JavasSript >- * execution enabled.</p> >- */ >- public boolean isScriptEnabled() { >- return scriptEnabled; >- } >- >- /** >- * <p>Returns whether the browser represented by this Browser object has >- * <em>AJaX</em> enabled.</p> >- */ >- public boolean isAjaxEnabled() { >- return ajaxCapable && ajaxEnabled; >- } >- >- public String toString() { >- String result = this.getClass().getName(); >- int index = result.lastIndexOf( '.' ) + 1; >- return result.substring( index ); >- } >- >- /** >- * <p>Returns the preferred Locale that the client will accept content in, >- * based on the Accept-Language header of the first request of the client >- * session. If the first client request doesn't provide an Accept-Language >- * header, the the default locale for the server is returned.</p> >- */ >- public Locale getLocale() { >- return locale; >- } >- >- /** >- * <p>Returns an Enumeration of Locale objects indicating, in decreasing order >- * starting with the preferred locale, the locales that are acceptable to the >- * client based on the Accept-Language header of the first request of the >- * client session. If the first client request doesn't provide an >- * Accept-Language header, an Enumeration containing one Locale, the default >- * locale for the server is returned.</p> >- */ >- public Enumeration getLocales() { >- return locales; >- } >- >- /** >- * <p>Returns the Internet Protocol (IP) address of the client that sends the >- * requests of the current session.</p> >- */ >- public String getRemoteAddr() { >- return remoteAddr; >- } >- >- /** >- * <p>Returns the fully qualified name of the client that sents the requests >- * of the current session. If the underlying engine cannot or chooses not to >- * resolve the hostname (to improve performance), this method returns the >- * dotted-string form of the IP address.</p> >- */ >- public String getRemoteHost() { >- return remoteHost; >- } >- >- /** >- * <p>Returns whether the browser represented by this Browser object >- * understands XHTML.</p> >- */ >- public boolean isXHTMLCapable() { >- return false; >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Ie.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Ie.java >diff -N src/org/eclipse/rwt/internal/browser/Ie.java >--- src/org/eclipse/rwt/internal/browser/Ie.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>the basic implementation for Microsoft browsers.</p> >- */ >-public class Ie extends Default { >- >- public Ie( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Ie( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- } >- >- public Ie( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Opera9.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Opera9.java >diff -N src/org/eclipse/rwt/internal/browser/Opera9.java >--- src/org/eclipse/rwt/internal/browser/Opera9.java 12 Jun 2008 13:12:15 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,32 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >-/** >- * <p>The implementation for Opera 8 and higher.</p> >- */ >-public class Opera9 extends Opera8up { >- >- public Opera9( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- this.ajaxCapable = true; >- } >- >- public Opera9( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, ajaxEnabled ); >- this.ajaxCapable = true; >- } >- >- public Opera9( final Browser browser ) { >- super( browser ); >- } >-} >Index: src/org/eclipse/rwt/internal/browser/Safari.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/browser/Safari.java >diff -N src/org/eclipse/rwt/internal/browser/Safari.java >--- src/org/eclipse/rwt/internal/browser/Safari.java 12 Jun 2008 13:12:14 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,35 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.browser; >- >- >- >-/** >- * <p>The base class for Safari browsers. No AJaX support.</p> >- */ >-public class Safari extends Default { >- >- public Safari( final boolean scriptEnabled ) { >- super( scriptEnabled ); >- } >- >- public Safari( final boolean scriptEnabled, final boolean ajaxEnabled ) { >- super( scriptEnabled, false ); >- } >- >- public Safari( final Browser browser ) { >- super( browser ); >- } >- >- public boolean isXHTMLCapable() { >- return true; >- } >-} >Index: src/org/eclipse/rwt/internal/util/HTML.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/HTML.java,v >retrieving revision 1.4 >diff -u -r1.4 HTML.java >--- src/org/eclipse/rwt/internal/util/HTML.java 11 Nov 2008 14:09:28 -0000 1.4 >+++ src/org/eclipse/rwt/internal/util/HTML.java 9 Feb 2010 15:18:18 -0000 >@@ -17,152 +17,28 @@ > * </p> > */ > public final class HTML { >- public final static String AJAX_RESPONSE = "ajax-response"; >- public final static String START_AJAX_RESPONSE = "<ajax-response>"; >- public final static String END_AJAX_RESPONSE = "</ajax-response>"; >- >- public final static String NBSP_STRING = "\u00A0"; >- public final static char NBSP_CHAR = '\u00A0'; >- >- public final static String A = "a"; >- public final static String ACCEPT_CHARSET = "accept-charset"; >- public final static String ACTION = "action"; >- public final static String ALIGN = "align"; >- public final static String ALT = "alt"; >- public final static String BACKGROUND = "background"; >- public final static String BGCOLOR = "bgcolor"; >+ > public final static String BODY = "body"; >- public final static String BOLD = "b"; >- public final static String BORDER = "border"; >- public final static String BR = "br"; >- public final static String BUTTON = "button"; >- public final static String CELLPADDING = "cellpadding"; >- public final static String CELLSPACING = "cellspacing"; > public final static String CHARSET = "charset"; >- public final static String CHECKBOX = "checkbox"; >- public final static String CHECKED = "checked"; >- public final static String CENTER = "center"; >- public final static String COLOR = "color"; >- public final static String COLS = "cols"; >- public final static String COLSPAN = "colspan"; > public final static String CONTENT = "content"; > public final static String CONTENT_TYPE = "Content-Type"; >- public final static String CLASS = "class"; >- public final static String DIR = "dir"; >- public final static String DISABLED = "disabled"; >- public final static String DIV = "div"; >- public final static String ENCTYPE = "enctype"; >- public final static String FACE = "face"; >- public final static String FILE = "file"; >- public final static String FONT = "font"; >- public final static String FORM = "form"; >- public final static String H3 = "h3"; > public final static String HEAD = "head"; >- public final static String HEIGHT = "height"; >- public final static String HIDDEN = "hidden"; >- public final static String HIDE = "hide"; >- public final static String HREF = "href"; > public final static String HTML = "html"; > public final static String HTTP_EQUIV = "http-equiv"; >- public final static String ID = "id"; >- public final static String IMG = "img"; >- public final static String IMAGE = "image"; >- public final static String INPUT = "input"; >- public final static String LABEL = "label"; >- public final static String LANGUAGE = "language"; >- public final static String LANG = "lang"; >- public final static String LAYER = "layer"; >- public final static String LEFT = "left"; >- public final static String LEFTMARGIN = "leftmargin"; >- public final static String LI = "li"; >- public final static String LINK = "link"; >- public final static String MARGINHEIGHT = "marginheight"; >- public final static String MARGINWIDTH = "marginwidth"; >- public final static String MAXLENGTH = "maxlength"; > public final static String META = "meta"; >- public final static String METHOD = "method"; >- public final static String MIDDLE = "middle"; >- public final static String NAME = "name"; >- public final static String NBSP = " "; >- public final static String NOWRAP = "nowrap"; >- public final static String OL = "ol"; >- public final static String ON_CHANGE = "onchange"; >- public final static String ON_CLICK = "onclick"; >- public final static String ON_DBL_CLICK = "ondblclick"; >- public final static String ON_FOCUS = "onfocus"; >- public final static String ON_KEY_DOWN = "onkeydown"; >- public final static String ON_KEY_UP = "onkeyup"; >- public final static String ON_KEY_PRESS = "onkeypress"; >- public final static String ON_MOUSE_DOWN = "onmousedown"; >- public final static String ON_MOUSE_MOVE = "onmousemove"; >- public final static String ON_MOUSE_OVER = "onmouseover"; >- public final static String ON_MOUSE_OUT = "onmouseout"; >- public final static String ON_MOUSE_UP = "onmouseup"; >- public final static String ON_RESIZE = "onresize"; >- public final static String ON_UNLOAD = "onunload"; >- public final static String OPTION = "option"; >- public final static String OVERFLOW = "overflow"; >- public final static String P = "p"; >- public final static String PASSWORD = "password"; >- public final static String POST = "post"; >- public final static String POSITION = "position"; >- public final static String RADIO = "radio"; >- public final static String READONLY = "readonly"; >- public final static String REL = "rel"; >- public final static String RESET = "reset"; >- public final static String ROWS = "rows"; >- public final static String ROWSPAN = "rowspan"; > public final static String SCRIPT = "script"; >- public final static String SELECT = "select"; >- public final static String SELECTED = "selected"; >- public final static String SIZE = "size"; >- public final static String SPAN = "span"; > public final static String SRC = "src"; >- public final static String START = "start"; > public final static String STYLE = "style"; >- public final static String STYLESHEET = "stylesheet"; >- public final static String SUBMIT = "submit"; >- public final static String TABINDEX = "tabindex"; >- public final static String TABLE = "table"; >- public final static String TARGET = "target"; >- public final static String TD = "td"; >- public final static String TEXT = "text"; >- public final static String TEXTAREA = "textarea"; > public final static String TITLE = "title"; >- public final static String TOP = "top"; >- public final static String TOPMARGIN = "topmargin"; >- public final static String TR = "tr"; > public final static String TYPE = "type"; >- public final static String UL = "ul"; >- public final static String VALIGN = "valign"; >- public final static String VALUE = "value"; >- public final static String WIDTH = "width"; >- public final static String VISIBILITY = "visibility"; >- public final static String WRAP = "wrap"; >- >- public final static String TAG_BEGIN_OPEN = "<"; >- public final static String TAG_END_OPEN = "</"; >- public final static String TAG_CLOSE = ">"; >- >- public final static String DOCTYPE_4_0_TRANSITIONAL >- = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; >- public final static String DOCTYPE_4_01_TRANSITIONAL >- = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"; > > public final static String CONTENT_TEXT_HTML_UTF_8 > = "text/html; charset=UTF-8"; > public final static String CONTENT_TEXT_HTML = "text/html"; >- public final static String CONTENT_TEXT_XML = "text/xml"; > public final static String CONTENT_TEXT_CSS = "text/css"; > public final static String CONTENT_TEXT_JAVASCRIPT = "text/javascript"; > public final static String CONTENT_TEXT_JAVASCRIPT_UTF_8 > = "text/javascript; charset=UTF-8"; >- public final static String CONTENT_IMAGE_ICO = "image/ico"; >- public final static String CONTENT_IMAGE_GIF = "image/gif"; >- >- public final static String ENCTYPE_FORM_URLENCODED >- = "application/x-www-form-urlencoded"; >- public final static String ENCTYPE_FORM_DATA = "multipart/form-data"; > > public final static String CHARSET_NAME_UTF_8 = "UTF-8"; > public final static String CHARSET_NAME_ISO_8859_1 = "ISO-8859-1"; >Index: src/org/eclipse/rwt/internal/util/Assert.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/util/Assert.java >diff -N src/org/eclipse/rwt/internal/util/Assert.java >--- src/org/eclipse/rwt/internal/util/Assert.java 12 Aug 2009 12:56:46 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,55 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.util; >- >- >-/** <p>Provides some simple assertion facility that sends runtime >- * exceptions on assertion fails.</p> >- */ >-public final class Assert { >- >- private Assert() { >- // prevent instantiation >- } >- >- /** <p>Fails if obj is null.</p> */ >- public static void isNotNull( final Object obj ) { >- isNotNull( obj, "" ); >- } >- >- /** <p>Fails if obj is null, and sends message.</p> */ >- public static void isNotNull( final Object obj, final String message ) { >- if( obj == null ) { >- throw new AssertionFailedException( message ); >- } >- } >- >- /** <p>Fails if expr is false.</p> */ >- public static void isTrue( final boolean expr ) { >- isTrue( expr, "" ); >- } >- >- /** <p>Fails if expr is false and sends message.</p> */ >- public static void isTrue( final boolean expr, final String message ) { >- if( !expr ) { >- throw new AssertionFailedException( message ); >- } >- } >- >- /** The common exception type (runtime exception) for failed assertions. */ >- private static class AssertionFailedException extends RuntimeException { >- private static final long serialVersionUID = 1L; >- >- AssertionFailedException( final String msg ) { >- super( msg ); >- } >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/util/URLHelper.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/URLHelper.java,v >retrieving revision 1.2 >diff -u -r1.2 URLHelper.java >--- src/org/eclipse/rwt/internal/util/URLHelper.java 12 Jun 2008 13:12:18 -0000 1.2 >+++ src/org/eclipse/rwt/internal/util/URLHelper.java 9 Feb 2010 15:18:18 -0000 >@@ -28,6 +28,14 @@ > // no instance creation > } > >+ public static String getSerlvetName() { >+ String result = ContextProvider.getRequest().getServletPath(); >+ if( result.startsWith( "/" ) ) { >+ result = result.substring( 1 ); >+ } >+ return result; >+ } >+ > /** returns the servlets URL of the current W4Toolkit installation. */ > public static String getURLString( final boolean addEncodingDummy ) { > HttpServletRequest request = ContextProvider.getRequest(); >Index: src/org/eclipse/rwt/internal/util/HTMLUtil.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/util/HTMLUtil.java >diff -N src/org/eclipse/rwt/internal/util/HTMLUtil.java >--- src/org/eclipse/rwt/internal/util/HTMLUtil.java 12 Jun 2008 13:12:18 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,104 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.util; >- >-import java.io.IOException; >- >-import org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter; >- >-/** >- * <p>Utility class to create commonly used HTML artefacts.</p> >- */ >-public final class HTMLUtil { >- >- public static String hiddenInput( final String name, final String value ) { >- StringBuffer buffer = new StringBuffer(); >- hiddenInput( buffer, name, value ); >- return buffer.toString(); >- } >- >- public static void hiddenInput( final StringBuffer buffer, >- final String name, >- final String value ) >- { >- String id = name == null >- ? null >- : EntitiesUtil.encodeHTMLEntities( name ); >- String encodedValue = value == null >- ? null >- : EntitiesUtil.encodeHTMLEntities( value ); >- buffer.append( "<input type=\"hidden\" id=\"" ); >- buffer.append( id ); >- buffer.append( "\" name=\"" ); >- buffer.append( id ); >- buffer.append( "\" value=\"" ); >- buffer.append( encodedValue ); >- buffer.append( "\" />" ); >- } >- >- public static void hiddenInput( final HtmlResponseWriter writer, >- final String name, >- final String value ) >- throws IOException >- { >- writer.startElement( HTML.INPUT, null ); >- writer.writeAttribute( HTML.TYPE, HTML.HIDDEN, null ); >- writer.writeAttribute( HTML.ID, name, null ); >- writer.writeAttribute( HTML.NAME, name, null ); >- writer.writeAttribute( HTML.VALUE, value, null ); >- writer.endElement( HTML.INPUT ); >- } >- >- public static void attribute( final StringBuffer buffer, >- final String name, >- final String value ) >- { >- buffer.append( " " ); >- buffer.append( name ); >- buffer.append( "=\"" ); >- String encodedValue = value == null >- ? value >- : EntitiesUtil.encodeHTMLEntities( value ); >- buffer.append( encodedValue ); >- buffer.append( "\"" ); >- } >- >- public static String attribute( final String name, final String value ) { >- StringBuffer buffer = new StringBuffer(); >- attribute( buffer, name, value ); >- return buffer.toString(); >- } >- >- // TODO [w4t] moved here from RenderUtil in favor of moving RenderUtil to RWT >- // (which in turn depends on WebComponent) >- public static String createXmlProcessingInstruction() { >- StringBuffer result = new StringBuffer(); >- result.append( "<?xml" ); >- HTMLUtil.attribute( result, "version", "1.0" ); >- HTMLUtil.attribute( result, "encoding", HTML.CHARSET_NAME_UTF_8 ); >- result.append( " ?>" ); >- return result.toString(); >- } >- >- // TODO [w4t] moved here from RenderUtil in favor of moving RenderUtil to RWT >- // (which in turn depends on WebComponent) >- public static String createJavaScriptInline( final String javaScriptCode ) { >- StringBuffer result = new StringBuffer(); >- if( javaScriptCode != null && !"".equals( javaScriptCode ) ) { >- result.append( "<script" ); >- HTMLUtil.attribute( result, HTML.TYPE, HTML.CONTENT_TEXT_JAVASCRIPT ); >- result.append( ">" ); >- result.append( EntitiesUtil.encodeHTMLEntities( javaScriptCode ) ); >- result.append( "</script>" ); >- } >- return result.toString(); >- } >-} >Index: src/org/eclipse/rwt/internal/service/AbstractServiceHandler.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/AbstractServiceHandler.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractServiceHandler.java >--- src/org/eclipse/rwt/internal/service/AbstractServiceHandler.java 14 Sep 2009 11:29:13 -0000 1.3 >+++ src/org/eclipse/rwt/internal/service/AbstractServiceHandler.java 9 Feb 2010 15:18:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -12,35 +12,22 @@ > package org.eclipse.rwt.internal.service; > > import java.io.*; >-import java.text.SimpleDateFormat; >-import java.util.*; > import java.util.zip.GZIPOutputStream; > > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > >-import org.eclipse.rwt.Adaptable; > import org.eclipse.rwt.internal.*; > import org.eclipse.rwt.internal.util.HTML; > import org.eclipse.rwt.service.IServiceHandler; > > public abstract class AbstractServiceHandler implements IServiceHandler { > >- private static final int TIMEOUT = 600000; >- private static final String EXPIRATION_TIME_FORMAT >- = "EEE, dd MMM yyyy HH:mm:ss zzz"; >- private static final SimpleDateFormat FORMATTER >- = new SimpleDateFormat( EXPIRATION_TIME_FORMAT, Locale.US ); >- private static final String EXPIRES = "Expires"; > private static final String ACCEPT_ENCODING = "Accept-Encoding"; > private static final String CONTENT_ENCODING = "Content-Encoding"; > private static final String ENCODING_GZIP = "gzip"; > > >- IServiceAdapter getServiceAdapter( final Adaptable model ) { >- return ( IServiceAdapter )model.getAdapter( IServiceAdapter.class ); >- } >- > static boolean isAcceptEncoding() { > String encodings = getRequest().getHeader( ACCEPT_ENCODING ); > return encodings != null && encodings.indexOf( ENCODING_GZIP ) != -1; >@@ -59,16 +46,6 @@ > return new PrintWriter( utf8Writer, false ); > } > >- protected void setExpirationHeader() { >- // set an expiration date for the js-library to avoid reloading it >- // on every page request! >- // TODO: configuration of the expiration time >- FORMATTER.setTimeZone( TimeZone.getTimeZone( "GMT" ) ); >- Date date = new Date( System.currentTimeMillis() + TIMEOUT ); >- String expirationTime = FORMATTER.format( date ); >- getResponse().setHeader( EXPIRES, expirationTime ); >- } >- > static IInitialization getInitProps() { > IConfiguration configuration = ConfigurationReader.getConfiguration(); > return configuration.getInitialization(); >Index: src/org/eclipse/rwt/internal/service/IServiceStateInfo.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/IServiceStateInfo.java,v >retrieving revision 1.3 >diff -u -r1.3 IServiceStateInfo.java >--- src/org/eclipse/rwt/internal/service/IServiceStateInfo.java 12 Jun 2008 13:12:17 -0000 1.3 >+++ src/org/eclipse/rwt/internal/service/IServiceStateInfo.java 9 Feb 2010 15:18:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -7,52 +7,18 @@ > * > * Contributors: > * Innoopract Informationssysteme GmbH - initial API and implementation >+ * EclipseSource - ongoing development > ******************************************************************************/ > package org.eclipse.rwt.internal.service; > >-import org.eclipse.rwt.internal.browser.Browser; > import org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter; > import org.eclipse.rwt.service.IServiceStore; > > > public interface IServiceStateInfo extends IServiceStore { > >- void setExpired( boolean expired ); >- >- boolean isExpired(); >- >- void setExceptionOccured( boolean exceptionOcc ); >- >- boolean isExceptionOccured(); >- >- void setInvalidated( boolean invalidated ); >- >- boolean isInvalidated(); >- > void setResponseWriter( final HtmlResponseWriter reponseWriter ); > > HtmlResponseWriter getResponseWriter(); > >- void setDetectedBrowser( Browser browser ); >- Browser getDetectedBrowser(); >- >- /** <p>returns the event queue of this ServiceStateInfo.</p> >- * >- * <p>The event queue for a request contains all WebDataEvents, i.e. >- * events which are fired from a component when its value changes.</p> >- */ >- Object getEventQueue(); >- void setEventQueue( Object eventQueue ); >- >- /** <p>returns whether the startup request parameter should be ignored >- * during the render phase of the requests lifecycle.</p> >- */ >- boolean isIgnoreStartup(); >- >- /** <p>sets whether the startup request parameter should be ignored >- * during the render phase of the requests lifecycle.</p> >- */ >- void setIgnoreStartup( boolean ignoreStartup ); >- >- boolean isFirstAccess(); > } >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/service/LifeCycleServiceHandler.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/LifeCycleServiceHandler.java,v >retrieving revision 1.22 >diff -u -r1.22 LifeCycleServiceHandler.java >--- src/org/eclipse/rwt/internal/service/LifeCycleServiceHandler.java 31 Jan 2010 11:21:55 -0000 1.22 >+++ src/org/eclipse/rwt/internal/service/LifeCycleServiceHandler.java 9 Feb 2010 15:18:18 -0000 >@@ -21,17 +21,21 @@ > > import org.eclipse.rwt.SessionSingletonBase; > import org.eclipse.rwt.internal.RWTMessages; >-import org.eclipse.rwt.internal.browser.Browser; >-import org.eclipse.rwt.internal.browser.BrowserLoader; > import org.eclipse.rwt.internal.lifecycle.*; > import org.eclipse.rwt.internal.util.HTML; >+import org.eclipse.rwt.service.ISessionStore; > > > public class LifeCycleServiceHandler extends AbstractServiceHandler { > >+ public static final String RWT_INITIALIZE = "rwt_initialize"; >+ > // TODO [if]: Move this code to a fragment > private static final String PATTERN_RELOAD > = "qx.core.Init.getInstance().getApplication().reload( \"{0}\" )"; >+ >+ private final static String SESSION_INITIALIZED >+ = LifeCycleServiceHandler.class.getName() + "#isSessionInitialized"; > > public void service() throws IOException, ServletException { > synchronized( ContextProvider.getSession() ) { >@@ -40,7 +44,7 @@ > } > > void synchronizedService() throws ServletException, IOException { >- LifeCycleServiceHandler.initializeStateInfo(); >+ initializeStateInfo(); > RWTRequestVersionControl.beforeService(); > try { > if( RWTRequestVersionControl.isValid() >@@ -58,15 +62,15 @@ > > private static void runLifeCycle() throws ServletException, IOException { > checkRequest(); >- detectBrowser(); >- if( isBrowserDetected() ) { >+ initializeSession(); >+ if( isSessionInitialized() ) { > RequestParameterBuffer.merge(); > LifeCycle lifeCycle = ( LifeCycle )LifeCycleFactory.getLifeCycle(); > lifeCycle.execute(); > } else { > Map parameters = ContextProvider.getRequest().getParameterMap(); > RequestParameterBuffer.store( parameters ); >- BrowserSurvey.sendBrowserSurvey(); >+ StartupPage.send(); > } > writeOutput(); > } >@@ -81,7 +85,7 @@ > String uiRoot = request.getParameter( RequestParams.UIROOT ); > HttpSession session = request.getSession(); > return !session.isNew() && !startup && uiRoot == null >- || startup && isBrowserDetected(); >+ || startup && isSessionInitialized(); > } > > private static void initializeStateInfo() { >@@ -109,28 +113,18 @@ > LifeCycleServiceHandler.writeOutput(); > } > >- private static boolean isBrowserDetected() { >- return getBrowser() != null; >+ private static boolean isSessionInitialized() { >+ ISessionStore session = ContextProvider.getSession(); >+ return Boolean.TRUE.equals( session.getAttribute( SESSION_INITIALIZED ) ); > } > >- private static Browser getBrowser() { >- String id = ServiceContext.DETECTED_SESSION_BROWSER; >- return ( Browser )ContextProvider.getSession().getAttribute( id ); >- } >- >- private static void detectBrowser() { >- if( !isBrowserDetected() ) { >- if( getRequest().getParameter( RequestParams.SCRIPT ) != null >- && getRequest().getParameter( RequestParams.AJAX_ENABLED ) != null ) >- { >- Browser browser = BrowserLoader.load(); >- String id = ServiceContext.DETECTED_SESSION_BROWSER; >- ContextProvider.getSession().setAttribute( id, browser ); >+ public static void initializeSession() { >+ if( !isSessionInitialized() ) { >+ if( getRequest().getParameter( RWT_INITIALIZE ) != null ) { >+ ISessionStore session = ContextProvider.getSession(); >+ session.setAttribute( SESSION_INITIALIZED, Boolean.TRUE ); > } > } >- if ( isBrowserDetected() ) { >- ContextProvider.getStateInfo().setDetectedBrowser( getBrowser() ); >- } > } > > private static void checkRequest() { >@@ -170,18 +164,10 @@ > = ContextProvider.getStateInfo().getResponseWriter(); > PrintWriter out = getOutputWriter(); > try { >- // send the head to the client >- for( int i = 0; i < content.getHeadSize(); i++ ) { >- out.print( content.getHeadToken( i ) ); >- } > // send the body to the client > for( int i = 0; i < content.getBodySize(); i++ ) { > out.print( content.getBodyToken( i ) ); > } >- // send the foot to the client >- for( int i = 0; i < content.getFootSize(); i++ ) { >- out.print( content.getFootToken( i ) ); >- } > } finally { > out.close(); > } >Index: src/org/eclipse/rwt/internal/service/ServiceStateInfo.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/ServiceStateInfo.java,v >retrieving revision 1.3 >diff -u -r1.3 ServiceStateInfo.java >--- src/org/eclipse/rwt/internal/service/ServiceStateInfo.java 12 Jun 2008 13:12:17 -0000 1.3 >+++ src/org/eclipse/rwt/internal/service/ServiceStateInfo.java 9 Feb 2010 15:18:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. > * 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 >@@ -7,15 +7,13 @@ > * > * Contributors: > * Innoopract Informationssysteme GmbH - initial API and implementation >+ * EclipseSource - ongoing development > ******************************************************************************/ > package org.eclipse.rwt.internal.service; > > import java.util.HashMap; > import java.util.Map; > >-import javax.servlet.http.HttpServletRequest; >- >-import org.eclipse.rwt.internal.browser.Browser; > import org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter; > > >@@ -25,51 +23,10 @@ > */ > public final class ServiceStateInfo implements IServiceStateInfo { > >- /** the WebForm posted in the request has expired */ >- private boolean expired = false; >- /** the WebForm processed in the model caused an exception */ >- private boolean exceptionOccured = false; >- /** whether the startup request parameter should be ignored >- * during the render phase of the requests lifecycle. */ >- private boolean ignoreStartup = false; >- /** <p>The browser as it was detected at session startup.</p> */ >- private Browser detectedBrowser; >- /** <p>contains the rendered page for the request for which this >- * ServiceStateInfo collects data.</p> */ > private HtmlResponseWriter responseWriter; >- /** <p>The event queue for a request contains all WebDataEvents, i.e. >- * events which are fired from a component when its value changes.</p> */ >- private Object eventQueue; > >- private boolean invalidated; > private final Map attributes = new HashMap(); > >- public void setExpired( final boolean expired ) { >- this.expired = expired; >- } >- >- public boolean isExpired() { >- return expired; >- } >- >- public void setExceptionOccured( final boolean exceptionOcc ) { >- this.exceptionOccured = exceptionOcc; >- } >- >- public boolean isExceptionOccured() { >- return exceptionOccured; >- } >- >- /** <p>Marks the current session as invalidated.</p> */ >- public void setInvalidated( final boolean invalidated ) { >- this.invalidated = invalidated; >- } >- >- /** <p>Returns whether the current session is marked as invalidated..</p> */ >- public boolean isInvalidated() { >- return this.invalidated; >- } >- > /** <p>Sets the given <code>responseWriter</code> for the current request. > * </p> */ > public void setResponseWriter( final HtmlResponseWriter responseWriter ) { >@@ -81,41 +38,6 @@ > return responseWriter; > } > >- public void setDetectedBrowser( final Browser detectedBrowser ) { >- this.detectedBrowser = detectedBrowser; >- } >- >- public Browser getDetectedBrowser() { >- return detectedBrowser; >- } >- >- >- /** <p>Returns the event queue of this ServiceStateInfo.</p> >- * <p>The event queue for a request contains all WebDataEvents, i.e. >- * events which are fired from a component when its value changes.</p> >- */ >- public Object getEventQueue() { >- return eventQueue; >- } >- >- public void setEventQueue( final Object eventQueue ) { >- this.eventQueue = eventQueue; >- } >- >- public boolean isIgnoreStartup() { >- return ignoreStartup; >- } >- >- public void setIgnoreStartup( final boolean ignoreStartup ) { >- this.ignoreStartup = ignoreStartup; >- } >- >- public boolean isFirstAccess() { >- HttpServletRequest request = ContextProvider.getRequest(); >- return request.getSession( true ).isNew() >- || request.getParameter( RequestParams.STARTUP ) != null; >- } >- > public Object getAttribute( final String key ) { > return attributes.get( key ); > } >Index: src/org/eclipse/rwt/internal/service/ServiceManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/ServiceManager.java,v >retrieving revision 1.5 >diff -u -r1.5 ServiceManager.java >--- src/org/eclipse/rwt/internal/service/ServiceManager.java 6 Oct 2009 11:17:24 -0000 1.5 >+++ src/org/eclipse/rwt/internal/service/ServiceManager.java 9 Feb 2010 15:18:18 -0000 >@@ -30,8 +30,6 @@ > /** <p>provides the appropriate HttpServlet request service handler for the > * given runtime mode.</p> > */ >-// TODO [rh] Could implement resource/timestamp request handler as regular >-// IServiceHandler > // TODO [rh] access to customHandlers Map is unsynchronized and may cause > // trouble in case of unproper use > public final class ServiceManager { >Index: src/org/eclipse/rwt/internal/service/rwt-index.html >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/rwt-index.html,v >retrieving revision 1.7 >diff -u -r1.7 rwt-index.html >--- src/org/eclipse/rwt/internal/service/rwt-index.html 21 Jan 2010 14:33:06 -0000 1.7 >+++ src/org/eclipse/rwt/internal/service/rwt-index.html 9 Feb 2010 15:18:18 -0000 >@@ -61,8 +61,7 @@ > > function appendInitParameters() { > var req = org.eclipse.swt.Request.getInstance(); >- req.addParameter( "w4t_scriptEnabled", "true" ); >- req.addParameter( "w4t_ajaxEnabled", "true" ); >+ req.addParameter( "rwt_initialize", "true" ); > req.addParameter( "startup", "${startup}" ); > var size = discoverSize(); > req.addParameter( "w4t_width", size.width ); >Index: src/org/eclipse/rwt/internal/service/RWTStartupPageConfigurer.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/RWTStartupPageConfigurer.java,v >retrieving revision 1.1 >diff -u -r1.1 RWTStartupPageConfigurer.java >--- src/org/eclipse/rwt/internal/service/RWTStartupPageConfigurer.java 21 Jan 2010 16:09:46 -0000 1.1 >+++ src/org/eclipse/rwt/internal/service/RWTStartupPageConfigurer.java 9 Feb 2010 15:18:18 -0000 >@@ -31,7 +31,7 @@ > import org.eclipse.swt.internal.graphics.TextSizeDetermination; > > public final class RWTStartupPageConfigurer >- implements BrowserSurvey.IStartupPageConfigurer >+ implements StartupPage.IStartupPageConfigurer > { > > private static final String PACKAGE_NAME >@@ -44,17 +44,17 @@ > private static int probeCount; > private static long lastModified = System.currentTimeMillis(); > >- private static TemplateHolder template; >+ private static StartupPageTemplateHolder template; > private static final List registeredBrandings = new ArrayList(); > > //////////////////////////////////////////////////// > // ILifeCycleServiceHandlerConfigurer implementation > >- public TemplateHolder getTemplate() throws IOException { >+ public StartupPageTemplateHolder getTemplate() throws IOException { > readContent(); > template.reset(); >- template.replace( TemplateHolder.VAR_LIBRARIES, getLibraries() ); >- template.replace( TemplateHolder.VAR_APPSCRIPT, getAppScript() ); >+ template.replace( StartupPageTemplateHolder.VAR_LIBRARIES, getLibraries() ); >+ template.replace( StartupPageTemplateHolder.VAR_APPSCRIPT, getAppScript() ); > applyBranding(); > return template; > } >@@ -111,7 +111,7 @@ > buffer.append( "\n" ); > line = reader.readLine(); > } >- template = new TemplateHolder( buffer.toString() ); >+ template = new StartupPageTemplateHolder( buffer.toString() ); > } finally { > reader.close(); > } >@@ -212,26 +212,26 @@ > ThemeUtil.setCurrentThemeId( branding.getThemeId() ); > } > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_BODY, >+ StartupPageTemplateHolder.VAR_BODY, > branding.getBody() ); > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_TITLE, >+ StartupPageTemplateHolder.VAR_TITLE, > branding.getTitle() ); > String headers = BrandingUtil.headerMarkup( branding ); > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_HEADERS, >+ StartupPageTemplateHolder.VAR_HEADERS, > headers ); > String encodedEntryPoint = EntitiesUtil.encodeHTMLEntities( entryPoint ); > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_STARTUP, >+ StartupPageTemplateHolder.VAR_STARTUP, > encodedEntryPoint ); > String script = BrandingUtil.exitMessageScript( branding ); > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_EXIT_CONFIRMATION, >+ StartupPageTemplateHolder.VAR_EXIT_CONFIRMATION, > script ); > String noScriptWarning = RWTMessages.getMessage( "RWT_NoScriptWarning" ); > BrandingUtil.replacePlaceholder( template, >- TemplateHolder.VAR_NO_SCRIPT_MESSAGE, >+ StartupPageTemplateHolder.VAR_NO_SCRIPT_MESSAGE, > noScriptWarning ); > } > >Index: src/org/eclipse/rwt/internal/service/BrowserSurvey.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/service/BrowserSurvey.java >diff -N src/org/eclipse/rwt/internal/service/BrowserSurvey.java >--- src/org/eclipse/rwt/internal/service/BrowserSurvey.java 21 Jan 2010 16:09:46 -0000 1.14 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,112 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- * EclipseSource - ongoing development >- ******************************************************************************/ >-package org.eclipse.rwt.internal.service; >- >-import java.io.IOException; >- >-import javax.servlet.http.HttpServletRequest; >- >-import org.eclipse.rwt.RWT; >-import org.eclipse.rwt.branding.AbstractBranding; >-import org.eclipse.rwt.internal.branding.BrandingUtil; >-import org.eclipse.rwt.internal.lifecycle.EntryPointManager; >-import org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter; >-import org.eclipse.rwt.internal.theme.*; >-import org.eclipse.rwt.internal.util.EntitiesUtil; >-import org.eclipse.rwt.internal.util.HTML; >- >- >-/** >- * <p>A helping class that loads a special html page in order to >- * determine which browser has originated the request.</p> >- */ >-public final class BrowserSurvey { >- >- public interface IStartupPageConfigurer { >- TemplateHolder getTemplate() throws IOException; >- boolean isModifiedSince(); >- } >- >- public static IStartupPageConfigurer configurer >- = new RWTStartupPageConfigurer(); >- >- /** >- * <p>Writes a special html page into the passed HtmlResponseWriter, >- * in order to determine which browser has originated the request.</p> >- */ >- static void sendBrowserSurvey() throws IOException { >- if( configurer.isModifiedSince() ) { >- // send out the survey >- render(); >- } else { >- AbstractBranding branding = BrandingUtil.findBranding(); >- if( branding.getThemeId() != null ) { >- ThemeUtil.setCurrentThemeId( branding.getThemeId() ); >- } >- } >- } >- >- private static String getBgImage() { >- String result = ""; >- QxType cssValue = ThemeUtil.getCssValue( "Display", >- "background-image", >- SimpleSelector.DEFAULT ); >- if( cssValue instanceof QxImage ) { >- QxImage image = ( QxImage )cssValue; >- // path is null if non-existing image was specified in css file >- String resourceName = image.getResourceName(); >- if( resourceName != null ) { >- result = RWT.getResourceManager().getLocation( resourceName ); >- } >- } >- return result; >- } >- >- public static String getSerlvetName() { >- String result = ContextProvider.getRequest().getServletPath(); >- if( result.startsWith( "/" ) ) { >- result = result.substring( 1 ); >- } >- return result; >- } >- >- private static void render() throws IOException { >- ContextProvider.getResponse().setContentType( HTML.CONTENT_TEXT_HTML ); >- TemplateHolder template = configurer.getTemplate(); >- template.replace( TemplateHolder.VAR_BACKGROUND_IMAGE, getBgImage() ); >- // TODO [fappel]: check whether servletName has to be url encoded >- // in case the client has switched of cookies >- template.replace( TemplateHolder.VAR_SERVLET, getSerlvetName() ); >- template.replace( TemplateHolder.VAR_ENTRY_POINT, >- EntitiesUtil.encodeHTMLEntities( getEntryPoint() ) ); >- String[] tokens = template.getTokens(); >- for( int i = 0; i < tokens.length; i++ ) { >- if( tokens[ i ] != null ) { >- getResponseWriter().append( tokens[ i ] ); >- } >- } >- } >- >- private static String getEntryPoint() { >- HttpServletRequest request = ContextProvider.getRequest(); >- String result = request.getParameter( RequestParams.STARTUP ); >- if( result == null ) { >- result = EntryPointManager.DEFAULT; >- } >- return result; >- } >- >- private static HtmlResponseWriter getResponseWriter() { >- IServiceStateInfo stateInfo = ContextProvider.getStateInfo(); >- return stateInfo.getResponseWriter(); >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/service/IServiceAdapter.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/service/IServiceAdapter.java >diff -N src/org/eclipse/rwt/internal/service/IServiceAdapter.java >--- src/org/eclipse/rwt/internal/service/IServiceAdapter.java 12 Jun 2008 13:12:17 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,20 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.service; >- >-import java.io.IOException; >-import javax.servlet.ServletException; >- >-public interface IServiceAdapter { >- >- void execute() throws ServletException, IOException; >- >-} >Index: src/org/eclipse/rwt/internal/service/ContextProvider.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/ContextProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 ContextProvider.java >--- src/org/eclipse/rwt/internal/service/ContextProvider.java 1 Jul 2008 12:07:18 -0000 1.8 >+++ src/org/eclipse/rwt/internal/service/ContextProvider.java 9 Feb 2010 15:18:18 -0000 >@@ -18,7 +18,6 @@ > import org.eclipse.rwt.SessionSingletonBase; > import org.eclipse.rwt.internal.ConfigurationReader; > import org.eclipse.rwt.internal.IEngineConfig; >-import org.eclipse.rwt.internal.browser.Browser; > import org.eclipse.rwt.internal.util.ParamCheck; > import org.eclipse.rwt.service.ISessionStore; > >@@ -110,11 +109,6 @@ > return result; > } > >- public static Browser getBrowser() { >- String id = ServiceContext.DETECTED_SESSION_BROWSER; >- return ( Browser )getSession().getAttribute( id ); >- } >- > public static String getWebAppBase() { > IEngineConfig engineConfig = ConfigurationReader.getEngineConfig(); > return engineConfig.getServerContextDir().toString(); >Index: src/org/eclipse/rwt/internal/service/TemplateHolder.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/service/TemplateHolder.java >diff -N src/org/eclipse/rwt/internal/service/TemplateHolder.java >--- src/org/eclipse/rwt/internal/service/TemplateHolder.java 22 Jan 2010 10:34:36 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,165 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008, 2009 Innoopract Informationssysteme GmbH. >- * 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- * EclipseSource - ongoing development >- ******************************************************************************/ >-package org.eclipse.rwt.internal.service; >- >-import java.util.*; >- >-import org.eclipse.rwt.internal.util.ParamCheck; >- >- >-public final class TemplateHolder { >- >- private static final int[] EMPTY_INDICES = new int[ 0 ]; >- private final static String TOKEN_BACKGROUND_IMAGE = "backgroundImage"; >- private final static String TOKEN_LIBRARIES = "libraries"; >- private final static String TOKEN_APPSCRIPT = "appScript"; >- private final static String TOKEN_SERVLET = "servlet"; >- private final static String TOKEN_ENTRY_POINT = "entrypoint"; >- private final static String TOKEN_BODY = "body"; >- private final static String TOKEN_TITLE = "title"; >- private final static String TOKEN_HEADERS = "headers"; >- private final static String TOKEN_STARTUP = "startup"; >- private final static String TOKEN_EXIT_CONFIRMATION = "exitConfirmation"; >- private final static String TOKEN_NO_SCRIPT_MESSAGE = "noScriptMessage"; >- >- public final static Variable VAR_BACKGROUND_IMAGE >- = new Variable( TOKEN_BACKGROUND_IMAGE ); >- public final static Variable VAR_LIBRARIES >- = new Variable( TOKEN_LIBRARIES ); >- public final static Variable VAR_APPSCRIPT >- = new Variable( TOKEN_APPSCRIPT ); >- public final static Variable VAR_SERVLET >- = new Variable( TOKEN_SERVLET ); >- public final static Variable VAR_ENTRY_POINT >- = new Variable( TOKEN_ENTRY_POINT ); >- public final static Variable VAR_BODY >- = new Variable( TOKEN_BODY ); >- public final static Variable VAR_TITLE >- = new Variable( TOKEN_TITLE ); >- public final static Variable VAR_HEADERS >- = new Variable( TOKEN_HEADERS ); >- public final static Variable VAR_STARTUP >- = new Variable( TOKEN_STARTUP ); >- public final static Variable VAR_EXIT_CONFIRMATION >- = new Variable( TOKEN_EXIT_CONFIRMATION ); >- public final static Variable VAR_NO_SCRIPT_MESSAGE >- = new Variable( TOKEN_NO_SCRIPT_MESSAGE ); >- >- >- public static final class Variable { >- >- private final static Map NAMES = new HashMap(); >- private final String name; >- >- private Variable( final String varName ) { >- this.name = varName; >- NAMES.put( varName, this ); >- } >- >- private static Variable lookup( final String name ) { >- return ( Variable )NAMES.get( name ); >- } >- >- public String toString() { >- return "${" + name + "}"; >- } >- } >- >- >- private final String[] tokens; >- private final Map replacementIndices; >- >- >- public TemplateHolder( final String template ) { >- ParamCheck.notNull( template, "template" ); >- replacementIndices = new HashMap(); >- StringTokenizer tokenizer = new StringTokenizer( template, "${}", true ); >- int countTokens = tokenizer.countTokens(); >- tokens = new String[ countTokens ]; >- boolean ignoreNextToken = false; >- for( int i = 0; i < tokens.length; i++ ) { >- String nextToken = tokenizer.nextToken(); >- if( ignoreNextToken ) { >- ignoreNextToken = false; >- } else if( !isVariableToken( nextToken ) ) { >- tokens[ i ] = nextToken; >- } else { >- Variable variable = Variable.lookup( nextToken ); >- addReplacementIndex( variable, i ); >- tokens[ i - 1 ] = ""; >- tokens[ i - 2 ] = ""; >- tokens[ i + 1 ] = ""; >- ignoreNextToken = true; >- } >- } >- } >- >- private boolean isVariableToken( final String nextToken ) { >- return nextToken.equals( TOKEN_BACKGROUND_IMAGE.toString() ) >- || nextToken.equals( TOKEN_LIBRARIES.toString() ) >- || nextToken.equals( TOKEN_APPSCRIPT.toString() ) >- || nextToken.equals( TOKEN_SERVLET.toString() ) >- || nextToken.equals( TOKEN_ENTRY_POINT.toString() ) >- || nextToken.equals( TOKEN_BODY.toString() ) >- || nextToken.equals( TOKEN_TITLE.toString() ) >- || nextToken.equals( TOKEN_HEADERS.toString() ) >- || nextToken.equals( TOKEN_STARTUP.toString() ) >- || nextToken.equals( TOKEN_EXIT_CONFIRMATION.toString() ) >- || nextToken.equals( TOKEN_NO_SCRIPT_MESSAGE.toString() ); >- } >- >- private void addReplacementIndex( final Variable variable, final int index ) { >- List indices = ( List )replacementIndices.get( variable ); >- if( indices == null ) { >- indices = new ArrayList(); >- replacementIndices.put( variable, indices ); >- } >- indices.add( new Integer( index ) ); >- } >- >- private int[] getReplacementIndices( final Variable variable ) { >- List indices = ( List )replacementIndices.get( variable ); >- int[] result = null; >- if( indices == null ) { >- result = EMPTY_INDICES; >- } else { >- Object[] buffer = indices.toArray(); >- result = new int[ buffer.length ]; >- for( int i = 0; i < result.length; i++ ) { >- result[ i ] = ( ( Integer )buffer[ i ] ).intValue(); >- } >- } >- return result; >- } >- public String[] getTokens() { >- // no secure copy due to performance reasons... >- return tokens; >- } >- >- public void replace( final Variable toReplace, final String replacement ) { >- int[] indices = getReplacementIndices( toReplace ); >- for( int i = 0; i < indices.length; i++ ) { >- tokens[ indices[ i ] ] = replacement; >- } >- } >- >- public void reset() { >- Iterator iterator = Variable.NAMES.values().iterator(); >- while( iterator.hasNext() ) { >- Variable variable = ( Variable )iterator.next(); >- int[] indices = getReplacementIndices( variable ); >- for( int i = 0; i < indices.length; i++ ) { >- tokens[ indices[ i ] ] = null; >- } >- } >- } >-} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/service/ServiceContext.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/service/ServiceContext.java,v >retrieving revision 1.3 >diff -u -r1.3 ServiceContext.java >--- src/org/eclipse/rwt/internal/service/ServiceContext.java 12 Jun 2008 13:12:17 -0000 1.3 >+++ src/org/eclipse/rwt/internal/service/ServiceContext.java 9 Feb 2010 15:18:18 -0000 >@@ -26,13 +26,6 @@ > */ > public final class ServiceContext { > >- /** >- * The key which is used to store the {@link org.eclipse.rwt.internal.browser.Browser} instance >- * of the current session. >- */ >- public final static String DETECTED_SESSION_BROWSER >- = "com_w4t_detected_session_browser"; >- > private HttpServletRequest request; > private HttpServletResponse response; > private IServiceStateInfo stateInfo; >Index: src/org/eclipse/rwt/service/IServiceStore.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/service/IServiceStore.java,v >retrieving revision 1.2 >diff -u -r1.2 IServiceStore.java >--- src/org/eclipse/rwt/service/IServiceStore.java 27 Sep 2007 22:08:24 -0000 1.2 >+++ src/org/eclipse/rwt/service/IServiceStore.java 9 Feb 2010 15:18:18 -0000 >@@ -8,7 +8,6 @@ > * Contributors: > * Innoopract Informationssysteme GmbH - initial API and implementation > ******************************************************************************/ >- > package org.eclipse.rwt.service; > > >Index: src/browserdetection.xml >=================================================================== >RCS file: src/browserdetection.xml >diff -N src/browserdetection.xml >--- src/browserdetection.xml 14 Aug 2007 23:07:12 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,27 +0,0 @@ >-<?xml version="1.0" encoding="UTF-8"?> >-<browserdef> >- <browser> >- <name>Safari</name> >- <classname>org.eclipse.rwt.internal.browser.DetectorSafari</classname> >- </browser> >- >- <browser> >- <name>Konqueror</name> >- <classname>org.eclipse.rwt.internal.browser.DetectorKonqueror</classname> >- </browser> >- >- <browser> >- <name>Opera</name> >- <classname>org.eclipse.rwt.internal.browser.DetectorOpera</classname> >- </browser> >- >- <browser> >- <name>Internet Explorer</name> >- <classname>org.eclipse.rwt.internal.browser.DetectorIE</classname> >- </browser> >- >- <browser> >- <name>Mozilla</name> >- <classname>org.eclipse.rwt.internal.browser.DetectorMozilla</classname> >- </browser> >-</browserdef> >\ No newline at end of file >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/META-INF/MANIFEST.MF,v >retrieving revision 1.51 >diff -u -r1.51 MANIFEST.MF >--- META-INF/MANIFEST.MF 27 Nov 2009 17:20:24 -0000 1.51 >+++ META-INF/MANIFEST.MF 9 Feb 2010 15:18:17 -0000 >@@ -26,11 +26,6 @@ > org.eclipse.rap.rwt.test, > org.eclipse.rap.ui.workbench", > org.eclipse.rwt.internal.branding;x-friends:="org.eclipse.rap.rwt.test,org.eclipse.rap.ui.workbench", >- org.eclipse.rwt.internal.browser; >- x-friends:="org.eclipse.rap.w4t, >- org.eclipse.rap.w4t.test, >- org.eclipse.rap.rwt.test, >- org.eclipse.rap.ui.workbench", > org.eclipse.rwt.internal.engine; > x-friends:="org.eclipse.rap.w4t, > org.eclipse.rap.w4t.test, >Index: src/org/eclipse/rwt/internal/branding/BrandingUtil.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/branding/BrandingUtil.java,v >retrieving revision 1.11 >diff -u -r1.11 BrandingUtil.java >--- src/org/eclipse/rwt/internal/branding/BrandingUtil.java 7 Sep 2009 14:55:57 -0000 1.11 >+++ src/org/eclipse/rwt/internal/branding/BrandingUtil.java 9 Feb 2010 15:18:17 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.rwt.branding.Header; > import org.eclipse.rwt.internal.lifecycle.CommonPatterns; > import org.eclipse.rwt.internal.service.*; >+import org.eclipse.rwt.internal.util.URLHelper; > > > public final class BrandingUtil { >@@ -24,8 +25,8 @@ > private static final String ATTR_BRANDING_ID > = BrandingUtil.class.getName() + "#brandingId"; > >- public static void replacePlaceholder( final TemplateHolder template, >- final TemplateHolder.Variable variable, >+ public static void replacePlaceholder( final StartupPageTemplateHolder template, >+ final StartupPageTemplateHolder.Variable variable, > final String replacement ) > { > String safeReplacement = replacement == null ? "" : replacement; >@@ -60,7 +61,7 @@ > > public static AbstractBranding findBranding() { > HttpServletRequest request = ContextProvider.getRequest(); >- String servletName = BrowserSurvey.getSerlvetName(); >+ String servletName = URLHelper.getSerlvetName(); > String entryPoint = request.getParameter( RequestParams.STARTUP ); > AbstractBranding branding = BrandingManager.get( servletName, entryPoint ); > RWT.getSessionStore().setAttribute( ATTR_BRANDING_ID, branding.getId() ); >Index: src/org/eclipse/rwt/internal/lifecycle/HtmlResponseWriter.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/lifecycle/HtmlResponseWriter.java,v >retrieving revision 1.6 >diff -u -r1.6 HtmlResponseWriter.java >--- src/org/eclipse/rwt/internal/lifecycle/HtmlResponseWriter.java 21 Jan 2010 15:36:09 -0000 1.6 >+++ src/org/eclipse/rwt/internal/lifecycle/HtmlResponseWriter.java 9 Feb 2010 15:18:17 -0000 >@@ -45,56 +45,18 @@ > public static final String CLASS_PREFIX = "w4tCss"; > > >- private List head = new ArrayList(); >- private List body = new ArrayList(); >- private List layers = new ArrayList(); >- private List foot = new ArrayList(); >+ private List body = new ArrayList(); > > private String elementStarted; > private boolean closed; > private boolean avoidEscape; > > >- /** contains css classes that have been collected from style settings on >- * components. Every style content (keys) gets assigned a generated >- * class name (elements). >- * >- * It is assured that for every content there is exactly one class name, >- * and the latter is used when the style declaration >- */ >- private Hashtable registeredCssClasses = new Hashtable(); >- /** contains css classes that have been set and named programmatically, >- * that is which have been set with class name and content (keys). >- * The elements are ArrayLists with all the class names assigned to >- * the content that is the key. >- * >- * This means that, as opposed to managedCssClasses, there can be more than >- * one class name for the same content. In this case a content gets a name >- * of the form ".someName, .someOtherName" >- */ >- private Hashtable namedCssClasses = new Hashtable(); > /** contains the names of the javascript libraries that are needed for > * the content which was rendered into this HtmlResponseWriter. */ > private List jsLibraries = new ArrayList(); > > >- /** >- * <p>Append a token to the token list of the header's token</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendHead( final StringBuffer token ) { >- head.add( token.toString() ); >- } >- >- /** >- * <p>Append the given <code>token</code> to the token list of the header's >- * token</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendHead( final String token ) { >- head.add( token ); >- } >- > /** > * <p>Append a token to the token list of the body's token</p> > * <p>This method is not inteded to be used by clients.</p> >@@ -114,58 +76,6 @@ > } > } > >- /** >- * <p>Append a token to the list of footer tokens</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendFoot( final StringBuffer token ) { >- foot.add( token.toString() ); >- } >- >- /** >- * <p>Append the given <code>token</code> to the list of footer tokens.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendFoot( final String token ) { >- foot.add( token ); >- } >- >- /** >- * <p>Append a token to the list of layer tokens</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendLayer( final StringBuffer token ) { >- appendLayer( token.toString() ); >- } >- >- /** >- * <p>Append a token to the list of layer tokens</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void appendLayer( final String token ) { >- layers.add( token ); >- } >- >- /** <p>Concatenates this HtmlResponseWriter's layers to its body token list. >- * </p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void concatLayers() { >- for( int i = 0; i < layers.size(); i++ ) { >- append( layers.get( i ).toString() ); >- } >- layers.clear(); >- } >- >- /** >- * <p>Removes all of the tokens from the head list. The head list will be >- * empty after this call returns.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void clearHead() { >- head.clear(); >- } >- > /** > * <p>Removes all of the tokens from the body list. The body list will be > * empty after this call returns</p> >@@ -175,23 +85,6 @@ > body.clear(); > } > >- /** >- * </p>Removes all of the tokens from the foot list. The foot list will be >- * empty after this call returns.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void clearFoot() { >- foot.clear(); >- } >- >- /** >- * <p>Returns the number of tokens in the head list.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public int getHeadSize() { >- return head.size(); >- } >- > /** > * <p>Returns the number of tokens in the body list.</p> > * <p>This method is not inteded to be used by clients.</p> >@@ -200,22 +93,6 @@ > return body.size(); > } > >- /** >- * <p>Returns the number of tokens in the foot list.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public int getFootSize() { >- return foot.size(); >- } >- >- /** >- * <p>Returns the token at the specified position in the head list.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public String getHeadToken( final int index ) { >- return head.get( index ).toString(); >- } >- > /** > * <p>Returns the token at the specified position in the body list.</p> > * <p>This method is not inteded to be used by clients.</p> >@@ -232,37 +109,8 @@ > return body.iterator(); > } > >- /** >- * <p>Returns the token at the specified position in the foot list.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public String getFootToken( final int index ) { >- return foot.get( index ).toString(); >- } >- >- /** >- * <p>Equalizes the head, body and foot list of this HtmlResponseWriter with >- * the lists of the parameter HtmlResponseWriter.</p> >- * <p>This method is not inteded to be used by clients.</p> >- */ >- public void equalize( final HtmlResponseWriter tokenBuffer ) { >- this.foot.clear(); >- this.body.clear(); >- this.layers.clear(); >- this.head.clear(); >- this.jsLibraries.clear(); >- this.foot = tokenBuffer.foot; >- this.body = tokenBuffer.body; >- this.layers = tokenBuffer.layers; >- this.head = tokenBuffer.head; >- this.jsLibraries = tokenBuffer.jsLibraries; >- this.registeredCssClasses = tokenBuffer.registeredCssClasses; >- this.namedCssClasses = tokenBuffer.namedCssClasses; >- } >- >- >- // control methods for javascript library rendering > /////////////////////////////////////////////////// >+ // control methods for javascript library rendering > > /** <p>Returns the names of the JavaScript libraries that the components > * which were rendered into this HtmlResponseWriter need.</p> */ >@@ -316,106 +164,6 @@ > } > > >- /** <p>Returns a unique identifier for a css class that is contained in this >- * HtmlResponseWriter's cache and contains exactly the settings in the passed >- * <code>style</code>.</p> >- * >- * <p>If no entry for the passed content is contained yet, a name will be >- * generated.</p> >- * >- * <p>Any renderer that calls this method can be sure that the css class >- * named by the return value of this method is available in the HTML >- * document (the corresponding style tag will be rendered into the head >- * section of the HTML document).</p> >- */ >- public String registerCssClass( final String style ) { >- String result = ""; >- if( registeredCssClasses.containsKey( style ) ) { >- result = ( String )registeredCssClasses.get( style ); >- } else { >- result = createClassName( style ); >- registeredCssClasses.put( style, result ); >- } >- return result; >- } >- >- /** <p>Adds the passed css class to the classes that are declared on top >- * of the page.</p> */ >- public void addNamedCssClass( final CssClass cssClass ) { >- Assert.isNotNull( cssClass ); >- >- String content = cssClass.getContent(); >- List allNames; >- if( namedCssClasses.containsKey( content ) ) { >- allNames = ( List )namedCssClasses.get( content ); >- } else { >- allNames = new ArrayList(); >- namedCssClasses.put( content, allNames ); >- } >- if( !allNames.contains( cssClass.getClassName() ) ) { >- allNames.add( cssClass.getClassName() ); >- } >- } >- >- /** <p>Adds the passed css classes to the classes that are declared on top >- * of the page; they will be regarded as if they had been registered with >- * {@link #registerCssClass( String ) registerCssClass()}.</p> */ >- public void mergeRegisteredCssClasses( final CssClass[] classes ) { >- for( int i = 0; i < classes.length; i++ ) { >- Assert.isNotNull( classes[ i ] ); >- registeredCssClasses.put( classes[ i ].getContent(), >- classes[ i ].getClassName() ); >- } >- } >- >- /** <p>Returns the css classes that have been used for rendering >- * into this HtmlResponseWriter, this includes the classes managed by the >- * library and the named classes set by the user.</p> */ >- public CssClass[] getCssClasses() { >- ArrayList alResult = new ArrayList(); >- Enumeration keys = registeredCssClasses.keys(); >- while( keys.hasMoreElements() ) { >- String content = ( String )keys.nextElement(); >- String className = ( String )registeredCssClasses.get( content ); >- if( !className.startsWith( "." ) ) { >- className = "." + className; >- } >- alResult.add( new CssClass( className, content ) ); >- } >- keys = namedCssClasses.keys(); >- while( keys.hasMoreElements() ) { >- String content = ( String )keys.nextElement(); >- ArrayList alNames = ( ArrayList )namedCssClasses.get( content ); >- String className = getCompoundName( alNames ); >- alResult.add( new CssClass( className, content ) ); >- } >- CssClass[] result = new CssClass[ alResult.size() ]; >- alResult.toArray( result ); >- return result; >- } >- >- /** >- * <p>Returns the number of css classes that were registered via calls to >- * <code>addNamedCssClass(CssClass)</code> or >- * <code>registerCssClass(String)</code></p> >- */ >- public int getCssClassCount() { >- return registeredCssClasses.size() + namedCssClasses.size(); >- } >- >- /** >- * <p>Removes the css class which contains the given <code>content</code> >- * from list of registered css classes.</p> >- * <p>Does nothing if there is no css class with the given >- * <code>content</code>.</p> >- * @param content the content of the css class to be removed. >- */ >- public void removeCssClass( final String content ) { >- registeredCssClasses.remove( content ); >- // Note: do not remove namedCssClasses, since then different styles for the >- // same css classname cannot be dynamically switched in AJAX-mode >- } >- > ////////////////// > // response writer > >@@ -634,8 +382,6 @@ > */ > // TODO [rh] We could check whether 'elementStarted' is null, since comments > // are not allowed inside element tags in XHTML 'mode' >- // TODO [rh] calling this method 'inside' an AJaX envelope leads to invalid >- // XML > public void writeComment( final Object comment ) throws IOException { > checkIfWriterClosed(); > ParamCheck.notNull( comment, "comment" ); >@@ -705,24 +451,10 @@ > // helping methods > ////////////////// > >- private static String getCompoundName( final List allNames ) { >- Assert.isTrue( allNames.size() > 0 ); >- String result = "." + ( String )allNames.get( 0 ); >- for( int i = 1; i < allNames.size(); i++ ) { >- result += ", ." + ( String )allNames.get( i ); >- } >- return result; >- } >- >- private static String createClassName( final String key ) { >- return CLASS_PREFIX + Integer.toHexString( key.hashCode() ); >- } >- >- private void checkIfWriterClosed() throws IOException { >- // TODO [rh] replace by IllegalStateException? >+ private void checkIfWriterClosed() { > if( closed ) { > String msg = "Operation is not allowed since the writer was closed."; >- throw new IOException( msg ); >+ throw new IllegalStateException( msg ); > } > } > } >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/service/StartupPage.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/service/StartupPage.java >diff -N src/org/eclipse/rwt/internal/service/StartupPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rwt/internal/service/StartupPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,101 @@ >+/******************************************************************************* >+ * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ * EclipseSource - ongoing development >+ ******************************************************************************/ >+package org.eclipse.rwt.internal.service; >+ >+import java.io.IOException; >+ >+import javax.servlet.http.HttpServletRequest; >+ >+import org.eclipse.rwt.RWT; >+import org.eclipse.rwt.branding.AbstractBranding; >+import org.eclipse.rwt.internal.branding.BrandingUtil; >+import org.eclipse.rwt.internal.lifecycle.EntryPointManager; >+import org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter; >+import org.eclipse.rwt.internal.theme.*; >+import org.eclipse.rwt.internal.util.*; >+ >+ >+/** >+ * <p>A helping class that loads a special html page in order to >+ * bootstrap the client-side session.</p> >+ */ >+public final class StartupPage { >+ >+ public interface IStartupPageConfigurer { >+ StartupPageTemplateHolder getTemplate() throws IOException; >+ boolean isModifiedSince(); >+ } >+ >+ public static IStartupPageConfigurer configurer >+ = new RWTStartupPageConfigurer(); >+ >+ static void send() throws IOException { >+ if( configurer.isModifiedSince() ) { >+ // send out the survey >+ render(); >+ } else { >+ AbstractBranding branding = BrandingUtil.findBranding(); >+ if( branding.getThemeId() != null ) { >+ ThemeUtil.setCurrentThemeId( branding.getThemeId() ); >+ } >+ } >+ } >+ >+ private static String getBgImage() { >+ String result = ""; >+ QxType cssValue = ThemeUtil.getCssValue( "Display", >+ "background-image", >+ SimpleSelector.DEFAULT ); >+ if( cssValue instanceof QxImage ) { >+ QxImage image = ( QxImage )cssValue; >+ // path is null if non-existing image was specified in css file >+ String resourceName = image.getResourceName(); >+ if( resourceName != null ) { >+ result = RWT.getResourceManager().getLocation( resourceName ); >+ } >+ } >+ return result; >+ } >+ >+ private static void render() throws IOException { >+ ContextProvider.getResponse().setContentType( HTML.CONTENT_TEXT_HTML ); >+ StartupPageTemplateHolder template = configurer.getTemplate(); >+ template.replace( StartupPageTemplateHolder.VAR_BACKGROUND_IMAGE, >+ getBgImage() ); >+ // TODO [fappel]: check whether servletName has to be url encoded >+ // in case the client has switched of cookies >+ template.replace( StartupPageTemplateHolder.VAR_SERVLET, >+ URLHelper.getSerlvetName() ); >+ template.replace( StartupPageTemplateHolder.VAR_ENTRY_POINT, >+ EntitiesUtil.encodeHTMLEntities( getEntryPoint() ) ); >+ String[] tokens = template.getTokens(); >+ for( int i = 0; i < tokens.length; i++ ) { >+ if( tokens[ i ] != null ) { >+ getResponseWriter().append( tokens[ i ] ); >+ } >+ } >+ } >+ >+ private static String getEntryPoint() { >+ HttpServletRequest request = ContextProvider.getRequest(); >+ String result = request.getParameter( RequestParams.STARTUP ); >+ if( result == null ) { >+ result = EntryPointManager.DEFAULT; >+ } >+ return result; >+ } >+ >+ private static HtmlResponseWriter getResponseWriter() { >+ IServiceStateInfo stateInfo = ContextProvider.getStateInfo(); >+ return stateInfo.getResponseWriter(); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/rwt/internal/service/StartupPageTemplateHolder.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/service/StartupPageTemplateHolder.java >diff -N src/org/eclipse/rwt/internal/service/StartupPageTemplateHolder.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rwt/internal/service/StartupPageTemplateHolder.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,165 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ * EclipseSource - ongoing development >+ ******************************************************************************/ >+package org.eclipse.rwt.internal.service; >+ >+import java.util.*; >+ >+import org.eclipse.rwt.internal.util.ParamCheck; >+ >+ >+public final class StartupPageTemplateHolder { >+ >+ private static final int[] EMPTY_INDICES = new int[ 0 ]; >+ private final static String TOKEN_BACKGROUND_IMAGE = "backgroundImage"; >+ private final static String TOKEN_LIBRARIES = "libraries"; >+ private final static String TOKEN_APPSCRIPT = "appScript"; >+ private final static String TOKEN_SERVLET = "servlet"; >+ private final static String TOKEN_ENTRY_POINT = "entrypoint"; >+ private final static String TOKEN_BODY = "body"; >+ private final static String TOKEN_TITLE = "title"; >+ private final static String TOKEN_HEADERS = "headers"; >+ private final static String TOKEN_STARTUP = "startup"; >+ private final static String TOKEN_EXIT_CONFIRMATION = "exitConfirmation"; >+ private final static String TOKEN_NO_SCRIPT_MESSAGE = "noScriptMessage"; >+ >+ public final static Variable VAR_BACKGROUND_IMAGE >+ = new Variable( TOKEN_BACKGROUND_IMAGE ); >+ public final static Variable VAR_LIBRARIES >+ = new Variable( TOKEN_LIBRARIES ); >+ public final static Variable VAR_APPSCRIPT >+ = new Variable( TOKEN_APPSCRIPT ); >+ public final static Variable VAR_SERVLET >+ = new Variable( TOKEN_SERVLET ); >+ public final static Variable VAR_ENTRY_POINT >+ = new Variable( TOKEN_ENTRY_POINT ); >+ public final static Variable VAR_BODY >+ = new Variable( TOKEN_BODY ); >+ public final static Variable VAR_TITLE >+ = new Variable( TOKEN_TITLE ); >+ public final static Variable VAR_HEADERS >+ = new Variable( TOKEN_HEADERS ); >+ public final static Variable VAR_STARTUP >+ = new Variable( TOKEN_STARTUP ); >+ public final static Variable VAR_EXIT_CONFIRMATION >+ = new Variable( TOKEN_EXIT_CONFIRMATION ); >+ public final static Variable VAR_NO_SCRIPT_MESSAGE >+ = new Variable( TOKEN_NO_SCRIPT_MESSAGE ); >+ >+ >+ public static final class Variable { >+ >+ private final static Map NAMES = new HashMap(); >+ private final String name; >+ >+ private Variable( final String varName ) { >+ this.name = varName; >+ NAMES.put( varName, this ); >+ } >+ >+ private static Variable lookup( final String name ) { >+ return ( Variable )NAMES.get( name ); >+ } >+ >+ public String toString() { >+ return "${" + name + "}"; >+ } >+ } >+ >+ >+ private final String[] tokens; >+ private final Map replacementIndices; >+ >+ >+ public StartupPageTemplateHolder( final String template ) { >+ ParamCheck.notNull( template, "template" ); >+ replacementIndices = new HashMap(); >+ StringTokenizer tokenizer = new StringTokenizer( template, "${}", true ); >+ int countTokens = tokenizer.countTokens(); >+ tokens = new String[ countTokens ]; >+ boolean ignoreNextToken = false; >+ for( int i = 0; i < tokens.length; i++ ) { >+ String nextToken = tokenizer.nextToken(); >+ if( ignoreNextToken ) { >+ ignoreNextToken = false; >+ } else if( !isVariableToken( nextToken ) ) { >+ tokens[ i ] = nextToken; >+ } else { >+ Variable variable = Variable.lookup( nextToken ); >+ addReplacementIndex( variable, i ); >+ tokens[ i - 1 ] = ""; >+ tokens[ i - 2 ] = ""; >+ tokens[ i + 1 ] = ""; >+ ignoreNextToken = true; >+ } >+ } >+ } >+ >+ private boolean isVariableToken( final String nextToken ) { >+ return nextToken.equals( TOKEN_BACKGROUND_IMAGE.toString() ) >+ || nextToken.equals( TOKEN_LIBRARIES.toString() ) >+ || nextToken.equals( TOKEN_APPSCRIPT.toString() ) >+ || nextToken.equals( TOKEN_SERVLET.toString() ) >+ || nextToken.equals( TOKEN_ENTRY_POINT.toString() ) >+ || nextToken.equals( TOKEN_BODY.toString() ) >+ || nextToken.equals( TOKEN_TITLE.toString() ) >+ || nextToken.equals( TOKEN_HEADERS.toString() ) >+ || nextToken.equals( TOKEN_STARTUP.toString() ) >+ || nextToken.equals( TOKEN_EXIT_CONFIRMATION.toString() ) >+ || nextToken.equals( TOKEN_NO_SCRIPT_MESSAGE.toString() ); >+ } >+ >+ private void addReplacementIndex( final Variable variable, final int index ) { >+ List indices = ( List )replacementIndices.get( variable ); >+ if( indices == null ) { >+ indices = new ArrayList(); >+ replacementIndices.put( variable, indices ); >+ } >+ indices.add( new Integer( index ) ); >+ } >+ >+ private int[] getReplacementIndices( final Variable variable ) { >+ List indices = ( List )replacementIndices.get( variable ); >+ int[] result = null; >+ if( indices == null ) { >+ result = EMPTY_INDICES; >+ } else { >+ Object[] buffer = indices.toArray(); >+ result = new int[ buffer.length ]; >+ for( int i = 0; i < result.length; i++ ) { >+ result[ i ] = ( ( Integer )buffer[ i ] ).intValue(); >+ } >+ } >+ return result; >+ } >+ public String[] getTokens() { >+ // no secure copy due to performance reasons... >+ return tokens; >+ } >+ >+ public void replace( final Variable toReplace, final String replacement ) { >+ int[] indices = getReplacementIndices( toReplace ); >+ for( int i = 0; i < indices.length; i++ ) { >+ tokens[ indices[ i ] ] = replacement; >+ } >+ } >+ >+ public void reset() { >+ Iterator iterator = Variable.NAMES.values().iterator(); >+ while( iterator.hasNext() ) { >+ Variable variable = ( Variable )iterator.next(); >+ int[] indices = getReplacementIndices( variable ); >+ for( int i = 0; i < indices.length; i++ ) { >+ tokens[ indices[ i ] ] = null; >+ } >+ } >+ } >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 302274
: 158598