UC: the URL Connection

This is the interface to the objects which embody web operations.

The model is based on the java URLConnection class: there is a sequence of operations you must do:

  1. create an object supporting this interface (either directly with the appropriate protocol's URL Connection Factory object, or indirectly via the URL Connection Factory Registry),
  2. call connect to do or start the operation,
  3. If there is an output stream associated with this operatinon (e.g., an http or ftp PUT; an nntp POST), call getOS to get an output stream to which you can write, and then write,
  4. If there is an expected response,(for most things there will be), call getIS to get an input stream from which the response may be read, and read that response.
  5. release all of your handles.


This interface is defined in java, and is compiled with JMC. The C syntax is included in each method description, and is summarised below.

import netscape.url.URL;
import netscape.types.Interval;

public abstract interface UC {
  public abstract void connect(Interval timeout) throws Exception;
  public abstract IS getIS() throws Exception;
  public abstract OS getOS() throws Exception;
  public abstract URL getURL();
  public abstract boolean is_secure();
  public abstract boolean is_proxyable();
  public abstract boolean is_network();

Interface Methods

Inherited Methods

Although this interface does not inherit anything, note that all objects implementing this interface will inherit the usual JMC base methods.

C interface

#include "UC.h"

void UC_connect(UC *self, PRIntervalTime timeout, JMCException **e);
IS *UC_getIS(UC *self, JMCException **e);
OS *UC_getOS(UC *self, JMCException **e);
URL *UC_getURL(UC *self, JMCException **e);
jbool UC_is__secure(UC *self, JMCException **e);
jbool UC_is__proxyable(UC *self, JMCException **e);
jbool UC_is__network(UC *self, JMCException **e);

/* methods inherited from base JMC object interface */
void *UC_getInterface(UC *self, JMCInterfaceID id, JMCException **e);
void UC_addRef(UC *self, JMCException **e);
void UC_release(UC *self, JMCException **e);
jint UC_hashCode(UC *self, JMCException **e);
void *UC_clone(UC *self, JMCException **e);
const char *UC_toString(UC *self, JMCException **e);
void UC_finalize(UC *self, JMCException **e);

Written by Frederick at 14:43 03.04.1997.