This is updated source code with comments.
r=idk@eng.sun.com git-svn-id: svn://10.0.0.236/trunk@57697 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -23,52 +23,66 @@ import org.mozilla.pluglet.mozilla.*;
|
||||
import java.awt.Frame;
|
||||
import java.awt.print.PrinterJob;
|
||||
|
||||
/**
|
||||
* A <code>Pluglet</code> is a Plugin written in the Java programming language.
|
||||
* It is dispatched when a certain MIME type is encountered by a browser.
|
||||
* This interface includes functions to initialize, start, stop, destroy,
|
||||
* and print an instance of <code>Pluglet</code>.
|
||||
*/
|
||||
public interface Pluglet {
|
||||
/**
|
||||
* Initializes a newly created pluglet instance, passing to it the pluglet
|
||||
* instance peer which it should use for all communication back to the browser.
|
||||
*
|
||||
* @param peer the corresponding pluglet peer
|
||||
* Initializes a newly created <code>Pluglet</code> instance, passing to it an instance of
|
||||
* PlugletPeer, which it should use for communication with the browser.
|
||||
* <p>
|
||||
* @param peer This is the instance of <code>PlugletPeer</code> that should be used for
|
||||
* communication with the browser.
|
||||
*/
|
||||
void initialize(PlugletPeer peer);
|
||||
/**
|
||||
* Called to instruct the pluglet instance to start. This will be called after
|
||||
* the pluglet is first created and initialized, and may be called after the
|
||||
* pluglet is stopped (via the Stop method) if the pluglet instance is returned
|
||||
* to in the browser window's history.
|
||||
* Called to instruct the <code>Pluglet</code> instance to start. This will be called after
|
||||
* the <code>Pluglet</code> is first created and initialized, and may be called after the
|
||||
* <code>Pluglet</code> is stopped (via the <code>stop()</code> method) if the
|
||||
* <code>Pluglet</code> instance is revisited in the browser window's history.
|
||||
*/
|
||||
void start();
|
||||
/**
|
||||
* Called to instruct the pluglet instance to stop, thereby suspending its state.
|
||||
* This method will be called whenever the browser window goes on to display
|
||||
* another page and the page containing the pluglet goes into the window's history
|
||||
* Called to instruct the <code>Pluglet</code> instance to stop and suspend its state.
|
||||
* This method will be called whenever the browser window displays another
|
||||
* page and the page containing the <code>Pluglet</code> goes into the browser's history
|
||||
* list.
|
||||
*/
|
||||
void stop();
|
||||
/**
|
||||
* Called to instruct the pluglet instance to destroy itself. This is called when
|
||||
* it become no longer possible to return to the pluglet instance, either because
|
||||
* Called to instruct the <code>Pluglet</code> instance to destroy itself. This is called when
|
||||
* it is no longer possible to return to the <code>Pluglet</code> instance -- either because
|
||||
* the browser window's history list of pages is being trimmed, or because the
|
||||
* window containing this page in the history is being closed.
|
||||
*/
|
||||
void destroy();
|
||||
/**
|
||||
* Called to tell the pluglet that the initial src/data stream is
|
||||
* ready.
|
||||
*
|
||||
* @result PlugletStreamListener
|
||||
* This is called to tell the <code>Pluglet</code> instance that the stream data
|
||||
* for an SRC or DATA attribute (corresponding to an EMBED or OBJECT
|
||||
* tag) is ready to be read; it is also called for a full-page Pluglet.
|
||||
* The <code>Pluglet</code> is expected to return an instance of
|
||||
* <code>PlugletStreamListener</code>, to which data and notifications
|
||||
* will be sent.
|
||||
* <p>
|
||||
* @return <code>PlugletStreamListener</code> instance, the listener the browser will use to
|
||||
* give the <code>Pluglet</code> the data.
|
||||
*/
|
||||
PlugletStreamListener newStream();
|
||||
/**
|
||||
* Called when the window containing the pluglet instance changes.
|
||||
*
|
||||
* @param frame the pluglet panel
|
||||
* Called by the browser to set or change the frame containing the <code>Pluglet</code>
|
||||
* instance.
|
||||
* <p>
|
||||
* @param frame the <code>Pluglet</code> instance frame that changes.
|
||||
*/
|
||||
void setWindow(Frame frame);
|
||||
/**
|
||||
* Called to instruct the pluglet instance to print itself to a printer.
|
||||
*
|
||||
* @param print printer information.
|
||||
* Called to instruct the <code>Pluglet</code> instance to print itself to a printer.
|
||||
* <p>
|
||||
* @param printerJob This is an object of type <code>PrinterJob</code>. It is used to
|
||||
* control printing.
|
||||
*/
|
||||
void print(PrinterJob printerJob);
|
||||
}
|
||||
|
||||
@@ -22,21 +22,44 @@ package org.mozilla.pluglet;
|
||||
|
||||
import org.mozilla.pluglet.mozilla.*;
|
||||
|
||||
/**
|
||||
* This interface includes the functions to create an instance of <code>Pluglet</code>,
|
||||
* and initialize the <code>PlugletFactory</code> instance and shut it down when
|
||||
* no longer required.
|
||||
*/
|
||||
|
||||
public interface PlugletFactory {
|
||||
/**
|
||||
* Creates a new pluglet instance, based on a MIME type. This
|
||||
* allows different impelementations to be created depending on
|
||||
* the specified MIME type.
|
||||
* Creates a new <code>Pluglet</code> instance based on a MIME type. This
|
||||
* allows different implementations to be created depending on
|
||||
* the specified MIME type.<p>
|
||||
* While normally there will be only one <code>PlugletFactory</code>
|
||||
* implementation and one instance of it,
|
||||
* there can be multiple implementations of <code>Pluglet</code> and instances of them.
|
||||
* Given a MIME type, it is the responsibility of
|
||||
* the <code>createPluglet</code> method to create an instance
|
||||
* of the implementation of <code>Pluglet</code>
|
||||
* for that MIME type. (Note: A single implementation of the <code>Pluglet</code>
|
||||
* interface could handle more than one MIME type; there may also be
|
||||
* separate implementations of the <code>Pluglet</code> interface for MIME types.
|
||||
* This is up to the developer implementing the <code>Pluglet</code> interface.)
|
||||
* <p>
|
||||
* @param <code>mimeType</code> This is the MIME type for which a new <code>Pluglet</code>
|
||||
* instance is to be created.
|
||||
* @return Returns a new <code>Pluglet</code> instance based on the specified
|
||||
* MIME type passed to the method.
|
||||
*/
|
||||
public Pluglet createPluglet(String mimeType);
|
||||
/**
|
||||
* Initializes the pluglet and will be called before any new instances are
|
||||
* created.
|
||||
* Initializes the <code>PlugletFactory</code> instance and is called before any new
|
||||
* <code>Pluglet</code> instances are created.<p>
|
||||
* @param manager This is an instance of <code>PlugletManager</code> that is passed
|
||||
* to this method.
|
||||
*/
|
||||
public void initialize(PlugletManager manager);
|
||||
/**
|
||||
* Called when the browser is done with the pluglet factory, or when
|
||||
* the pluglet is disabled by the user.
|
||||
* Called when the browser is done with a <code>PlugletFactory</code> instance. Normally
|
||||
* there is only one <code>PlugletFactory</code> instance.
|
||||
*/
|
||||
public void shutdown();
|
||||
}
|
||||
|
||||
@@ -22,33 +22,93 @@ package org.mozilla.pluglet;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.mozilla.pluglet.mozilla.*;
|
||||
|
||||
/**
|
||||
* This is a stream listener that provides various methods, such as
|
||||
* notification that data is available in the input stream, that the URL
|
||||
* has started to load, that it has stopped loading, etc.
|
||||
*/
|
||||
public interface PlugletStreamListener {
|
||||
// matches values in modules/plugin/public/plugindefs.h
|
||||
/**
|
||||
* Indicates normal stream type. This is a fixed integer value = 1.<p>
|
||||
* In this mode, the browser "pushes" data to the Pluglet as it
|
||||
* arrives from the network.
|
||||
*/
|
||||
public static final int STREAM_TYPE_NORMAL = 1;
|
||||
/**
|
||||
* Indicates seek stream type. This is a fixed integer value = 2.<p>
|
||||
* In this mode, the Pluglet can randomly access ("pull") stream data.
|
||||
*/
|
||||
public static final int STREAM_TYPE_SEEK = 2;
|
||||
/**
|
||||
* Indicates file stream type. This is a fixed integer value = 3.<p>
|
||||
* In this mode, the browser delivers ("pushes") data to
|
||||
* the Pluglet as data is saved to a local file. The data
|
||||
* is delivered to the Pluglet via a series of write calls.
|
||||
*/
|
||||
public static final int STREAM_TYPE_AS_FILE = 3;
|
||||
/**
|
||||
* Indicates file-only stream type. This is a fixed integer value = 4.<p>
|
||||
* In this mode, the browser saves stream data to a local file
|
||||
* and when it is done, it sends the full path of the file
|
||||
* to the Pluglet (which can then "pull" the data).
|
||||
*/
|
||||
public static final int STREAM_TYPE_AS_FILE_ONLY = 4;
|
||||
|
||||
/**
|
||||
* Notify the observer that the URL has started to load. This method is
|
||||
* called only once, at the beginning of a URL load.<BR><BR>
|
||||
* This would be called by the browser to indicate that the URL has
|
||||
* started to load. This method is called only once --
|
||||
* when the URL starts to load.<p>
|
||||
* @param plugletInfo This is the interface (of type <code>PlugletStreamInfo</code>)
|
||||
* through which the listener can get specific information about the stream, such as
|
||||
* MIME type, URL, date modified, etc.<p>
|
||||
*/
|
||||
void onStartBinding(PlugletStreamInfo plugletInfo);
|
||||
void onStartBinding(PlugletStreamInfo streamInfo);
|
||||
/**
|
||||
* Notify the client that data is available in the input stream. This
|
||||
* method is called whenver data is written into the input stream by the
|
||||
* networking library...<BR><BR>
|
||||
* This would be called by the browser to indicate that data is available
|
||||
* in the input stream. This method is called whenever data is written
|
||||
* into the input stream by the networking library -- unless the
|
||||
* stream type is <code>STREAM_TYPE_AS_FILE_ONLY</code>. In the latter case,
|
||||
* <code>onFileAvailable</code> returns the path to the saved stream, and the
|
||||
* Pluglet can then "pull" the data.<p>
|
||||
*
|
||||
* @param streamInfo This is the interface (of type <code>PlugletStreamInfo</code>)
|
||||
* through which the listener can get specific information about the stream, such as
|
||||
* MIME type, URL, date modified, etc.<p>
|
||||
* @param input The input stream containing the data. This stream can
|
||||
* be either a blocking or non-blocking stream.
|
||||
* be either a blocking or non-blocking stream.<p>
|
||||
* @param length The amount of data that was just pushed into the stream.
|
||||
*/
|
||||
void onDataAvailable(PlugletStreamInfo stremInfo, InputStream input,int length);
|
||||
void onDataAvailable(PlugletStreamInfo streamInfo, InputStream input,int length);
|
||||
/**
|
||||
* This would be called by the browser to indicate the availability of a local
|
||||
* file name for the stream data.<p>
|
||||
* @param streamInfo This is the interface (of type <code>PlugletStreamInfo</code>)
|
||||
* through which the listener can get specific information about the stream, such as
|
||||
* MIME type, URL, date modified, etc.<p>
|
||||
* @param fileName This specifies the full path to the file.
|
||||
*/
|
||||
void onFileAvailable(PlugletStreamInfo streamInfo, String fileName);
|
||||
/**
|
||||
* Notify the observer that the URL has finished loading.
|
||||
* This would be called by the browser to indicate that the URL has finished loading.
|
||||
*<p>
|
||||
* @param streamInfo This is the interface (of type <code>PlugletStreamInfo</code>)
|
||||
* through which the listener can get specific information about the stream, such as
|
||||
* MIME type, URL, date modified, etc.<p>
|
||||
* @param status This is an <code>int</code> (integer) to indicate the success
|
||||
* or failure of the load. <code>0</code> (<code>NS_OK</code>) indicates successful
|
||||
* loading; any other value indicates failure.
|
||||
*/
|
||||
void onStopBinding(PlugletStreamInfo streamInfo,int status);
|
||||
/**
|
||||
* Returns the type of stream.<p>
|
||||
* @param int This is an interger representing the stream type:<p>
|
||||
* 1 for STREAM_TYPE_NORMAL<br>
|
||||
* 2 for STREAM_TYPE_SEEK<br>
|
||||
* 3 for STREAM_TYPE_AS_FILE<br>
|
||||
* 4 for STREAM_TYPE_AS_FILE_ONLY
|
||||
*/
|
||||
int getStreamType();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,17 @@
|
||||
*/
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
|
||||
/**
|
||||
* This interface is for setting up a range of bytes.
|
||||
*/
|
||||
public interface ByteRanges {
|
||||
/**
|
||||
* Sets a range of bytes, given an offset and a length. If offset is negative,
|
||||
* then the offset is from the end.<p>
|
||||
* @param offset This is the offset for the range of bytes -- from the
|
||||
* beginning if offset is positive, from the end if offset is negative.<p>
|
||||
* @param length This is the length of the range of bytes; i.e., the number
|
||||
* of bytes.
|
||||
*/
|
||||
public void addRange(int offset, int length);
|
||||
}
|
||||
|
||||
@@ -21,37 +21,57 @@
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
import org.mozilla.pluglet.*;
|
||||
import java.net.URL;
|
||||
public interface PlugletManager {
|
||||
|
||||
/**
|
||||
* The <code>PlugletManager</code> interface includes functionality to get and post
|
||||
* URLs and return <code>userAgent</code> for the browser. It also includes a function
|
||||
* for reloading all Pluglets in the Pluglets
|
||||
* directory, allowing Pluglets to be installed and run without restarting the browser.
|
||||
*/
|
||||
public interface PlugletManager {
|
||||
/**
|
||||
* Causes the pluglets directory to be searched again for new pluglet
|
||||
* libraries.
|
||||
*
|
||||
* @param reloadPages indicates whether currently visible pages should
|
||||
* also be reloaded
|
||||
* This method reloads all Pluglets in the Pluglets directory.
|
||||
* The browser knows about all installed Pluglets (and Plugins)
|
||||
* at startup. But if the user adds or removes any Pluglets
|
||||
* (or Plugins), the browser does not see them until it is restarted.
|
||||
* This method lets the user install a new Pluglet and load it,
|
||||
* or remove one, without having to restart the browser.
|
||||
* <p>
|
||||
* @param reloadPages <code>Boolean</code> value indicates whether currently visible
|
||||
* pages should also be reloaded.
|
||||
*/
|
||||
public void reloadPluglets(boolean reloadPages);
|
||||
|
||||
/**
|
||||
* Returns the user agent string for the browser.
|
||||
*
|
||||
* Returns the <code>userAgent String</code> for the browser.
|
||||
* <code>userAgent</code> is a property of the <code>navigator</code>
|
||||
* object and contains information about the browser.
|
||||
* <p>
|
||||
* @return Returns a <code>String</code> for the <code>userAgent</code>
|
||||
* for the browser.
|
||||
*/
|
||||
public String userAgent();
|
||||
/**
|
||||
* Fetches a URL.
|
||||
* @param pluglet the pluglet making the request.
|
||||
* If null, the URL is fetched in the background.
|
||||
* @param url the URL to fetch
|
||||
* @param target the target window into which to load the URL
|
||||
* @param notifyData when present, URLNotify is called passing the
|
||||
* notifyData back to the client.
|
||||
* @param altHost an IP-address string that will be used instead of
|
||||
* the host specified in the URL. This is used to
|
||||
* @param prevent DNS-spoofing attacks. Can be defaulted to null
|
||||
* meaning use the host in the URL.
|
||||
* @param referrer the referring URL (may be null)
|
||||
* @param forceJSEnabled forces JavaScript to be enabled for
|
||||
* 'javascript:' URLs, even if the user currently has JavaScript
|
||||
* disabled (usually specify false)
|
||||
* Fetches a URL.
|
||||
* <p>
|
||||
* @param pluglet This is the <code>Pluglet</code> instance making the request.
|
||||
* If <code>null</code>, the URL is fetched in the background.
|
||||
* <p>
|
||||
* @param url This is the URL to fetch.
|
||||
* <p>
|
||||
* @param target This is the target window into which to load the URL.
|
||||
* <p>
|
||||
* @param streamListener This is an instance of <code>PlugletStreamListener</code>.
|
||||
* <p>
|
||||
* @param altHost This is an IP-address string that will be used instead of
|
||||
* the host specified in the URL. This is used to prevent DNS-spoofing
|
||||
* attacks. It can be defaulted to <code>null</code>, which will mean: use the host
|
||||
* in the URL.
|
||||
* <p>
|
||||
* @param referrer This is the referring URL. (It may be <code>null</code>).
|
||||
* <p>
|
||||
* @param forceJSEnabled This will force JavaScript to be enabled for
|
||||
* <code>javascript:</code> URLs, even if the user currently has JavaScript
|
||||
* disabled. (Usually this should be set <code>false</code>.)
|
||||
*/
|
||||
public void getURL(Pluglet pluglet,
|
||||
URL url, String target,
|
||||
@@ -59,31 +79,31 @@ public interface PlugletManager {
|
||||
String altHost, URL referrer,
|
||||
boolean forceJSEnabled);
|
||||
/**
|
||||
* Posts to a URL with post data and/or post headers.
|
||||
*
|
||||
* @param pluglet the pluglet making the request. If null, the URL
|
||||
* is fetched in the background.
|
||||
* @param url the URL to fetch
|
||||
* @param target the target window into which to load the URL
|
||||
* @param postDataLength the length of postData (if non-null)
|
||||
* @param postData the data to POST. null specifies that there is not post
|
||||
* data
|
||||
* @param isFile whether the postData specifies the name of a file to
|
||||
* post instead of data. The file will be deleted afterwards.
|
||||
* @param notifyData when present, URLNotify is called passing the
|
||||
* notifyData back to the client.
|
||||
* @param altHost n IP-address string that will be used instead of the
|
||||
* host specified in the URL. This is used to prevent DNS-spoofing
|
||||
* attacks. Can be defaulted to null meaning use the host in the URL.
|
||||
* @param referrer the referring URL (may be null)
|
||||
* @param forceJSEnabled forces JavaScript to be enabled for 'javascript:'
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify false)
|
||||
* @param postHeadersLength the length of postHeaders (if non-null)
|
||||
* @param postHeaders the headers to POST. null specifies that there
|
||||
* are no post headers
|
||||
* Posts to a URL with post data and/or post headers.<p>
|
||||
* @param pluglet This is the <code>Pluglet</code> instance making the request.
|
||||
* If <code>null</code>, the URL is fetched in the background.<p>
|
||||
* @param url This is the URL to fetch.<p>
|
||||
* @param postDataLen This is the length of <code>postData</code>
|
||||
* (if not <code>null</code>).<p>
|
||||
* @param postData This is the data to post. <code>null</code> specifies that there
|
||||
* is no post data.<p>
|
||||
* @param isFile This indicates whether <code>postData</code> specifies the name
|
||||
* of a file to post rather than data. The file will be deleted afterwards.<p>
|
||||
* @param target This is the target window into which to load the URL.<p>
|
||||
* @param streamListener This is an instance of <code>PlugletStreamListner</code>.<p>
|
||||
* @param altHost This is an IP-address string that will be used instead
|
||||
* of the host specified in the URL. This is used to prevent DNS-spoofing
|
||||
* attacks. It can be defaulted to <code>null</code>, which will mean: use the host
|
||||
* in the URL.<p>
|
||||
* @param referrer This is the referring URL. (It may be <code>null</code>.)<p>
|
||||
* @param forceJSEnabled This will force JavaScript to be enabled for <code>javascript:</code>
|
||||
* URLs, even if the user currently has JavaScript disabled (usually
|
||||
* specify false).<p>
|
||||
* @param postHeadersLength This is the length of <code>postHeaders</code>
|
||||
* (if not <code>null</code>).<p>
|
||||
* @param postHeaders These are the headers to POST. <code>null</code> specifies that there
|
||||
* are no post headers.
|
||||
*/
|
||||
|
||||
public void postURL(Pluglet pluglet,
|
||||
URL url,
|
||||
int postDataLen,
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
*/
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* This interface extends the functionality of the <code>PlugletManager</code> interface,
|
||||
* including methods to begin and end a wait cursor, determine if a URL protocol is
|
||||
* supported, and get proxy information for a URL.
|
||||
*/
|
||||
public interface PlugletManager2 extends PlugletManager {
|
||||
/**
|
||||
* Puts up a wait cursor.
|
||||
@@ -30,22 +36,32 @@ public interface PlugletManager2 extends PlugletManager {
|
||||
*/
|
||||
public void endWaitCursor();
|
||||
/**
|
||||
* Returns true if a URL protocol (e.g. "http") is supported.
|
||||
*
|
||||
* @param protocol the protocol name
|
||||
* Returns <code>true</code> if a URL protocol (e.g., <code>http</code>) is supported.
|
||||
*<p>
|
||||
* @param protocol This is the protocol name.
|
||||
* <p>
|
||||
* @return <code>Boolean</code> returns <code>true</code> if the URL protocol is supported.
|
||||
*/
|
||||
public boolean supportsURLProtocol(String protocol);
|
||||
/**
|
||||
* Returns the proxy info for a given URL. The result will be in the
|
||||
* following format
|
||||
*
|
||||
* i) "DIRECT" -- no proxy
|
||||
* ii) "PROXY xxx.xxx.xxx.xxx" -- use proxy
|
||||
* iii) "SOCKS xxx.xxx.xxx.xxx" -- use SOCKS
|
||||
* iv) Mixed. e.g. "PROXY 111.111.111.111;PROXY 112.112.112.112",
|
||||
* "PROXY 111.111.111.111;SOCKS 112.112.112.112"....
|
||||
*
|
||||
* Which proxy/SOCKS to use is determined by the plugin.
|
||||
* For a given URL, this method returns a <code>String</code>
|
||||
* for the proxy information.
|
||||
* The result will be in the following format:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li> <code>DIRECT</code> -- means no proxy required<br>
|
||||
* <li> <code>PROXY xxx.xxx.xxx.xxx</code> -- use proxy
|
||||
* (where <code>xxx.xxx.xxx.xxx</code> is the IP Address)<br>
|
||||
* <li> <code>SOCKS xxx.xxx.xxx.xxx</code> -- use SOCKS
|
||||
* (where <code>xxx.xxx.xxx.xxx</code> is the IP Address)<br>
|
||||
* <li> Mixed. e.g., <code>PROXY 111.111.111.111;PROXY 112.112.112.112;
|
||||
* PROXY 111.111.111.111;SOCKS 112.112.112.112</code> ....
|
||||
* </ul>
|
||||
* <p>
|
||||
* Which proxy/SOCKS to use is determined by the <code>Pluglet</code>.<p>
|
||||
* @param url This is the URL for which proxy information is desired. <p>
|
||||
* @return Information (<code>String</code>) about the proxy. See above for the format.
|
||||
|
||||
*/
|
||||
public String findProxyForURL(URL url);
|
||||
}
|
||||
|
||||
@@ -16,41 +16,78 @@
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>PlugletPeer</code> interface is the set of functions implemented
|
||||
* by the browser to support a <code>Pluglet</code> instance. When a <code>Pluglet</code>
|
||||
* instance is constructed, a <code>PlugeletPeer</code> object is passed to its initializer.
|
||||
* The peer object represents the instantiation of the <code>Pluglet</code>
|
||||
* instance on the page.
|
||||
*/
|
||||
public interface PlugletPeer {
|
||||
/**
|
||||
* This is a <code>static final</code> integer variable set to 3.
|
||||
*/
|
||||
public static final int NETSCAPE_WINDOW = 3;
|
||||
/**
|
||||
* Returns the MIME type of the pluglet instance.
|
||||
* Returns the MIME type of the <code>Pluglet</code> instance.
|
||||
* <p>
|
||||
* @return Returns a <code>String</code> for the MIME type of the <code>Pluglet</code>
|
||||
* instance.
|
||||
*/
|
||||
public String getMIMEType();
|
||||
/**
|
||||
* Returns the mode of the pluglet instance, i.e. whether the pluglet
|
||||
* is embedded in the html, or full page.
|
||||
* Returns an <code>int</code> (integer value) indicating whether the
|
||||
* Pluglet is embedded in HTML in the page via an <code>OBJECT</code>
|
||||
* or <code>EMBED</code> element and is part of the page,
|
||||
* or whether the Pluglet is in a full page of its own.<p>
|
||||
* A full-page Pluglet can occur when a file of the Pluglet MIME type
|
||||
* is entered in the Address/URL field of the browser; when JavaScript
|
||||
* sets the document URL (<code>document.URL</code>) to that file;
|
||||
* or when an applet redirects the browser to the file
|
||||
* (via <code>java.net.HttpURLConnection</code>).
|
||||
* <p>
|
||||
* @return Returns an <code>int</code> (integer value) representing the mode.
|
||||
* A value of 1 indicates the Pluglet is embedded in a page; a value of 2
|
||||
* indicates it is in a full page of its own.
|
||||
*/
|
||||
public int getMode();
|
||||
/**
|
||||
* Returns the value of a variable associated with the pluglet manager.
|
||||
* @param variable the pluglet manager variable to get
|
||||
* Returns the value of a variable associated with the
|
||||
* <code>PlugletManager</code> instance.<p>
|
||||
* @param variable This is the <code>PlugletManager</code> instance
|
||||
* variable to get.<p>
|
||||
* @return Returns a <code>String</code> representing the value of the variable.
|
||||
*/
|
||||
public String getValue(int variable);
|
||||
/**
|
||||
* This operation is called by the pluglet instance when it wishes to send a stream of data to the browser. It constructs a
|
||||
* new output stream to which the pluglet may send the data. When complete, the Close and Release methods should be
|
||||
* called on the output stream.
|
||||
* @param type type MIME type of the stream to create
|
||||
* @param target the target window name to receive the data
|
||||
* This method is called by the <code>Pluglet</code> instance when it wishes
|
||||
* to send a stream of data to the browser. It constructs a
|
||||
* new output stream to which the <code>Pluglet</code> instance may send data.
|
||||
* <p>
|
||||
* @param type The MIME type of the stream to create.<p>
|
||||
* @param target The name of the target window to receive the data.<p>
|
||||
* @return Returns the resulting output stream.
|
||||
*/
|
||||
public OutputStream newStream(String type, String target);
|
||||
/** This operation causes status information to be displayed on the window associated with the pluglet instance.
|
||||
* @param message the status message to display
|
||||
/** Invoking this method causes status information to be displayed
|
||||
* at the bottom of the window associated with the <code>Pluglet</code> instance.
|
||||
* <p>
|
||||
* @param message This is the status message to display.
|
||||
*/
|
||||
public void showStatus(String message);
|
||||
/**
|
||||
* Set the desired size of the window in which the plugin instance lives.
|
||||
*
|
||||
* @param width - new window width
|
||||
* @param height - new window height
|
||||
* Sets the desired size of the window associated with the
|
||||
* <code>Pluglet</code> instance.<p>
|
||||
* @param width The width of the new window.
|
||||
* @param height The height of the new window.
|
||||
*/
|
||||
public void setWindowSize(int width, int height);
|
||||
/**
|
||||
* For the <code>Pluglet</code> instance, returns the tag information
|
||||
* associated with it. This is an object of type
|
||||
* <code>PlugletTagInfo</code>, which contains all the name-value
|
||||
* pairs for the attributes of the tag/element.<p>
|
||||
* @return Gets the <code>Pluglet</code> instance tag information.
|
||||
*/
|
||||
public PlugletTagInfo getTagInfo();
|
||||
}
|
||||
|
||||
@@ -20,20 +20,42 @@
|
||||
*/
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
|
||||
/**
|
||||
* This interface returns various information about the stream such as the
|
||||
* MIME type and whether the stream is seekable.
|
||||
*/
|
||||
public interface PlugletStreamInfo {
|
||||
/**
|
||||
* Returns the MIME type.
|
||||
* Returns the MIME type for a particular stream.<p>
|
||||
* @return As stated above, returns the MIME type.
|
||||
*/
|
||||
public String getContentType();
|
||||
/**
|
||||
* Indicates if a stream is seekable; that is, if it is possible
|
||||
* to move to a particular point in the stream.<p>
|
||||
* @return Returns true if the stream is seekable.
|
||||
*/
|
||||
public boolean isSeekable();
|
||||
/**
|
||||
* Returns the number of bytes that can be read from this input stream
|
||||
* Returns the length of a stream in bytes.
|
||||
*/
|
||||
public int getLength();
|
||||
/**
|
||||
* Returns the time the data in the URL was last modified,
|
||||
* measured in seconds since 12:00 midnight, GMT, January 1, 1970.
|
||||
* <p>
|
||||
* @return Returns an integer value for the time since last
|
||||
* modification, as described above.
|
||||
*/
|
||||
public int getLastModified();
|
||||
/**
|
||||
* Specifies the URL that was used to originally request the stream.
|
||||
* <p>
|
||||
* @return Returns a String for the URL as described above.
|
||||
*/
|
||||
public String getURL();
|
||||
/**
|
||||
* Request reading from input stream
|
||||
* Requests reading from the input stream.
|
||||
*/
|
||||
public void requestRead(ByteRanges ranges );
|
||||
}
|
||||
|
||||
@@ -21,7 +21,22 @@
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This interface provides information about the HTML tag on the page.
|
||||
*/
|
||||
public interface PlugletTagInfo {
|
||||
/**
|
||||
* Returns all the name-value pairs found in the tag attributes.
|
||||
* <p>
|
||||
* @return Returns the attributes of an HTML tag as type
|
||||
* <code>java.util.Properties</code>.
|
||||
*/
|
||||
public Properties getAttributes();
|
||||
/**
|
||||
* Returns a value for a particular attribute. Returns <code>NULL</code>
|
||||
* if the attribute does not exist.<p>
|
||||
* @param name This is the name of the attribute.<p>
|
||||
* @return Returns the value of the named attribute as a <code>String</code>.
|
||||
*/
|
||||
public String getAttribute(String name);
|
||||
}
|
||||
|
||||
@@ -21,29 +21,73 @@
|
||||
package org.mozilla.pluglet.mozilla;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This interface extends <code>PlugletTagInfo</code>, providing additional information
|
||||
* about <code>Pluglet</code> tags (elements).
|
||||
*/
|
||||
public interface PlugletTagInfo2 extends PlugletTagInfo {
|
||||
public Properties getAttributes();
|
||||
public String getAttribute(String name);
|
||||
/* Get the type of the HTML tag that was used ot instantiate this
|
||||
* pluglet. Currently supported tags are EMBED, APPLET and OBJECT.
|
||||
*/
|
||||
/** Gets the HTML tag type associated with creation of the
|
||||
* <code>Pluglet</code> instance. Possible types are <code>EMBED</code>,
|
||||
* <code>APPLET</code>, and <code>OBJECT</code>.<p>
|
||||
* @return Returns a <code>String</code> for the tag type as described above.
|
||||
*/
|
||||
public String getTagType();
|
||||
/* Get the complete text of the HTML tag that was
|
||||
* used to instantiate this pluglet
|
||||
*/
|
||||
/** Gets the complete text of the HTML tag that was
|
||||
* used to instantiate this <code>Pluglet</code> instance.
|
||||
* <p>
|
||||
* @return Returns a <code>String</code> for the tag text as described above.
|
||||
*/
|
||||
public String getTagText();
|
||||
/**
|
||||
* Gets the base for the document. The base, in conjunction with a
|
||||
* relative URL, specifies the absolute path to the document.
|
||||
*<p>
|
||||
* @return Returns a <code>String</code> representing the document base as
|
||||
* described above.
|
||||
*/
|
||||
public String getDocumentBase();
|
||||
/* Return an encoding whose name is specified in:
|
||||
* http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303
|
||||
*/
|
||||
/** Returns the character encoding used in the document (e.g., ASCSII, Big5
|
||||
* (Traditional Chinese), Cp1122 (IBM Estonia). For a list of possible
|
||||
* character encodings, see:<p>
|
||||
* <code>http://java.sun.com/products/jdk/1.1/docs/guide/<br>
|
||||
* intl/intl.doc.html#25303</code><p>
|
||||
* @return Returns a <code>String</code> for the document encoding as described
|
||||
* above.
|
||||
*/
|
||||
public String getDocumentEncoding();
|
||||
/** Returns the alignment attribute in the tag.
|
||||
* <p>
|
||||
* @return Returns the alignment attribute as described above.
|
||||
*/
|
||||
public String getAlignment();
|
||||
/** Returns an <code>int</code> value for the width attribute of the tag.
|
||||
*<p>
|
||||
* @return Returns an integer value for the width as described above.
|
||||
*/
|
||||
public int getWidth();
|
||||
/** Returns an <code>int</code> for the height attribute of the tag.
|
||||
* <p>
|
||||
* @return Returns an integer value for the height as described above.
|
||||
*/
|
||||
public int getHeight();
|
||||
public int getBorderVertSpace();
|
||||
public int getBorderHorizSpace();
|
||||
/* Returns a unique id for the current document on which the
|
||||
* pluglet is displayed.
|
||||
/** Returns an <code>int</code> for the border vertical space attribute
|
||||
* of the tag (e.g., <code>vspace</code> with <code>IMG</code> tag).
|
||||
* <p>
|
||||
* @return Returns an integer value for the border vertical space attribute.
|
||||
*/
|
||||
public int getBorderVertSpace();
|
||||
/** Returns an <code>int</code> for the border horizontal space attribute
|
||||
* of the tag (e.g., <code>hspace</code> with <code>IMG</code> tag).
|
||||
* <p>
|
||||
* @return Returns an integer value for the border horizontal space attribute.
|
||||
*/
|
||||
public int getBorderHorizSpace();
|
||||
/** Returns a unique ID for the current document in which the
|
||||
* <code>Pluglet</code> is displayed.
|
||||
* <p>
|
||||
* @return Returns an ID for the current document as described above.
|
||||
*/
|
||||
public int getUniqueID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user