java.net.ProtocolException
ProtocolException is described in the javadoc comments as:
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
author: Chris Warth version: 1.16, 12/19/03 since: JDK1.0
Where is this exception thrown?
Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.
- The message 'java.net.ProtocolException: Can't reset method: already connected' is thrown within the method:
java.net.HttpURLConnection.setRequestMethod(String) - The message 'java.net.ProtocolException: Invalid HTTP method: ...' is thrown within the method:
java.net.HttpURLConnection.setRequestMethod(String)
How is this exception thrown?
The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.
Any source code quoted in this section is subject to the Java Research License unless stated otherwise.
java.net.HttpURLConnection.setRequestMethod(String)
/** * Set the method for the URL request, one of: * <UL> * <LI>GET * <LI>POST * <LI>HEAD * <LI>OPTIONS * <LI>PUT * <LI>DELETE * <LI>TRACE * </UL> are legal, subject to protocol restrictions. The default * method is GET. * @param method the HTTP method * @exception ProtocolException if the method cannot be reset or if * the requested method isn't valid for HTTP. * @see #getRequestMethod() */ public void setRequestMethod(String method) throws ProtocolException { if (connected) { throw new ProtocolException('Can't reset method: already connected'); } for (int i = 0; i < methods.length; i++) { if (methods[i].equals(method)) { this.method = method; return; } } throw new ProtocolException('Invalid HTTP method: ' + method); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Comments
Post a Comment