ojluni: delete dead code in sun.net.www
These classes are unused.
Bug: 29569605
Change-Id: I9131cf7f1e2e4c24236e964429c0df0a7faea758
diff --git a/ojluni/src/main/java/sun/net/www/ApplicationLaunchException.java b/ojluni/src/main/java/sun/net/www/ApplicationLaunchException.java
deleted file mode 100755
index 3394cd3..0000000
--- a/ojluni/src/main/java/sun/net/www/ApplicationLaunchException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www;
-
-/**
- * An exception thrown by the MimeLauncher when it is unable to launch
- * an external content viewer.
- *
- * @author Sunita Mani
- */
-
-public class ApplicationLaunchException extends Exception {
- private static final long serialVersionUID = -4782286141289536883L;
-
- public ApplicationLaunchException(String reason) {
- super(reason);
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/MimeEntry.java b/ojluni/src/main/java/sun/net/www/MimeEntry.java
deleted file mode 100755
index 005d960..0000000
--- a/ojluni/src/main/java/sun/net/www/MimeEntry.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www;
-import java.net.URL;
-import java.io.*;
-import java.util.StringTokenizer;
-
-public class MimeEntry implements Cloneable {
- private String typeName; // of the form: "type/subtype"
- private String tempFileNameTemplate;
-
- private int action;
- private String command;
- private String description;
- private String imageFileName;
- private String fileExtensions[];
-
- boolean starred;
-
- // Actions
- public static final int UNKNOWN = 0;
- public static final int LOAD_INTO_BROWSER = 1;
- public static final int SAVE_TO_FILE = 2;
- public static final int LAUNCH_APPLICATION = 3;
-
- static final String[] actionKeywords = {
- "unknown",
- "browser",
- "save",
- "application",
- };
-
- /**
- * Construct an empty entry of the given type and subtype.
- */
- public MimeEntry(String type) {
- // Default action is UNKNOWN so clients can decide what the default
- // should be, typically save to file or ask user.
- this(type, UNKNOWN, null, null, null);
- }
-
- //
- // The next two constructors are used only by the deprecated
- // PlatformMimeTable classes or, in last case, is called by the public
- // constructor. They are kept here anticipating putting support for
- // mailcap formatted config files back in (so BOTH the properties format
- // and the mailcap formats are supported).
- //
- MimeEntry(String type, String imageFileName, String extensionString) {
- typeName = type.toLowerCase();
- action = UNKNOWN;
- command = null;
- this.imageFileName = imageFileName;
- setExtensions(extensionString);
- starred = isStarred(typeName);
- }
-
- // For use with MimeTable::parseMailCap
- MimeEntry(String typeName, int action, String command,
- String tempFileNameTemplate) {
- this.typeName = typeName.toLowerCase();
- this.action = action;
- this.command = command;
- this.imageFileName = null;
- this.fileExtensions = null;
-
- this.tempFileNameTemplate = tempFileNameTemplate;
- }
-
- // This is the one called by the public constructor.
- MimeEntry(String typeName, int action, String command,
- String imageFileName, String fileExtensions[]) {
-
- this.typeName = typeName.toLowerCase();
- this.action = action;
- this.command = command;
- this.imageFileName = imageFileName;
- this.fileExtensions = fileExtensions;
-
- starred = isStarred(typeName);
-
- }
-
- public synchronized String getType() {
- return typeName;
- }
-
- public synchronized void setType(String type) {
- typeName = type.toLowerCase();
- }
-
- public synchronized int getAction() {
- return action;
- }
-
- public synchronized void setAction(int action, String command) {
- this.action = action;
- this.command = command;
- }
-
- public synchronized void setAction(int action) {
- this.action = action;
- }
-
- public synchronized String getLaunchString() {
- return command;
- }
-
- public synchronized void setCommand(String command) {
- this.command = command;
- }
-
- public synchronized String getDescription() {
- return (description != null ? description : typeName);
- }
-
- public synchronized void setDescription(String description) {
- this.description = description;
- }
-
- // ??? what to return for the image -- the file name or should this return
- // something more advanced like an image source or something?
- // returning the name has the least policy associated with it.
- // pro tempore, we'll use the name
- public String getImageFileName() {
- return imageFileName;
- }
-
- public synchronized void setImageFileName(String filename) {
- File file = new File(filename);
- if (file.getParent() == null) {
- imageFileName = System.getProperty(
- "java.net.ftp.imagepath."+filename);
- }
- else {
- imageFileName = filename;
- }
-
- if (filename.lastIndexOf('.') < 0) {
- imageFileName = imageFileName + ".gif";
- }
- }
-
- public String getTempFileTemplate() {
- return tempFileNameTemplate;
- }
-
- public synchronized String[] getExtensions() {
- return fileExtensions;
- }
-
- public synchronized String getExtensionsAsList() {
- String extensionsAsString = "";
- if (fileExtensions != null) {
- for (int i = 0; i < fileExtensions.length; i++) {
- extensionsAsString += fileExtensions[i];
- if (i < (fileExtensions.length - 1)) {
- extensionsAsString += ",";
- }
- }
- }
-
- return extensionsAsString;
- }
-
- public synchronized void setExtensions(String extensionString) {
- StringTokenizer extTokens = new StringTokenizer(extensionString, ",");
- int numExts = extTokens.countTokens();
- String extensionStrings[] = new String[numExts];
-
- for (int i = 0; i < numExts; i++) {
- String ext = (String)extTokens.nextElement();
- extensionStrings[i] = ext.trim();
- }
-
- fileExtensions = extensionStrings;
- }
-
- private boolean isStarred(String typeName) {
- return (typeName != null)
- && (typeName.length() > 0)
- && (typeName.endsWith("/*"));
- }
-
- /**
- * Invoke the MIME type specific behavior for this MIME type.
- * Returned value can be one of several types:
- * <ol>
- * <li>A thread -- the caller can choose when to launch this thread.
- * <li>A string -- the string is loaded into the browser directly.
- * <li>An input stream -- the caller can read from this byte stream and
- * will typically store the results in a file.
- * <li>A document (?) --
- * </ol>
- */
- public Object launch(java.net.URLConnection urlc, InputStream is, MimeTable mt) throws ApplicationLaunchException {
- switch (action) {
- case SAVE_TO_FILE:
- // REMIND: is this really the right thing to do?
- try {
- return is;
- } catch(Exception e) {
- // I18N
- return "Load to file failed:\n" + e;
- }
-
- case LOAD_INTO_BROWSER:
- // REMIND: invoke the content handler?
- // may be the right thing to do, may not be -- short term
- // where docs are not loaded asynch, loading and returning
- // the content is the right thing to do.
- try {
- return urlc.getContent();
- } catch (Exception e) {
- return null;
- }
-
- case LAUNCH_APPLICATION:
- {
- String threadName = command;
- int fst = threadName.indexOf(' ');
- if (fst > 0) {
- threadName = threadName.substring(0, fst);
- }
-
- return new MimeLauncher(this, urlc, is,
- mt.getTempFileTemplate(), threadName);
- }
-
- case UNKNOWN:
- // REMIND: What do do here?
- return null;
- }
-
- return null;
- }
-
- public boolean matches(String type) {
- if (starred) {
- // REMIND: is this the right thing or not?
- return type.startsWith(typeName);
- } else {
- return type.equals(typeName);
- }
- }
-
- public Object clone() {
- // return a shallow copy of this.
- MimeEntry theClone = new MimeEntry(typeName);
- theClone.action = action;
- theClone.command = command;
- theClone.description = description;
- theClone.imageFileName = imageFileName;
- theClone.tempFileNameTemplate = tempFileNameTemplate;
- theClone.fileExtensions = fileExtensions;
-
- return theClone;
- }
-
- public synchronized String toProperty() {
- StringBuffer buf = new StringBuffer();
-
- String separator = "; ";
- boolean needSeparator = false;
-
- int action = getAction();
- if (action != MimeEntry.UNKNOWN) {
- buf.append("action=" + actionKeywords[action]);
- needSeparator = true;
- }
-
- String command = getLaunchString();
- if (command != null && command.length() > 0) {
- if (needSeparator) {
- buf.append(separator);
- }
- buf.append("application=" + command);
- needSeparator = true;
- }
-
- if (getImageFileName() != null) {
- if (needSeparator) {
- buf.append(separator);
- }
- buf.append("icon=" + getImageFileName());
- needSeparator = true;
- }
-
- String extensions = getExtensionsAsList();
- if (extensions.length() > 0) {
- if (needSeparator) {
- buf.append(separator);
- }
- buf.append("file_extensions=" + extensions);
- needSeparator = true;
- }
-
- String description = getDescription();
- if (description != null && !description.equals(getType())) {
- if (needSeparator) {
- buf.append(separator);
- }
- buf.append("description=" + description);
- }
-
- return buf.toString();
- }
-
- public String toString() {
- return "MimeEntry[contentType=" + typeName
- + ", image=" + imageFileName
- + ", action=" + action
- + ", command=" + command
- + ", extensions=" + getExtensionsAsList()
- + "]";
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/MimeLauncher.java b/ojluni/src/main/java/sun/net/www/MimeLauncher.java
deleted file mode 100755
index ee4fb40..0000000
--- a/ojluni/src/main/java/sun/net/www/MimeLauncher.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 1994, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www;
-import java.net.URL;
-import java.io.*;
-import java.util.StringTokenizer;
-
-class MimeLauncher extends Thread {
- java.net.URLConnection uc;
- MimeEntry m;
- String genericTempFileTemplate;
- InputStream is;
- String execPath;
-
- MimeLauncher (MimeEntry M, java.net.URLConnection uc,
- InputStream is, String tempFileTemplate, String threadName) throws ApplicationLaunchException {
- super(threadName);
- m = M;
- this.uc = uc;
- this.is = is;
- genericTempFileTemplate = tempFileTemplate;
-
- /* get the application to launch */
- String launchString = m.getLaunchString();
-
- /* get a valid path to launch application - sets
- the execPath instance variable with the correct path.
- */
- if (!findExecutablePath(launchString)) {
- /* strip off parameters i.e %s */
- String appName;
- int index = launchString.indexOf(' ');
- if (index != -1) {
- appName = launchString.substring(0, index);
- }
- else {
- appName = launchString;
- }
- throw new ApplicationLaunchException(appName);
- }
- }
-
- protected String getTempFileName(URL url, String template) {
- String tempFilename = template;
-
- // Replace all but last occurrance of "%s" with timestamp to insure
- // uniqueness. There's a subtle behavior here: if there is anything
- // _after_ the last "%s" we need to append it so that unusual launch
- // strings that have the datafile in the middle can still be used.
- int wildcard = tempFilename.lastIndexOf("%s");
- String prefix = tempFilename.substring(0, wildcard);
-
- String suffix = "";
- if (wildcard < tempFilename.length() - 2) {
- suffix = tempFilename.substring(wildcard + 2);
- }
-
- long timestamp = System.currentTimeMillis()/1000;
- int argIndex = 0;
- while ((argIndex = prefix.indexOf("%s")) >= 0) {
- prefix = prefix.substring(0, argIndex)
- + timestamp
- + prefix.substring(argIndex + 2);
- }
-
- // Add a file name and file-extension if known
- String filename = url.getFile();
-
- String extension = "";
- int dot = filename.lastIndexOf('.');
-
- // BugId 4084826: Temp MIME file names not always valid.
- // Fix: don't allow slashes in the file name or extension.
- if (dot >= 0 && dot > filename.lastIndexOf('/')) {
- extension = filename.substring(dot);
- }
-
- filename = "HJ" + url.hashCode();
-
- tempFilename = prefix + filename + timestamp + extension + suffix;
-
- return tempFilename;
- }
-
- public void run() {
- try {
- String ofn = m.getTempFileTemplate();
- if (ofn == null) {
- ofn = genericTempFileTemplate;
- }
-
- ofn = getTempFileName(uc.getURL(), ofn);
- try {
- OutputStream os = new FileOutputStream(ofn);
- byte buf[] = new byte[2048];
- int i = 0;
- try {
- while ((i = is.read(buf)) >= 0) {
- os.write(buf, 0, i);
- }
- } catch(IOException e) {
- //System.err.println("Exception in write loop " + i);
- //e.printStackTrace();
- } finally {
- os.close();
- is.close();
- }
- } catch(IOException e) {
- //System.err.println("Exception in input or output stream");
- //e.printStackTrace();
- }
-
- int inx = 0;
- String c = execPath;
- while ((inx = c.indexOf("%t")) >= 0) {
- c = c.substring(0, inx) + uc.getContentType()
- + c.substring(inx + 2);
- }
-
- boolean substituted = false;
- while ((inx = c.indexOf("%s")) >= 0) {
- c = c.substring(0, inx) + ofn + c.substring(inx + 2);
- substituted = true;
- }
- if (!substituted)
- c = c + " <" + ofn;
-
- // System.out.println("Execing " +c);
-
- Runtime.getRuntime().exec(c);
- } catch(IOException e) {
- }
- }
-
- /* This method determines the path for the launcher application
- and sets the execPath instance variable. It uses the exec.path
- property to obtain a list of paths that is in turn used to
- location the application. If a valid path is not found, it
- returns false else true. */
- private boolean findExecutablePath(String str) {
- if (str == null || str.length() == 0) {
- return false;
- }
-
- String command;
- int index = str.indexOf(' ');
- if (index != -1) {
- command = str.substring(0, index);
- }
- else {
- command = str;
- }
-
- File f = new File(command);
- if (f.isFile()) {
- // Already executable as it is
- execPath = str;
- return true;
- }
-
- String execPathList;
- execPathList = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("exec.path"));
- if (execPathList == null) {
- // exec.path property not set
- return false;
- }
-
- StringTokenizer iter = new StringTokenizer(execPathList, "|");
- while (iter.hasMoreElements()) {
- String prefix = (String)iter.nextElement();
- String fullCmd = prefix + File.separator + command;
- f = new File(fullCmd);
- if (f.isFile()) {
- execPath = prefix + File.separator + str;
- return true;
- }
- }
-
- return false; // application not found in exec.path
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/MimeTable.java b/ojluni/src/main/java/sun/net/www/MimeTable.java
deleted file mode 100755
index b8b70fd..0000000
--- a/ojluni/src/main/java/sun/net/www/MimeTable.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www;
-import java.io.*;
-import java.util.Calendar;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.net.URL;
-import java.net.FileNameMap;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-public class MimeTable implements FileNameMap {
- /** Keyed by content type, returns MimeEntries */
- private Hashtable<String, MimeEntry> entries
- = new Hashtable<String, MimeEntry>();
-
- /** Keyed by file extension (with the .), returns MimeEntries */
- private Hashtable<String, MimeEntry> extensionMap
- = new Hashtable<String, MimeEntry>();
-
- // Will be reset if in the platform-specific data file
- private static String tempFileTemplate;
-
- static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- tempFileTemplate =
- System.getProperty("content.types.temp.file.template",
- "/tmp/%s");
-
- mailcapLocations = new String[] {
- System.getProperty("user.mailcap"),
- System.getProperty("user.home") + "/.mailcap",
- "/etc/mailcap",
- "/usr/etc/mailcap",
- "/usr/local/etc/mailcap",
- System.getProperty("hotjava.home",
- "/usr/local/hotjava")
- + "/lib/mailcap",
- };
- return null;
- }
- });
- }
-
-
- private static final String filePreamble = "sun.net.www MIME content-types table";
- private static final String fileMagic = "#" + filePreamble;
-
- MimeTable() {
- load();
- }
-
- private static class DefaultInstanceHolder {
- static final MimeTable defaultInstance = getDefaultInstance();
-
- static MimeTable getDefaultInstance() {
- return java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<MimeTable>() {
- public MimeTable run() {
- MimeTable instance = new MimeTable();
- URLConnection.setFileNameMap(instance);
- return instance;
- }
- });
- }
- }
-
- /**
- * Get the single instance of this class. First use will load the
- * table from a data file.
- */
- public static MimeTable getDefaultTable() {
- return DefaultInstanceHolder.defaultInstance;
- }
-
- /**
- *
- */
- public static FileNameMap loadTable() {
- MimeTable mt = getDefaultTable();
- return (FileNameMap)mt;
- }
-
- public synchronized int getSize() {
- return entries.size();
- }
-
- public synchronized String getContentTypeFor(String fileName) {
- MimeEntry entry = findByFileName(fileName);
- if (entry != null) {
- return entry.getType();
- } else {
- return null;
- }
- }
-
- public synchronized void add(MimeEntry m) {
- entries.put(m.getType(), m);
-
- String exts[] = m.getExtensions();
- if (exts == null) {
- return;
- }
-
- for (int i = 0; i < exts.length; i++) {
- extensionMap.put(exts[i], m);
- }
- }
-
- public synchronized MimeEntry remove(String type) {
- MimeEntry entry = entries.get(type);
- return remove(entry);
- }
-
- public synchronized MimeEntry remove(MimeEntry entry) {
- String[] extensionKeys = entry.getExtensions();
- if (extensionKeys != null) {
- for (int i = 0; i < extensionKeys.length; i++) {
- extensionMap.remove(extensionKeys[i]);
- }
- }
-
- return entries.remove(entry.getType());
- }
-
- public synchronized MimeEntry find(String type) {
- MimeEntry entry = entries.get(type);
- if (entry == null) {
- // try a wildcard lookup
- Enumeration<MimeEntry> e = entries.elements();
- while (e.hasMoreElements()) {
- MimeEntry wild = e.nextElement();
- if (wild.matches(type)) {
- return wild;
- }
- }
- }
-
- return entry;
- }
-
- /**
- * Locate a MimeEntry by the file extension that has been associated
- * with it. Parses general file names, and URLs.
- */
- public MimeEntry findByFileName(String fname) {
- String ext = "";
-
- int i = fname.lastIndexOf('#');
-
- if (i > 0) {
- fname = fname.substring(0, i - 1);
- }
-
- i = fname.lastIndexOf('.');
- // REMIND: OS specific delimters appear here
- i = Math.max(i, fname.lastIndexOf('/'));
- i = Math.max(i, fname.lastIndexOf('?'));
-
- if (i != -1 && fname.charAt(i) == '.') {
- ext = fname.substring(i).toLowerCase();
- }
-
- return findByExt(ext);
- }
-
- /**
- * Locate a MimeEntry by the file extension that has been associated
- * with it.
- */
- public synchronized MimeEntry findByExt(String fileExtension) {
- return extensionMap.get(fileExtension);
- }
-
- public synchronized MimeEntry findByDescription(String description) {
- Enumeration<MimeEntry> e = elements();
- while (e.hasMoreElements()) {
- MimeEntry entry = e.nextElement();
- if (description.equals(entry.getDescription())) {
- return entry;
- }
- }
-
- // We failed, now try treating description as type
- return find(description);
- }
-
- String getTempFileTemplate() {
- return tempFileTemplate;
- }
-
- public synchronized Enumeration<MimeEntry> elements() {
- return entries.elements();
- }
-
- // For backward compatibility -- mailcap format files
- // This is not currently used, but may in the future when we add ability
- // to read BOTH the properties format and the mailcap format.
- protected static String[] mailcapLocations;
-
- public synchronized void load() {
- Properties entries = new Properties();
- File file = null;
- try {
- InputStream is;
- // First try to load the user-specific table, if it exists
- String userTablePath =
- System.getProperty("content.types.user.table");
- if (userTablePath != null) {
- file = new File(userTablePath);
- if (!file.exists()) {
- // No user-table, try to load the default built-in table.
- file = new File(System.getProperty("java.home") +
- File.separator +
- "lib" +
- File.separator +
- "content-types.properties");
- }
- }
- else {
- // No user table, try to load the default built-in table.
- file = new File(System.getProperty("java.home") +
- File.separator +
- "lib" +
- File.separator +
- "content-types.properties");
- }
-
- is = new BufferedInputStream(new FileInputStream(file));
- entries.load(is);
- is.close();
- }
- catch (IOException e) {
- System.err.println("Warning: default mime table not found: " +
- file.getPath());
- return;
- }
- parse(entries);
- }
-
- void parse(Properties entries) {
- // first, strip out the platform-specific temp file template
- String tempFileTemplate = (String)entries.get("temp.file.template");
- if (tempFileTemplate != null) {
- entries.remove("temp.file.template");
- this.tempFileTemplate = tempFileTemplate;
- }
-
- // now, parse the mime-type spec's
- Enumeration<?> types = entries.propertyNames();
- while (types.hasMoreElements()) {
- String type = (String)types.nextElement();
- String attrs = entries.getProperty(type);
- parse(type, attrs);
- }
- }
-
- //
- // Table format:
- //
- // <entry> ::= <table_tag> | <type_entry>
- //
- // <table_tag> ::= <table_format_version> | <temp_file_template>
- //
- // <type_entry> ::= <type_subtype_pair> '=' <type_attrs_list>
- //
- // <type_subtype_pair> ::= <type> '/' <subtype>
- //
- // <type_attrs_list> ::= <attr_value_pair> [ ';' <attr_value_pair> ]*
- // | [ <attr_value_pair> ]+
- //
- // <attr_value_pair> ::= <attr_name> '=' <attr_value>
- //
- // <attr_name> ::= 'description' | 'action' | 'application'
- // | 'file_extensions' | 'icon'
- //
- // <attr_value> ::= <legal_char>*
- //
- // Embedded ';' in an <attr_value> are quoted with leading '\' .
- //
- // Interpretation of <attr_value> depends on the <attr_name> it is
- // associated with.
- //
-
- void parse(String type, String attrs) {
- MimeEntry newEntry = new MimeEntry(type);
-
- // REMIND handle embedded ';' and '|' and literal '"'
- StringTokenizer tokenizer = new StringTokenizer(attrs, ";");
- while (tokenizer.hasMoreTokens()) {
- String pair = tokenizer.nextToken();
- parse(pair, newEntry);
- }
-
- add(newEntry);
- }
-
- void parse(String pair, MimeEntry entry) {
- // REMIND add exception handling...
- String name = null;
- String value = null;
-
- boolean gotName = false;
- StringTokenizer tokenizer = new StringTokenizer(pair, "=");
- while (tokenizer.hasMoreTokens()) {
- if (gotName) {
- value = tokenizer.nextToken().trim();
- }
- else {
- name = tokenizer.nextToken().trim();
- gotName = true;
- }
- }
-
- fill(entry, name, value);
- }
-
- void fill(MimeEntry entry, String name, String value) {
- if ("description".equalsIgnoreCase(name)) {
- entry.setDescription(value);
- }
- else if ("action".equalsIgnoreCase(name)) {
- entry.setAction(getActionCode(value));
- }
- else if ("application".equalsIgnoreCase(name)) {
- entry.setCommand(value);
- }
- else if ("icon".equalsIgnoreCase(name)) {
- entry.setImageFileName(value);
- }
- else if ("file_extensions".equalsIgnoreCase(name)) {
- entry.setExtensions(value);
- }
-
- // else illegal name exception
- }
-
- String[] getExtensions(String list) {
- StringTokenizer tokenizer = new StringTokenizer(list, ",");
- int n = tokenizer.countTokens();
- String[] extensions = new String[n];
- for (int i = 0; i < n; i++) {
- extensions[i] = tokenizer.nextToken();
- }
-
- return extensions;
- }
-
- int getActionCode(String action) {
- for (int i = 0; i < MimeEntry.actionKeywords.length; i++) {
- if (action.equalsIgnoreCase(MimeEntry.actionKeywords[i])) {
- return i;
- }
- }
-
- return MimeEntry.UNKNOWN;
- }
-
- public synchronized boolean save(String filename) {
- if (filename == null) {
- filename = System.getProperty("user.home" +
- File.separator +
- "lib" +
- File.separator +
- "content-types.properties");
- }
-
- return saveAsProperties(new File(filename));
- }
-
- public Properties getAsProperties() {
- Properties properties = new Properties();
- Enumeration<MimeEntry> e = elements();
- while (e.hasMoreElements()) {
- MimeEntry entry = e.nextElement();
- properties.put(entry.getType(), entry.toProperty());
- }
-
- return properties;
- }
-
- protected boolean saveAsProperties(File file) {
- FileOutputStream os = null;
- try {
- os = new FileOutputStream(file);
- Properties properties = getAsProperties();
- properties.put("temp.file.template", tempFileTemplate);
- String tag;
- String user = System.getProperty("user.name");
- if (user != null) {
- tag = "; customized for " + user;
- properties.save(os, filePreamble + tag);
- }
- else {
- properties.save(os, filePreamble);
- }
- }
- catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- finally {
- if (os != null) {
- try { os.close(); } catch (IOException e) {}
- }
- }
-
- return true;
- }
- /*
- * Debugging utilities
- *
- public void list(PrintStream out) {
- Enumeration keys = entries.keys();
- while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- MimeEntry entry = (MimeEntry)entries.get(key);
- out.println(key + ": " + entry);
- }
- }
-
- public static void main(String[] args) {
- MimeTable testTable = MimeTable.getDefaultTable();
-
- Enumeration e = testTable.elements();
- while (e.hasMoreElements()) {
- MimeEntry entry = (MimeEntry)e.nextElement();
- System.out.println(entry);
- }
-
- testTable.save(File.separator + "tmp" +
- File.separator + "mime_table.save");
- }
- */
-}
diff --git a/ojluni/src/main/java/sun/net/www/protocol/gopher/GopherClient.java b/ojluni/src/main/java/sun/net/www/protocol/gopher/GopherClient.java
deleted file mode 100755
index dd19d40..0000000
--- a/ojluni/src/main/java/sun/net/www/protocol/gopher/GopherClient.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.net.www.protocol.gopher;
-
-import java.io.*;
-import java.util.*;
-import java.net.*;
-import sun.net.www.*;
-import sun.net.NetworkClient;
-import java.net.URL;
-import java.net.URLStreamHandler;
-
-import sun.security.action.GetBooleanAction;
-
-/** Class to maintain the state of a gopher fetch and handle the protocol */
-public class GopherClient extends NetworkClient implements Runnable {
-
- /* The following three data members are left in for binary
- * backwards-compatibility. Unfortunately, HotJava sets them directly
- * when it wants to change the settings. The new design has us not
- * cache these, so this is unnecessary, but eliminating the data members
- * would break HJB 1.1 under JDK 1.2.
- *
- * These data members are not used, and their values are meaningless.
- * REMIND: Take them out for JDK 2.0!
- */
-
- /**
- * @deprecated
- */
- @Deprecated
- public static boolean useGopherProxy;
-
- /**
- * @deprecated
- */
- @Deprecated
- public static String gopherProxyHost;
-
- /**
- * @deprecated
- */
- @Deprecated
- public static int gopherProxyPort;
-
-
- static {
- useGopherProxy = java.security.AccessController.doPrivileged(
- new sun.security.action.GetBooleanAction("gopherProxySet"))
- .booleanValue();
-
- gopherProxyHost = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("gopherProxyHost"));
-
- gopherProxyPort = java.security.AccessController.doPrivileged(
- new sun.security.action.GetIntegerAction("gopherProxyPort", 80))
- .intValue();
- }
-
- PipedOutputStream os;
- URL u;
- int gtype;
- String gkey;
- sun.net.www.URLConnection connection;
-
- GopherClient(sun.net.www.URLConnection connection) {
- this.connection = connection;
- }
-
- /**
- * @return true if gopher connections should go through a proxy, according
- * to system properties.
- */
- public static boolean getUseGopherProxy() {
- return java.security.AccessController.doPrivileged(
- new GetBooleanAction("gopherProxySet")).booleanValue();
- }
-
- /**
- * @return the proxy host to use, or null if nothing is set.
- */
- public static String getGopherProxyHost() {
- String host = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("gopherProxyHost"));
- if ("".equals(host)) {
- host = null;
- }
- return host;
- }
-
- /**
- * @return the proxy port to use. Will default reasonably.
- */
- public static int getGopherProxyPort() {
- return java.security.AccessController.doPrivileged(
- new sun.security.action.GetIntegerAction("gopherProxyPort", 80))
- .intValue();
- }
-
- /** Given a url, setup to fetch the gopher document it refers to */
- InputStream openStream(URL u) throws IOException {
- this.u = u;
- this.os = os;
- int i = 0;
- String s = u.getFile();
- int limit = s.length();
- int c = '1';
- while (i < limit && (c = s.charAt(i)) == '/')
- i++;
- gtype = c == '/' ? '1' : c;
- if (i < limit)
- i++;
- gkey = s.substring(i);
-
- openServer(u.getHost(), u.getPort() <= 0 ? 70 : u.getPort());
-
- MessageHeader msgh = new MessageHeader();
-
- switch (gtype) {
- case '0':
- case '7':
- msgh.add("content-type", "text/plain");
- break;
- case '1':
- msgh.add("content-type", "text/html");
- break;
- case 'g':
- case 'I':
- msgh.add("content-type", "image/gif");
- break;
- default:
- msgh.add("content-type", "content/unknown");
- break;
- }
- if (gtype != '7') {
- serverOutput.print(decodePercent(gkey) + "\r\n");
- serverOutput.flush();
- } else if ((i = gkey.indexOf('?')) >= 0) {
- serverOutput.print(decodePercent(gkey.substring(0, i) + "\t" +
- gkey.substring(i + 1) + "\r\n"));
- serverOutput.flush();
- msgh.add("content-type", "text/html");
- } else {
- msgh.add("content-type", "text/html");
- }
- connection.setProperties(msgh);
- if (msgh.findValue("content-type") == "text/html") {
- os = new PipedOutputStream();
- PipedInputStream ret = new PipedInputStream();
- ret.connect(os);
- new Thread(this).start();
- return ret;
- }
- return new GopherInputStream(this, serverInput);
- }
-
- /** Translate all the instances of %NN into the character they represent */
- private String decodePercent(String s) {
- if (s == null || s.indexOf('%') < 0)
- return s;
- int limit = s.length();
- char d[] = new char[limit];
- int dp = 0;
- for (int sp = 0; sp < limit; sp++) {
- int c = s.charAt(sp);
- if (c == '%' && sp + 2 < limit) {
- int s1 = s.charAt(sp + 1);
- int s2 = s.charAt(sp + 2);
- if ('0' <= s1 && s1 <= '9')
- s1 = s1 - '0';
- else if ('a' <= s1 && s1 <= 'f')
- s1 = s1 - 'a' + 10;
- else if ('A' <= s1 && s1 <= 'F')
- s1 = s1 - 'A' + 10;
- else
- s1 = -1;
- if ('0' <= s2 && s2 <= '9')
- s2 = s2 - '0';
- else if ('a' <= s2 && s2 <= 'f')
- s2 = s2 - 'a' + 10;
- else if ('A' <= s2 && s2 <= 'F')
- s2 = s2 - 'A' + 10;
- else
- s2 = -1;
- if (s1 >= 0 && s2 >= 0) {
- c = (s1 << 4) | s2;
- sp += 2;
- }
- }
- d[dp++] = (char) c;
- }
- return new String(d, 0, dp);
- }
-
- /** Turn special characters into the %NN form */
- private String encodePercent(String s) {
- if (s == null)
- return s;
- int limit = s.length();
- char d[] = null;
- int dp = 0;
- for (int sp = 0; sp < limit; sp++) {
- int c = s.charAt(sp);
- if (c <= ' ' || c == '"' || c == '%') {
- if (d == null)
- d = s.toCharArray();
- if (dp + 3 >= d.length) {
- char nd[] = new char[dp + 10];
- System.arraycopy(d, 0, nd, 0, dp);
- d = nd;
- }
- d[dp] = '%';
- int dig = (c >> 4) & 0xF;
- d[dp + 1] = (char) (dig < 10 ? '0' + dig : 'A' - 10 + dig);
- dig = c & 0xF;
- d[dp + 2] = (char) (dig < 10 ? '0' + dig : 'A' - 10 + dig);
- dp += 3;
- } else {
- if (d != null) {
- if (dp >= d.length) {
- char nd[] = new char[dp + 10];
- System.arraycopy(d, 0, nd, 0, dp);
- d = nd;
- }
- d[dp] = (char) c;
- }
- dp++;
- }
- }
- return d == null ? s : new String(d, 0, dp);
- }
-
- /** This method is run as a seperate thread when an incoming gopher
- document requires translation to html */
- public void run() {
- int qpos = -1;
- try {
- if (gtype == '7' && (qpos = gkey.indexOf('?')) < 0) {
- PrintStream ps = new PrintStream(os, false, encoding);
- ps.print("<html><head><title>Searchable Gopher Index</title></head>\n<body><h1>Searchable Gopher Index</h1><isindex>\n</body></html>\n");
- } else if (gtype != '1' && gtype != '7') {
- byte buf[] = new byte[2048];
- try {
- int n;
- while ((n = serverInput.read(buf)) >= 0)
- os.write(buf, 0, n);
- } catch(Exception e) {
- }
- } else {
- PrintStream ps = new PrintStream(os, false, encoding);
- String title = null;
- if (gtype == '7')
- title = "Results of searching for \"" + gkey.substring(qpos + 1)
- + "\" on " + u.getHost();
- else
- title = "Gopher directory " + gkey + " from " + u.getHost();
- ps.print("<html><head><title>");
- ps.print(title);
- ps.print("</title></head>\n<body>\n<H1>");
- ps.print(title);
- ps.print("</h1><dl compact>\n");
- DataInputStream ds = new DataInputStream(serverInput);
- String s;
- while ((s = ds.readLine()) != null) {
- int len = s.length();
- while (len > 0 && s.charAt(len - 1) <= ' ')
- len--;
- if (len <= 0)
- continue;
- int key = s.charAt(0);
- int t1 = s.indexOf('\t');
- int t2 = t1 > 0 ? s.indexOf('\t', t1 + 1) : -1;
- int t3 = t2 > 0 ? s.indexOf('\t', t2 + 1) : -1;
- if (t3 < 0) {
- // ps.print("<br><i>"+s+"</i>\n");
- continue;
- }
- String port = t3 + 1 < len ? ":" + s.substring(t3 + 1, len) : "";
- String host = t2 + 1 < t3 ? s.substring(t2 + 1, t3) : u.getHost();
- ps.print("<dt><a href=\"gopher://" + host + port + "/"
- + s.substring(0, 1) + encodePercent(s.substring(t1 + 1, t2)) + "\">\n");
- ps.print("<img align=middle border=0 width=25 height=32 src=");
- switch (key) {
- default:
- ps.print(System.getProperty("java.net.ftp.imagepath.file"));
- break;
- case '0':
- ps.print(System.getProperty("java.net.ftp.imagepath.text"));
- break;
- case '1':
- ps.print(System.getProperty("java.net.ftp.imagepath.directory"));
- break;
- case 'g':
- ps.print(System.getProperty("java.net.ftp.imagepath.gif"));
- break;
- }
- ps.print(".gif align=middle><dd>\n");
- ps.print(s.substring(1, t1) + "</a>\n");
- }
- ps.print("</dl></body>\n");
- ps.close();
- }
-
- } catch (UnsupportedEncodingException e) {
- throw new InternalError(encoding+ " encoding not found");
- } catch (IOException e) {
- } finally {
- try {
- closeServer();
- os.close();
- } catch (IOException e2) {
- }
- }
- }
-}
-
-/** An input stream that does nothing more than hold on to the NetworkClient
- that created it. This is used when only the input stream is needed, and
- the network client needs to be closed when the input stream is closed. */
-class GopherInputStream extends FilterInputStream {
- NetworkClient parent;
-
- GopherInputStream(NetworkClient o, InputStream fd) {
- super(fd);
- parent = o;
- }
-
- public void close() {
- try {
- parent.closeServer();
- super.close();
- } catch (IOException e) {
- }
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/protocol/gopher/Handler.java b/ojluni/src/main/java/sun/net/www/protocol/gopher/Handler.java
deleted file mode 100755
index 8009859..0000000
--- a/ojluni/src/main/java/sun/net/www/protocol/gopher/Handler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www.protocol.gopher;
-
-import java.io.*;
-import java.util.*;
-import sun.net.NetworkClient;
-import java.net.URL;
-import java.net.URLStreamHandler;
-import java.net.Proxy;
-import java.net.InetSocketAddress;
-import java.net.SocketPermission;
-import java.security.Permission;
-import sun.net.www.protocol.http.HttpURLConnection;
-
-/**
- * A class to handle the gopher protocol.
- */
-
-public class Handler extends java.net.URLStreamHandler {
-
- protected int getDefaultPort() {
- return 70;
- }
-
- public java.net.URLConnection openConnection(URL u)
- throws IOException {
- return openConnection(u, null);
- }
-
- public java.net.URLConnection openConnection(URL u, Proxy p)
- throws IOException {
-
-
- /* if set for proxy usage then go through the http code to get */
- /* the url connection. */
- if (p == null && GopherClient.getUseGopherProxy()) {
- String host = GopherClient.getGopherProxyHost();
- if (host != null) {
- InetSocketAddress saddr = InetSocketAddress.createUnresolved(host, GopherClient.getGopherProxyPort());
-
- p = new Proxy(Proxy.Type.HTTP, saddr);
- }
- }
- if (p != null) {
- return new HttpURLConnection(u, p);
- }
-
- return new GopherURLConnection(u);
- }
-}
-
-class GopherURLConnection extends sun.net.www.URLConnection {
-
- Permission permission;
-
- GopherURLConnection(URL u) {
- super(u);
- }
-
- public void connect() throws IOException {
- }
-
- public InputStream getInputStream() throws IOException {
- return new GopherClient(this).openStream(url);
- }
-
- public Permission getPermission() {
- if (permission == null) {
- int port = url.getPort();
- port = port < 0 ? 70 : port;
- String host = url.getHost() + ":" + url.getPort();
- permission = new SocketPermission(host, "connect");
- }
- return permission;
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/protocol/mailto/Handler.java b/ojluni/src/main/java/sun/net/www/protocol/mailto/Handler.java
deleted file mode 100755
index 10fe684..0000000
--- a/ojluni/src/main/java/sun/net/www/protocol/mailto/Handler.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*-
- * mailto stream opener
- */
-
-package sun.net.www.protocol.mailto;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.io.*;
-import sun.net.www.*;
-//import sun.net.www.protocol.news.ArticlePoster;
-import sun.net.smtp.SmtpClient;
-
-/** open an nntp input stream given a URL */
-public class Handler extends URLStreamHandler {
-
-/*
-// private String decodePercent(String s) {
-// if (s==null || s.indexOf('%') < 0)
-// return s;
-// int limit = s.length();
-// char d[] = new char[limit];
-// int dp = 0;
-// for (int sp = 0; sp < limit; sp++) {
-// int c = s.charAt(sp);
-// if (c == '%' && sp + 2 < limit) {
-// int s1 = s.charAt(sp + 1);
-// int s2 = s.charAt(sp + 2);
-// if ('0' <= s1 && s1 <= '9')
-// s1 = s1 - '0';
-// else if ('a' <= s1 && s1 <= 'f')
-// s1 = s1 - 'a' + 10;
-// else if ('A' <= s1 && s1 <= 'F')
-// s1 = s1 - 'A' + 10;
-// else
-// s1 = -1;
-// if ('0' <= s2 && s2 <= '9')
-// s2 = s2 - '0';
-// else if ('a' <= s2 && s2 <= 'f')
-// s2 = s2 - 'a' + 10;
-// else if ('A' <= s2 && s2 <= 'F')
-// s2 = s2 - 'A' + 10;
-// else
-// s2 = -1;
-// if (s1 >= 0 && s2 >= 0) {
-// c = (s1 << 4) | s2;
-// sp += 2;
-// }
-// }
-// d[dp++] = (char) c;
-// }
-// return new String(d, 0, dp);
-// }
-
-// public InputStream openStream(URL u) {
-// String dest = u.file;
-// String subj = "";
-// int lastsl = dest.lastIndexOf('/');
-// if (lastsl >= 0) {
-// int st = dest.charAt(0) == '/' ? 1 : 0;
-// if (lastsl > st)
-// subj = dest.substring(st, lastsl);
-// dest = dest.substring(lastsl + 1);
-// }
-// if (u.postData != null) {
-// ArticlePoster.MailTo("Posted form",
-// decodePercent(dest),
-// u.postData);
-// }
-// else
-// ArticlePoster.MailTo(decodePercent(subj), decodePercent(dest));
-// return null;
-// }
- */
-
- public synchronized URLConnection openConnection(URL u) {
- return new MailToURLConnection(u);
- }
-
- /**
- * This method is called to parse the string spec into URL u for a
- * mailto protocol.
- *
- * @param u the URL to receive the result of parsing the spec
- * @param spec the URL string to parse
- * @param start the character position to start parsing at. This is
- * just past the ':'.
- * @param limit the character position to stop parsing at.
- */
- public void parseURL(URL u, String spec, int start, int limit) {
-
- String protocol = u.getProtocol();
- String host = "";
- int port = u.getPort();
- String file = "";
-
- if (start < limit) {
- file = spec.substring(start, limit);
- }
- /*
- * Let's just make sure we DO have an Email address in the URL.
- */
- boolean nogood = false;
- if (file == null || file.equals(""))
- nogood = true;
- else {
- boolean allwhites = true;
- for (int i = 0; i < file.length(); i++)
- if (!Character.isWhitespace(file.charAt(i)))
- allwhites = false;
- if (allwhites)
- nogood = true;
- }
- if (nogood)
- throw new RuntimeException("No email address");
- setURL(u, protocol, host, port, file, null);
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/protocol/mailto/MailToURLConnection.java b/ojluni/src/main/java/sun/net/www/protocol/mailto/MailToURLConnection.java
deleted file mode 100755
index df4d330..0000000
--- a/ojluni/src/main/java/sun/net/www/protocol/mailto/MailToURLConnection.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.net.www.protocol.mailto;
-
-import java.net.URL;
-import java.net.InetAddress;
-import java.net.SocketPermission;
-import java.io.*;
-import java.security.Permission;
-import sun.net.www.*;
-import sun.net.smtp.SmtpClient;
-import sun.net.www.ParseUtil;
-
-
-/**
- * Handle mailto URLs. To send mail using a mailto URLConnection,
- * call <code>getOutputStream</code>, write the message to the output
- * stream, and close it.
- *
- */
-public class MailToURLConnection extends URLConnection {
- InputStream is = null;
- OutputStream os = null;
-
- SmtpClient client;
- Permission permission;
- private int connectTimeout = -1;
- private int readTimeout = -1;
-
- MailToURLConnection(URL u) {
- super(u);
-
- MessageHeader props = new MessageHeader();
- props.add("content-type", "text/html");
- setProperties(props);
- }
-
- /**
- * Get the user's full email address - stolen from
- * HotJavaApplet.getMailAddress().
- */
- String getFromAddress() {
- String str = System.getProperty("user.fromaddr");
- if (str == null) {
- str = System.getProperty("user.name");
- if (str != null) {
- String host = System.getProperty("mail.host");
- if (host == null) {
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (java.net.UnknownHostException e) {
- }
- }
- str += "@" + host;
- } else {
- str = "";
- }
- }
- return str;
- }
-
- public void connect() throws IOException {
- client = new SmtpClient(connectTimeout);
- client.setReadTimeout(readTimeout);
- }
-
- @Override
- public synchronized OutputStream getOutputStream() throws IOException {
- if (os != null) {
- return os;
- } else if (is != null) {
- throw new IOException("Cannot write output after reading input.");
- }
- connect();
-
- String to = ParseUtil.decode(url.getPath());
- client.from(getFromAddress());
- client.to(to);
-
- os = client.startMessage();
- return os;
- }
-
- @Override
- public Permission getPermission() throws IOException {
- if (permission == null) {
- connect();
- String host = client.getMailHost() + ":" + 25;
- permission = new SocketPermission(host, "connect");
- }
- return permission;
- }
-
- @Override
- public void setConnectTimeout(int timeout) {
- if (timeout < 0)
- throw new IllegalArgumentException("timeouts can't be negative");
- connectTimeout = timeout;
- }
-
- @Override
- public int getConnectTimeout() {
- return (connectTimeout < 0 ? 0 : connectTimeout);
- }
-
- @Override
- public void setReadTimeout(int timeout) {
- if (timeout < 0)
- throw new IllegalArgumentException("timeouts can't be negative");
- readTimeout = timeout;
- }
-
- @Override
- public int getReadTimeout() {
- return readTimeout < 0 ? 0 : readTimeout;
- }
-}
diff --git a/ojluni/src/main/java/sun/net/www/protocol/netdoc/Handler.java b/ojluni/src/main/java/sun/net/www/protocol/netdoc/Handler.java
deleted file mode 100755
index fbcddcb..0000000
--- a/ojluni/src/main/java/sun/net/www/protocol/netdoc/Handler.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*-
- * netdoc urls point either into the local filesystem or externally
- * through an http url, with network documents being preferred. Useful for
- * FAQs & other documents which are likely to be changing over time at the
- * central site, and where the user will want the most recent edition.
- *
- * @author Steven B. Byrne
- */
-
-package sun.net.www.protocol.netdoc;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import java.net.URLStreamHandler;
-import java.io.InputStream;
-import java.io.IOException;
-
-public class Handler extends URLStreamHandler {
- static URL base;
-
- /*
- * Attempt to find a load the given url using the default (network)
- * documentation location. If that fails, use the local copy
- */
- public synchronized URLConnection openConnection(URL u)
- throws IOException
- {
- URLConnection uc = null;
- URL ru;
-
- Boolean tmp = java.security.AccessController.doPrivileged(
- new sun.security.action.GetBooleanAction("newdoc.localonly"));
- boolean localonly = tmp.booleanValue();
-
- String docurl = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("doc.url"));
-
- String file = u.getFile();
- if (!localonly) {
- try {
- if (base == null) {
- base = new URL(docurl);
- }
- ru = new URL(base, file);
- } catch (MalformedURLException e) {
- ru = null;
- }
- if (ru != null) {
- uc = ru.openConnection();
- }
- }
-
- if (uc == null) {
- try {
- ru = new URL("file", "~", file);
-
- uc = ru.openConnection();
- InputStream is = uc.getInputStream(); // Check for success.
- } catch (MalformedURLException e) {
- uc = null;
- } catch (IOException e) {
- uc = null;
- }
- }
-
- if (uc == null) {
- throw new IOException("Can't find file for URL: "
- +u.toExternalForm());
- }
- return uc;
- }
-}
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index 29bdd09..9d18407 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -1226,55 +1226,47 @@
ojluni/src/main/java/sun/net/TransferProtocolClient.java \
ojluni/src/main/java/sun/net/util/IPAddressUtil.java \
ojluni/src/main/java/sun/net/util/URLUtil.java \
- ojluni/src/main/java/sun/net/www/ApplicationLaunchException.java \
ojluni/src/main/java/sun/net/www/HeaderParser.java \
+ ojluni/src/main/java/sun/net/www/MessageHeader.java \
+ ojluni/src/main/java/sun/net/www/MeteredStream.java \
+ ojluni/src/main/java/sun/net/www/ParseUtil.java \
+ ojluni/src/main/java/sun/net/www/URLConnection.java \
ojluni/src/main/java/sun/net/www/http/ChunkedInputStream.java \
ojluni/src/main/java/sun/net/www/http/ChunkedOutputStream.java \
- ojluni/src/main/java/sun/net/www/http/HttpCaptureInputStream.java \
ojluni/src/main/java/sun/net/www/http/HttpCapture.java \
+ ojluni/src/main/java/sun/net/www/http/HttpCaptureInputStream.java \
ojluni/src/main/java/sun/net/www/http/HttpCaptureOutputStream.java \
ojluni/src/main/java/sun/net/www/http/HttpClient.java \
ojluni/src/main/java/sun/net/www/http/Hurryable.java \
ojluni/src/main/java/sun/net/www/http/KeepAliveCache.java \
- ojluni/src/main/java/sun/net/www/http/KeepAliveStreamCleaner.java \
ojluni/src/main/java/sun/net/www/http/KeepAliveStream.java \
+ ojluni/src/main/java/sun/net/www/http/KeepAliveStreamCleaner.java \
ojluni/src/main/java/sun/net/www/http/PosterOutputStream.java \
- ojluni/src/main/java/sun/net/www/MessageHeader.java \
- ojluni/src/main/java/sun/net/www/MeteredStream.java \
- ojluni/src/main/java/sun/net/www/MimeEntry.java \
- ojluni/src/main/java/sun/net/www/MimeLauncher.java \
- ojluni/src/main/java/sun/net/www/MimeTable.java \
- ojluni/src/main/java/sun/net/www/ParseUtil.java \
ojluni/src/main/java/sun/net/www/protocol/file/FileURLConnection.java \
ojluni/src/main/java/sun/net/www/protocol/file/Handler.java \
+ ojluni/src/main/java/sun/net/www/protocol/file/Handler.java \
ojluni/src/main/java/sun/net/www/protocol/ftp/FtpURLConnection.java \
ojluni/src/main/java/sun/net/www/protocol/ftp/Handler.java \
- ojluni/src/main/java/sun/net/www/protocol/gopher/GopherClient.java \
- ojluni/src/main/java/sun/net/www/protocol/gopher/Handler.java \
- ojluni/src/main/java/sun/net/www/protocol/http/AuthCacheImpl.java \
ojluni/src/main/java/sun/net/www/protocol/http/AuthCache.java \
+ ojluni/src/main/java/sun/net/www/protocol/http/AuthCacheImpl.java \
ojluni/src/main/java/sun/net/www/protocol/http/AuthCacheValue.java \
+ ojluni/src/main/java/sun/net/www/protocol/http/AuthScheme.java \
ojluni/src/main/java/sun/net/www/protocol/http/AuthenticationHeader.java \
ojluni/src/main/java/sun/net/www/protocol/http/AuthenticationInfo.java \
- ojluni/src/main/java/sun/net/www/protocol/http/AuthScheme.java \
ojluni/src/main/java/sun/net/www/protocol/http/BasicAuthentication.java \
ojluni/src/main/java/sun/net/www/protocol/http/DigestAuthentication.java \
ojluni/src/main/java/sun/net/www/protocol/http/Handler.java \
ojluni/src/main/java/sun/net/www/protocol/http/HttpAuthenticator.java \
ojluni/src/main/java/sun/net/www/protocol/http/HttpCallerInfo.java \
ojluni/src/main/java/sun/net/www/protocol/http/HttpURLConnection.java \
+ ojluni/src/main/java/sun/net/www/protocol/http/NTLMAuthenticationProxy.java \
ojluni/src/main/java/sun/net/www/protocol/http/NegotiateAuthentication.java \
ojluni/src/main/java/sun/net/www/protocol/http/Negotiator.java \
- ojluni/src/main/java/sun/net/www/protocol/http/NTLMAuthenticationProxy.java \
ojluni/src/main/java/sun/net/www/protocol/jar/Handler.java \
ojluni/src/main/java/sun/net/www/protocol/jar/JarFileFactory.java \
ojluni/src/main/java/sun/net/www/protocol/jar/JarURLConnection.java \
- ojluni/src/main/java/sun/net/www/protocol/jar/URLJarFileCallBack.java \
ojluni/src/main/java/sun/net/www/protocol/jar/URLJarFile.java \
- ojluni/src/main/java/sun/net/www/protocol/mailto/Handler.java \
- ojluni/src/main/java/sun/net/www/protocol/mailto/MailToURLConnection.java \
- ojluni/src/main/java/sun/net/www/protocol/netdoc/Handler.java \
- ojluni/src/main/java/sun/net/www/URLConnection.java \
+ ojluni/src/main/java/sun/net/www/protocol/jar/URLJarFileCallBack.java \
ojluni/src/main/java/sun/nio/ByteBuffered.java \
ojluni/src/main/java/sun/nio/ch/AbstractPollArrayWrapper.java \
ojluni/src/main/java/sun/nio/ch/AbstractPollSelectorImpl.java \