📄 mailcapcommandmap.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2) on Wed Apr 19 08:11:00 PDT 2006 --><TITLE>MailcapCommandMap (JavaBeans Activation Framework API documentation)</TITLE><META NAME="keywords" CONTENT="javax.activation.MailcapCommandMap class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="MailcapCommandMap (JavaBeans Activation Framework API documentation)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MailcapCommandMap.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/activation/FileTypeMap.html" title="class in javax.activation"><B>PREV CLASS</B></A> <A HREF="../../javax/activation/MimeType.html" title="class in javax.activation"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="MailcapCommandMap.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.activation</FONT><BR>Class MailcapCommandMap</H2><PRE>java.lang.Object <IMG SRC="../../resources/inherit.gif" ALT="extended by"><A HREF="../../javax/activation/CommandMap.html" title="class in javax.activation">javax.activation.CommandMap</A> <IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>javax.activation.MailcapCommandMap</B></PRE><HR><DL><DT>public class <B>MailcapCommandMap</B><DT>extends <A HREF="../../javax/activation/CommandMap.html" title="class in javax.activation">CommandMap</A></DL><P>MailcapCommandMap extends the CommandMap abstract class. It implements a CommandMap whose configuration is based on mailcap files (<A HREF="http://www.ietf.org/rfc/rfc1524.txt">RFC 1524</A>). The MailcapCommandMap can be configured both programmatically and via configuration files. <p> <b>Mailcap file search order:</b><p> The MailcapCommandMap looks in various places in the user's system for mailcap file entries. When requests are made to search for commands in the MailcapCommandMap, it searches mailcap files in the following order: <p> <ol> <li> Programatically added entries to the MailcapCommandMap instance. <li> The file <code>.mailcap</code> in the user's home directory. <li> The file <<i>java.home</i>><code>/lib/mailcap</code>. <li> The file or resources named <code>META-INF/mailcap</code>. <li> The file or resource named <code>META-INF/mailcap.default</code> (usually found only in the <code>activation.jar</code> file). </ol> <p> <b>Mailcap file format:</b><p> Mailcap files must conform to the mailcap file specification (RFC 1524, <i>A User Agent Configuration Mechanism For Multimedia Mail Format Information</i>). The file format consists of entries corresponding to particular MIME types. In general, the specification specifies <i>applications</i> for clients to use when they themselves cannot operate on the specified MIME type. The MailcapCommandMap extends this specification by using a parameter mechanism in mailcap files that allows JavaBeans(tm) components to be specified as corresponding to particular commands for a MIME type.<p> When a mailcap file is parsed, the MailcapCommandMap recognizes certain parameter signatures, specifically those parameter names that begin with <code>x-java-</code>. The MailcapCommandMap uses this signature to find command entries for inclusion into its registries. Parameter names with the form <code>x-java-<name></code> are read by the MailcapCommandMap as identifying a command with the name <i>name</i>. When the <i>name</i> is <code> content-handler</code> the MailcapCommandMap recognizes the class signified by this parameter as a <i>DataContentHandler</i>. All other commands are handled generically regardless of command name. The command implementation is specified by a fully qualified class name of a JavaBean(tm) component. For example; a command for viewing some data can be specified as: <code>x-java-view=com.foo.ViewBean</code>.<p> When the command name is <code>fallback-entry</code>, the value of the command may be <code>true</code> or <code>false</code>. An entry for a MIME type that includes a parameter of <code>x-java-fallback-entry=true</code> defines fallback commands for that MIME type that will only be used if no non-fallback entry can be found. For example, an entry of the form <code>text/*; ; x-java-fallback-entry=true; x-java-view=com.sun.TextViewer</code> specifies a view command to be used for any text MIME type. This view command would only be used if a non-fallback view command for the MIME type could not be found.<p> MailcapCommandMap aware mailcap files have the following general form:<p> <code> # Comments begin with a '#' and continue to the end of the line.<br> <mime type>; ; <parameter list><br> # Where a parameter list consists of one or more parameters,<br> # where parameters look like: x-java-view=com.sun.TextViewer<br> # and a parameter list looks like: <br> text/plain; ; x-java-view=com.sun.TextViewer; x-java-edit=com.sun.TextEdit <br> # Note that mailcap entries that do not contain 'x-java' parameters<br> # and comply to RFC 1524 are simply ignored:<br> image/gif; /usr/dt/bin/sdtimage %s<br> </code> <p><P><P><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#MailcapCommandMap()">MailcapCommandMap</A></B>()</CODE><BR> The default Constructor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#MailcapCommandMap(java.io.InputStream)">MailcapCommandMap</A></B>(java.io.InputStream is)</CODE><BR> Constructor that allows the caller to specify an <i>InputStream</i> containing a mailcap file.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#MailcapCommandMap(java.lang.String)">MailcapCommandMap</A></B>(java.lang.String fileName)</CODE><BR> Constructor that allows the caller to specify the path of a <i>mailcap</i> file.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#addMailcap(java.lang.String)">addMailcap</A></B>(java.lang.String mail_cap)</CODE><BR> Add entries to the registry.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/activation/DataContentHandler.html" title="interface in javax.activation">DataContentHandler</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#createDataContentHandler(java.lang.String)">createDataContentHandler</A></B>(java.lang.String mimeType)</CODE><BR> Return the DataContentHandler for the specified MIME type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/activation/CommandInfo.html" title="class in javax.activation">CommandInfo</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#getAllCommands(java.lang.String)">getAllCommands</A></B>(java.lang.String mimeType)</CODE><BR> Get all the available commands in all mailcap files known to this instance of MailcapCommandMap for this MIME type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/activation/CommandInfo.html" title="class in javax.activation">CommandInfo</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#getCommand(java.lang.String, java.lang.String)">getCommand</A></B>(java.lang.String mimeType, java.lang.String cmdName)</CODE><BR> Get the command corresponding to <code>cmdName</code> for the MIME type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#getMimeTypes()">getMimeTypes</A></B>()</CODE><BR> Get all the MIME types known to this command map.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#getNativeCommands(java.lang.String)">getNativeCommands</A></B>(java.lang.String mimeType)</CODE><BR> Get the native commands for the given MIME type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/activation/CommandInfo.html" title="class in javax.activation">CommandInfo</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/activation/MailcapCommandMap.html#getPreferredCommands(java.lang.String)">getPreferredCommands</A></B>(java.lang.String mimeType)</CODE><BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -