/*
* 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.
*/
/**
* A class to represent an active connection to an object
* represented by a URL.
* @author James Gosling
*/
/** The URL that it is connected to */
/** Create a URLConnection object. These should not be created directly:
instead they should be created by protocol handers in response to
URL.openConnection.
@param u The URL that this connects to.
*/
super(u);
properties = new MessageHeader();
}
/** Call this routine to get the property list for this object.
* Properties (like content-type) that have explicit getXX() methods
* associated with them should be accessed using those methods. */
return properties;
}
/** Call this routine to set the property list for this object. */
this.properties = properties;
}
if(connected)
throw new IllegalAccessError("Already connected");
throw new NullPointerException ("key cannot be null");
}
/**
* The following three methods addRequestProperty, getRequestProperty,
* and getRequestProperties were copied from the superclass implementation
* before it was changed by CR:6230836, to maintain backward compatibility.
*/
if (connected)
throw new IllegalStateException("Already connected");
throw new NullPointerException ("key is null");
}
if (connected)
throw new IllegalStateException("Already connected");
return null;
}
if (connected)
throw new IllegalStateException("Already connected");
return Collections.EMPTY_MAP;
}
try {
} catch (Exception e) {
return null;
}
}
/**
* Return the key for the nth header field. Returns null if
* there are fewer than n fields. This can be used to iterate
* through all the headers in the message.
*/
try {
} catch (Exception e) {
return null;
}
}
/**
* Return the value for the nth header field. Returns null if
* there are fewer than n fields. This can be used in conjunction
* with getHeaderFieldKey to iterate through all the headers in the message.
*/
try {
} catch (Exception e) {
return null;
}
}
/** Call this routine to get the content-type associated with this
* object.
*/
if (contentType == null)
if (contentType == null) {
try {
}
else
}
/*
* If the Mime header had a Content-encoding field and its value
* was not one of the values that essentially indicate no
* encoding, we force the content type to be unknown. This will
* cause a save dialog to be presented to the user. It is not
* ideal but is better than what we were previously doing, namely
* bringing up an image tool for compressed tar files.
*/
}
return contentType;
}
/**
* Set the content type of this URL to a specific value.
* @param type The content type to use. One of the
* content_* static variables in this
* class should be used.
* eg. setType(URL.content_html);
*/
contentType = type;
}
/** Call this routine to get the content-length associated with this
* object.
*/
public int getContentLength() {
try {
} catch (Exception e) {
return -1;
}
int l = contentLength;
if (l < 0) {
try {
setContentLength(l);
} catch(Exception e) {
}
}
return l;
}
/** Call this routine to set the content-length associated with this
* object.
*/
}
/**
* Returns true if the data associated with this URL can be cached.
*/
public boolean canCache() {
REMIND */ ;
}
/**
* Call this to close the connection and flush any remaining data.
* Overriders must remember to call super.close()
*/
public void close() {
}
}
}
}