JDK-4880230 : HTML upgrade to stay current with the standard 4.01
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2003-06-18
  • Updated: 2005-04-14
  • Resolved: 2005-04-14
Related Reports
Duplicate :  
Description

Name: rl43681			Date: 06/17/2003


A DESCRIPTION OF THE REQUEST :
The current java release (1.4.1_02) HTML support has never changed since its original release in j2se 1.2.

Packages javax.swing.text.html and javax.swing.text.html.parser are both using the old and deprecated HTML 3.2 specification.

Many applications need HTML support, for input, output or rendering, so upgrading this packages to stay current with the standard its a must.



JUSTIFICATION :
quoting the W3c.org specification
http://www.w3.org/TR/html401/

This specification defines HTML 4.01, which is a subversion of HTML 4. In addition to the text, multimedia, and hyperlink features of the previous versions of HTML (HTML 3.2 [HTML32] and HTML 2.0 [RFC1866]), HTML 4 supports more multimedia options, scripting languages, style sheets, better printing facilities, and documents that are more accessible to users with disabilities. HTML 4 also takes great strides towards the internationalization of documents, with the goal of making the Web truly World Wide.
[...]
W3C recommends that user agents and authors (and in particular, authoring tools) produce HTML 4.01 documents rather than HTML 4.0 documents. W3C recommends that authors produce HTML 4 documents instead of HTML 3.2 documents. For reasons of backward compatibility, W3C also recommends that tools interpreting HTML 4 continue to support HTML 3.2 and HTML 2.0 as well.

EXPECTED VERSUS ACTUAL BEHAVIOR :
A rendering engine which displays well formed HTML4.01 documents
http://www.w3.org/TR/html401/appendix/changes.html#h-A.3

---------- BEGIN SOURCE ----------

package browser;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.Cursor;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JEditorPane;
import javax.swing.JOptionPane;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.event.HyperlinkListener;
import javax.swing.event.HyperlinkEvent;
import java.net.URL;

/** HTML 3.2 browser
  * @author <a href="mailto:###@###.###">Fernando Racca</a>
  */

public class Browser extends JFrame
{

    protected JEditorPane   browser;
    protected JTextField    location;
    
    public Browser()
    {
	super("HTML 3.2 Browser");
		
	JPanel p = new JPanel();
	p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
	p.add(new JLabel("Address"));
	p.add(Box.createRigidArea(new Dimension(10, 1)));

	location = new JTextField();
	BrowserListener lst = new BrowserListener();
	location.addActionListener(lst);

	p.add(location);
	p.add(Box.createRigidArea(new Dimension(10, 1)));

	getContentPane().add(p, BorderLayout.NORTH);

	browser = new JEditorPane();
    browser.setPreferredSize(new Dimension(400,300));
	browser.setEditable(false);
	browser.addHyperlinkListener(lst);

	JScrollPane sp = new JScrollPane();
	sp.getViewport().add(browser);
	getContentPane().add(sp, BorderLayout.CENTER);

    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	
    pack();
	setVisible(true);
    
	location.grabFocus();
    }
	
    class BrowserListener  implements ActionListener, HyperlinkListener
    {
		public void actionPerformed(ActionEvent evt)
		{
			String sUrl = (String) location.getText();

			BrowserLoader loader = new BrowserLoader(sUrl);
			loader.start();
		}

		public void hyperlinkUpdate(HyperlinkEvent e)
		{
			URL url = e.getURL();

			BrowserLoader loader = new BrowserLoader(url.toString());
			loader.start();
		}
   }

	
	class BrowserLoader extends Thread
	{
		protected String m_sUrl;

		public BrowserLoader(String sUrl)
		{
			m_sUrl = sUrl;
		}

		public void run()
		{
			setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

			try
			{
				URL source = new URL(m_sUrl);
				browser.setPage(source);
			}
			catch (Exception e)
			{
				JOptionPane.showMessageDialog(Browser.this,
					"Error: "+e.toString(),
					"Warning", JOptionPane.WARNING_MESSAGE);
			}

			setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	public static void main(String argv[])
	{
		new Browser();
	}

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Not Avaible, the demo shows that most of current websites cannot be displayed using HTML3.2
(Review ID: 182936) 
======================================================================

Comments
EVALUATION we will work on this for the next release ==== closing as duplicate of 4296022 html4.x support within a JEditorPane ###@###.### 2005-04-14 03:02:40 GMT
14-04-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
25-09-2004