/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
private int action;
boolean starred;
// Actions
"unknown",
"browser",
"save",
"application",
};
/**
* Construct an empty entry of the given type and subtype.
*/
// Default action is UNKNOWN so clients can decide what the default
// should be, typically save to file or ask user.
}
//
// 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).
//
this.imageFileName = imageFileName;
}
// For use with MimeTable::parseMailCap
this.imageFileName = null;
this.fileExtensions = null;
}
// This is the one called by the public constructor.
this.imageFileName = imageFileName;
this.fileExtensions = fileExtensions;
}
return typeName;
}
}
public synchronized int getAction() {
return action;
}
}
}
return command;
}
}
}
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
return imageFileName;
}
"java.net.ftp.imagepath."+filename);
}
else {
}
}
}
return tempFileNameTemplate;
}
return fileExtensions;
}
if (fileExtensions != null) {
extensionsAsString += fileExtensions[i];
extensionsAsString += ",";
}
}
}
return extensionsAsString;
}
for (int i = 0; i < numExts; i++) {
}
}
}
/**
* 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:
{
if (fst > 0) {
}
}
case UNKNOWN:
// REMIND: What do do here?
return null;
}
return null;
}
if (starred) {
// REMIND: is this the right thing or not?
} else {
}
}
// return a shallow copy of this.
return theClone;
}
boolean needSeparator = false;
needSeparator = true;
}
if (needSeparator) {
}
needSeparator = true;
}
if (getImageFileName() != null) {
if (needSeparator) {
}
needSeparator = true;
}
if (needSeparator) {
}
needSeparator = true;
}
if (needSeparator) {
}
}
}
return "MimeEntry[contentType=" + typeName
+ ", image=" + imageFileName
+ ", action=" + action
+ ", command=" + command
+ ", extensions=" + getExtensionsAsList()
+ "]";
}
}