org.apache.commons.logging.Log.trace() - java examples

Here are the examples of the java api org.apache.commons.logging.Log.trace() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the response message
 * @return The response message
 * @throws IOException If an IO problem occurs.
 * @see java.net.HttpURLConnection#getResponseMessage()
 * @see org.apache.commons.httpclient.HttpMethod#getStatusText()
 */
public String getResponseMessage() throws IOException {
    LOG.trace("enter HttpURLConnection.getResponseMessage()");
    return this.method.getStatusText();
}

19 View Complete Implementation : HttpState.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Get the {@link Credentials credentials} for the given authentication scope on the
 * given host.
 *
 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
 * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
 * credentials.
 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
 * corresponding credentials.  If the <i>realm</i> does not exist, return
 * the default Credentials.  If there are no default credentials, return
 * <code>null</code>.
 *
 * @param realm the authentication realm
 * @param host the host the realm is on
 * @return the credentials
 *
 * @see #setCredentials(String, String, Credentials)
 *
 * @deprecated use #getCredentials(AuthScope)
 */
public synchronized Credentials getCredentials(String realm, String host) {
    LOG.trace("enter HttpState.getCredentials(String, String");
    return matchCredentials(this.credMap, new AuthScope(host, AuthScope.ANY_PORT, realm, AuthScope.ANY_SCHEME));
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the header field at the specified position
 * @param position The position
 * @return The header field.
 * @see java.net.HttpURLConnection#getHeaderField(int)
 * @see org.apache.commons.httpclient.HttpMethod#getResponseHeaders()
 */
public String getHeaderField(int position) {
    LOG.trace("enter HttpURLConnection.getHeaderField(int)");
    // Note: HttpClient does not consider the returned Status Line as
    // a response header. However, getHeaderField(0) is supposed to
    // return the status line. Hence the special case below ...
    if (position == 0) {
        return this.method.getStatusLine().toString();
    }
    // Note: HttpClient does not currently keep headers in the same order
    // that they are read from the HTTP server.
    Header[] headers = this.method.getResponseHeaders();
    if (position < 0 || position > headers.length) {
        return null;
    }
    return headers[position - 1].getValue();
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the request method.
 * @return The request method.
 * @see java.net.HttpURLConnection#getRequestMethod()
 * @see org.apache.commons.httpclient.HttpMethod#getName()
 */
public String getRequestMethod() {
    LOG.trace("enter HttpURLConnection.getRequestMethod()");
    return this.method.getName();
}

19 View Complete Implementation : ConnectMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Populates the request headers map to with additional {@link Header
 * headers} to be submitted to the given {@link HttpConnection}.
 *
 * <p>
 * This implementation adds <tt>User-Agent</tt>, <tt>Host</tt>,
 * and <tt>Proxy-Authorization</tt> headers, when appropriate.
 * </p>
 *
 * @param state the client state
 * @param conn the {@link HttpConnection} the headers will eventually be
 *        written to
 * @throws IOException when an error occurs writing the request
 * @throws HttpException when a HTTP protocol error occurs
 *
 * @see #writeRequestHeaders
 */
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
    LOG.trace("enter ConnectMethod.addRequestHeaders(HttpState, " + "HttpConnection)");
    addUserAgentRequestHeader(state, conn);
    addHostRequestHeader(state, conn);
    addProxyConnectionHeader(state, conn);
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Writes <tt>"\r\n".getBytes()</tt> to the output stream.
 *
 * @throws IllegalStateException if the connection is not open
 * @throws IOException if an I/O problem occurs
 */
public void writeLine() throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.writeLine()");
    write(CRLF);
}

19 View Complete Implementation : PostMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Adds a new parameter to be used in the POST request body.
 *
 * @param paramName The parameter name to add.
 * @param paramValue The parameter value to add.
 *
 * @throws IllegalArgumentException if either argument is null
 *
 * @since 1.0
 */
public void addParameter(String paramName, String paramValue) throws IllegalArgumentException {
    LOG.trace("enter PostMethod.addParameter(String, String)");
    if ((paramName == null) || (paramValue == null)) {
        throw new IllegalArgumentException("Arguments to addParameter(String, String) cannot be null");
    }
    super.clearRequestBody();
    this.params.add(new NameValuePair(paramName, paramValue));
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns the length of the request body.
 *
 * @return number of bytes in the request body
 */
protected long getRequestContentLength() {
    LOG.trace("enter EnreplacedyEnclosingMethod.getRequestContentLength()");
    if (!hasRequestContent()) {
        return 0;
    }
    if (this.chunked) {
        return -1;
    }
    if (this.requestEnreplacedy == null) {
        this.requestEnreplacedy = generateRequestEnreplacedy();
    }
    return (this.requestEnreplacedy == null) ? 0 : this.requestEnreplacedy.getContentLength();
}

19 View Complete Implementation : HttpClient.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Executes the given {@link HttpMethod HTTP method} using the given custom
 * {@link HostConfiguration host configuration} with the given custom
 * {@link HttpState HTTP state}.
 *
 * @param hostconfig The {@link HostConfiguration host configuration} to use.
 * If <code>null</code>, the host configuration returned by {@link #getHostConfiguration} will be used.
 * @param method the {@link HttpMethod HTTP method} to execute.
 * @param state the {@link HttpState HTTP state} to use when executing the method.
 * If <code>null</code>, the state returned by {@link #getState} will be used.
 *
 * @return the method's response code
 *
 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
 *                     can be recovered from.
 * @throws HttpException  If a protocol exception occurs. Usually protocol exceptions
 *                    cannot be recovered from.
 * @since 2.0
 */
public int executeMethod(HostConfiguration hostconfig, final HttpMethod method, final HttpState state) throws IOException, HttpException {
    LOG.trace("enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)");
    if (method == null) {
        throw new IllegalArgumentException("HttpMethod parameter may not be null");
    }
    HostConfiguration defaulthostconfig = getHostConfiguration();
    if (hostconfig == null) {
        hostconfig = defaulthostconfig;
    }
    URI uri = method.getURI();
    if (hostconfig == defaulthostconfig || uri.isAbsoluteURI()) {
        // make a deep copy of the host defaults
        hostconfig = (HostConfiguration) hostconfig.clone();
        if (uri.isAbsoluteURI()) {
            hostconfig.setHost(uri);
        }
    }
    HttpMethodDirector methodDirector = new HttpMethodDirector(getHttpConnectionManager(), hostconfig, this.params, (state == null ? getState() : state));
    methodDirector.executeMethod(method);
    return method.getStatusCode();
}

19 View Complete Implementation : HttpState.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Get the {@link Credentials credentials} for the proxy host with the given
 * authentication scope.
 *
 * If the <i>realm</i> exists on <i>host</i>, return the coresponding credentials.
 * If the <i>host</i> exists with a <tt>null</tt> <i>realm</i>, return the corresponding
 * credentials.
 * If the <i>realm</i> exists with a <tt>null</tt> <i>host</i>, return the
 * corresponding credentials.  If the <i>realm</i> does not exist, return
 * the default Credentials.  If there are no default credentials, return
 * <code>null</code>.
 *
 * @param realm the authentication realm
 * @param proxyHost the proxy host the realm is on
 * @return the credentials
 * @see #setProxyCredentials(String, String, Credentials)
 *
 * @deprecated use #getProxyCredentials(AuthScope)
 */
public synchronized Credentials getProxyCredentials(String realm, String proxyHost) {
    LOG.trace("enter HttpState.getCredentials(String, String");
    return matchCredentials(this.proxyCred, new AuthScope(proxyHost, AuthScope.ANY_PORT, realm, AuthScope.ANY_SCHEME));
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Writes the specified bytes, followed by <tt>"\r\n".getBytes()</tt> to the
 * output stream.
 *
 * @param data the bytes to be written
 * @throws IllegalStateException if the connection is not open
 * @throws IOException if an I/O problem occurs
 */
public void writeLine(byte[] data) throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.writeLine(byte[])");
    write(data);
    writeLine();
}

19 View Complete Implementation : HttpState.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Adds an array of {@link Cookie HTTP cookies}. Cookies are added individually and
 * in the given array order. If any of the given cookies has already expired it will
 * not be added, but existing values will still be removed.
 *
 * @param cookies the {@link Cookie cookies} to be added
 *
 * @see #addCookie(Cookie)
 */
public synchronized void addCookies(Cookie[] cookies) {
    LOG.trace("enter HttpState.addCookies(Cookie[])");
    if (cookies != null) {
        for (int i = 0; i < cookies.length; i++) {
            this.addCookie(cookies[i]);
        }
    }
}

19 View Complete Implementation : Part.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Gets the length of the multipart message including the given parts.
 *
 * @param parts The parts.
 * @param partBoundary The ASCII bytes to use as the part boundary.
 * @return The total length
 *
 * @throws IOException If an I/O error occurs while writing the parts.
 *
 * @since 3.0
 */
public static long getLengthOfParts(Part[] parts, byte[] partBoundary) throws IOException {
    LOG.trace("getLengthOfParts(Parts[])");
    if (parts == null) {
        throw new IllegalArgumentException("Parts may not be null");
    }
    long total = 0;
    for (int i = 0; i < parts.length; i++) {
        // set the part boundary before we calculate the part's length
        parts[i].setPartBoundary(partBoundary);
        long l = parts[i].length();
        if (l < 0) {
            return -1;
        }
        total += l;
    }
    total += EXTRA_BYTES.length;
    total += partBoundary.length;
    total += EXTRA_BYTES.length;
    total += CRLF_BYTES.length;
    return total;
}

19 View Complete Implementation : MultipartPostMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * <p>Return the length of the request body.</p>
 *
 * <p>Once this method has been invoked, the request parameters cannot be
 * altered until the method is {@link #recycle recycled}.</p>
 *
 * @return The request content length.
 */
protected long getRequestContentLength() throws IOException {
    LOG.trace("enter MultipartPostMethod.getRequestContentLength()");
    return Part.getLengthOfParts(getParts());
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
// Note: We don't implement the following methods so that they default to
// the JDK implementation. They will all call
// <code>getHeaderField(String)</code> which we have overridden.
// java.net.HttpURLConnection#getHeaderFieldDate(String, long)
// java.net.HttpURLConnection#getContentLength()
// java.net.HttpURLConnection#getContentType()
// java.net.HttpURLConnection#getContentEncoding()
// java.net.HttpURLConnection#getDate()
// java.net.HttpURLConnection#getHeaderFieldInt(String, int)
// java.net.HttpURLConnection#getExpiration()
// java.net.HttpURLConnection#getLastModified()
/**
 * Not available: the data must have already been retrieved.
 */
public void setInstanceFollowRedirects(boolean isFollowingRedirects) {
    LOG.trace("enter HttpURLConnection.setInstanceFollowRedirects(boolean)");
    throw new RuntimeException("This clreplaced can only be used with already" + "retrieved data");
}

19 View Complete Implementation : HeaderElement.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * This parses the value part of a header. The result is an array of
 * HeaderElement objects.
 *
 * @param headerValue  the string representation of the header value
 *                     (as received from the web server).
 * @return array of {@link HeaderElement}s.
 *
 * @since 3.0
 */
public static final HeaderElement[] parseElements(String headerValue) {
    LOG.trace("enter HeaderElement.parseElements(String)");
    if (headerValue == null) {
        return new HeaderElement[] {};
    }
    return parseElements(headerValue.toCharArray());
}

19 View Complete Implementation : GetMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
// ------------------------------------------------------------- Properties
/**
 * Recycles the HTTP method so that it can be used again.
 * Note that all of the instance variables will be reset
 * once this method has been called. This method will also
 * release the connection being used by this HTTP method.
 *
 * @see #releaseConnection()
 *
 * @since 1.0
 *
 * @deprecated no longer supported and will be removed in the future
 *             version of HttpClient
 */
public void recycle() {
    LOG.trace("enter GetMethod.recycle()");
    super.recycle();
    setFollowRedirects(true);
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
// --------------------------------------------------------- Public Methods
/**
 * Gets an input stream for the HttpMethod response body.
 * @throws IOException If an IO problem occurs.
 * @return The input stream.
 * @see java.net.HttpURLConnection#getInputStream()
 * @see org.apache.commons.httpclient.HttpMethod#getResponseBodyreplacedtream()
 */
public InputStream getInputStream() throws IOException {
    LOG.trace("enter HttpURLConnection.getInputStream()");
    return this.method.getResponseBodyreplacedtream();
}

19 View Complete Implementation : StringPart.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the length of the data.
 * @return The length of the data.
 * @throws IOException If an IO problem occurs
 * @see org.apache.commons.httpclient.methods.multipart.Part#lengthOfData()
 */
protected long lengthOfData() throws IOException {
    LOG.trace("enter lengthOfData()");
    return getContent().length;
}

19 View Complete Implementation : PostMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Clears request body.
 *
 * <p>This method must be overwritten by sub-clreplacedes that implement
 * alternative request content input methods</p>
 *
 * @since 2.0beta1
 */
protected void clearRequestBody() {
    LOG.trace("enter PostMethod.clearRequestBody()");
    this.params.clear();
    super.clearRequestBody();
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Sets the request body to be the specified inputstream.
 *
 * @param body Request body content as {@link java.io.InputStream}
 *
 * @deprecated use {@link #setRequestEnreplacedy(RequestEnreplacedy)}
 */
public void setRequestBody(InputStream body) {
    LOG.trace("enter EnreplacedyEnclosingMethod.setRequestBody(InputStream)");
    clearRequestBody();
    this.requestStream = body;
}

19 View Complete Implementation : HeaderElement.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * This parses the value part of a header. The result is an array of
 * HeaderElement objects.
 *
 * @param headerValue  the string representation of the header value
 *                     (as received from the web server).
 * @return array of {@link HeaderElement}s.
 * @throws HttpException if the above syntax rules are violated.
 *
 * @deprecated Use #parseElements(String).
 */
public static final HeaderElement[] parse(String headerValue) throws HttpException {
    LOG.trace("enter HeaderElement.parse(String)");
    if (headerValue == null) {
        return new HeaderElement[] {};
    }
    return parseElements(headerValue.toCharArray());
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Sets length information about the request body.
 *
 * <p>
 * Note: If you specify a content length the request is unbuffered. This
 * prevents redirection and automatic retry if a request fails the first
 * time. This means that the HttpClient can not perform authorization
 * automatically but will throw an Exception. You will have to set the
 * necessary 'Authorization' or 'Proxy-Authorization' headers manually.
 * </p>
 *
 * @param length size in bytes or any of CONTENT_LENGTH_AUTO,
 *        CONTENT_LENGTH_CHUNKED. If number of bytes or CONTENT_LENGTH_CHUNKED
 *        is specified the content will not be buffered internally and the
 *        Content-Length header of the request will be used. In this case
 *        the user is responsible to supply the correct content length.
 *        If CONTENT_LENGTH_AUTO is specified the request will be buffered
 *        before it is sent over the network.
 *
 * @deprecated Use {@link #setContentChunked(boolean)} or
 * {@link #setRequestEnreplacedy(RequestEnreplacedy)}
 */
public void setRequestContentLength(long length) {
    LOG.trace("enter EnreplacedyEnclosingMethod.setRequestContentLength(int)");
    this.requestContentLength = length;
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Sets the request body to be the specified string.
 * The string will be submitted, using the encoding
 * specified in the Content-Type request header.<br>
 * Example: <code>setRequestHeader("Content-type", "text/xml; charset=UTF-8");</code><br>
 * Would use the UTF-8 encoding.
 * If no charset is specified, the
 * {@link org.apache.commons.httpclient.HttpConstants#DEFAULT_CONTENT_CHARSET default}
 * content encoding is used (ISO-8859-1).
 *
 * @param body Request body content as a string
 *
 * @deprecated use {@link #setRequestEnreplacedy(RequestEnreplacedy)}
 */
public void setRequestBody(String body) {
    LOG.trace("enter EnreplacedyEnclosingMethod.setRequestBody(String)");
    clearRequestBody();
    this.requestString = body;
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Tests if input data avaialble. This method returns immediately
 * and does not perform any read operations on the input socket
 *
 * @return boolean <tt>true</tt> if input data is available,
 *                 <tt>false</tt> otherwise.
 *
 * @throws IOException If an IO problem occurs
 * @throws IllegalStateException If the connection isn't open.
 */
public boolean isResponseAvailable() throws IOException {
    LOG.trace("enter HttpConnection.isResponseAvailable()");
    if (this.isOpen) {
        return this.inputStream.available() > 0;
    } else {
        return false;
    }
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns <tt>true</tt> if there is a request body to be sent.
 *
 * <P>This method must be overridden by sub-clreplacedes that implement
 * alternative request content input methods
 * </p>
 *
 * @return boolean
 *
 * @since 2.0beta1
 */
protected boolean hasRequestContent() {
    LOG.trace("enter EnreplacedyEnclosingMethod.hasRequestContent()");
    return (this.requestEnreplacedy != null) || (this.requestStream != null) || (this.requestString != null);
}

19 View Complete Implementation : DigestScheme.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Encodes the 128 bit (16 bytes) MD5 digest into a 32 characters long
 * <CODE>String</CODE> according to RFC 2617.
 *
 * @param binaryData array containing the digest
 * @return encoded MD5, or <CODE>null</CODE> if encoding failed
 */
private static String encode(byte[] binaryData) {
    LOG.trace("enter DigestScheme.encode(byte[])");
    if (binaryData.length != 16) {
        return null;
    }
    char[] buffer = new char[32];
    for (int i = 0; i < 16; i++) {
        int low = (int) (binaryData[i] & 0x0f);
        int high = (int) ((binaryData[i] & 0xf0) >> 4);
        buffer[i * 2] = HEXADECIMAL[high];
        buffer[(i * 2) + 1] = HEXADECIMAL[low];
    }
    return new String(buffer);
}

19 View Complete Implementation : HttpState.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns an array of {@link Cookie cookies} that this HTTP
 * state currently contains.
 *
 * @return an array of {@link Cookie cookies}.
 *
 * @see #getCookies(String, int, String, boolean)
 */
public synchronized Cookie[] getCookies() {
    LOG.trace("enter HttpState.getCookies()");
    return (Cookie[]) (cookies.toArray(new Cookie[cookies.size()]));
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Writes <tt>"\r\n".getBytes()</tt> to the output stream.
 *
 * @throws IllegalStateException if the connection is not open
 * @throws IOException if an I/O problem occurs
 */
public void printLine() throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.printLine()");
    writeLine();
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the response code.
 * @return The response code.
 * @throws IOException If an IO problem occurs.
 * @see java.net.HttpURLConnection#getResponseCode()
 * @see org.apache.commons.httpclient.HttpMethod#getStatusCode()
 */
public int getResponseCode() throws IOException {
    LOG.trace("enter HttpURLConnection.getResponseCode()");
    return this.method.getStatusCode();
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Writes <i>length</i> bytes in <i>data</i> starting at
 * <i>offset</i> to the output stream.
 *
 * The general contract for
 * write(b, off, len) is that some of the bytes in the array b are written
 * to the output stream in order; element b[off] is the first byte written
 * and b[off+len-1] is the last byte written by this operation.
 *
 * @param data array containing the data to be written.
 * @param offset the start offset in the data.
 * @param length the number of bytes to write.
 * @throws IllegalStateException if not connected
 * @throws IOException if an I/O problem occurs
 */
public void write(byte[] data, int offset, int length) throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.write(byte[], int, int)");
    if (offset < 0) {
        throw new IllegalArgumentException("Array offset may not be negative");
    }
    if (length < 0) {
        throw new IllegalArgumentException("Array length may not be negative");
    }
    if (offset + length > data.length) {
        throw new IllegalArgumentException("Given offset and length exceed the array length");
    }
    replacedertOpen();
    this.outputStream.write(data, offset, length);
}

19 View Complete Implementation : HttpClient.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
// --------------------------------------------------------- Public Methods
/**
 * Executes the given {@link HttpMethod HTTP method}.
 *
 * @param method the {@link HttpMethod HTTP method} to execute.
 * @return the method's response code
 *
 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
 *                     can be recovered from.
 * @throws HttpException  If a protocol exception occurs. Usually protocol exceptions
 *                    cannot be recovered from.
 */
public int executeMethod(HttpMethod method) throws IOException, HttpException {
    LOG.trace("enter HttpClient.executeMethod(HttpMethod)");
    // execute this method and use its host configuration, if it has one
    return executeMethod(null, method, null);
}

19 View Complete Implementation : HttpParser.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Read up to <tt>"\n"</tt> from an (unchunked) input stream.
 * If the stream ends before the line terminator is found,
 * the last part of the string will still be returned.
 * If no input data available, <code>null</code> is returned
 *
 * @param inputStream the stream to read from
 *
 * @throws IOException if an I/O problem occurs
 * @return a line from the stream
 *
 * @deprecated use #readLine(InputStream, String)
 */
public static String readLine(InputStream inputStream) throws IOException {
    LOG.trace("enter HttpParser.readLine(InputStream)");
    return readLine(inputStream, "US-ASCII");
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Recycles the HTTP method so that it can be used again.
 * Note that all of the instance variables will be reset
 * once this method has been called. This method will also
 * release the connection being used by this HTTP method.
 *
 * @see #releaseConnection()
 *
 * @deprecated no longer supported and will be removed in the future
 *             version of HttpClient
 */
public void recycle() {
    LOG.trace("enter EnreplacedyEnclosingMethod.recycle()");
    clearRequestBody();
    this.requestContentLength = InputStreamRequestEnreplacedy.CONTENT_LENGTH_AUTO;
    this.repeatCount = 0;
    this.chunked = false;
    super.recycle();
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the header field
 * @param name the name of the header
 * @return the header field.
 * @see java.net.HttpURLConnection#getHeaderField(String)
 * @see org.apache.commons.httpclient.HttpMethod#getResponseHeaders()
 */
public String getHeaderField(String name) {
    LOG.trace("enter HttpURLConnection.getHeaderField(String)");
    // Note: Return the last matching header in the Header[] array, as in
    // the JDK implementation.
    Header[] headers = this.method.getResponseHeaders();
    for (int i = headers.length - 1; i >= 0; i--) {
        if (headers[i].getName().equalsIgnoreCase(name)) {
            return headers[i].getValue();
        }
    }
    return null;
}

19 View Complete Implementation : HttpURLConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the header field key
 * @param keyPosition The key position
 * @return The header field key.
 * @see java.net.HttpURLConnection#getHeaderFieldKey(int)
 * @see org.apache.commons.httpclient.HttpMethod#getResponseHeaders()
 */
public String getHeaderFieldKey(int keyPosition) {
    LOG.trace("enter HttpURLConnection.getHeaderFieldKey(int)");
    // Note: HttpClient does not consider the returned Status Line as
    // a response header. However, getHeaderFieldKey(0) is supposed to
    // return null. Hence the special case below ...
    if (keyPosition == 0) {
        return null;
    }
    // Note: HttpClient does not currently keep headers in the same order
    // that they are read from the HTTP server.
    Header[] headers = this.method.getResponseHeaders();
    if (keyPosition < 0 || keyPosition > headers.length) {
        return null;
    }
    return headers[keyPosition - 1].getName();
}

19 View Complete Implementation : PostMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns <tt>true</tt> if there is a request body to be sent.
 *
 * <P>This method must be overwritten by sub-clreplacedes that implement
 * alternative request content input methods
 * </p>
 *
 * @return boolean
 *
 * @since 2.0beta1
 */
protected boolean hasRequestContent() {
    LOG.trace("enter PostMethod.hasRequestContent()");
    if (!this.params.isEmpty()) {
        return true;
    } else {
        return super.hasRequestContent();
    }
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Clears the request body.
 *
 * <p>This method must be overridden by sub-clreplacedes that implement
 * alternative request content input methods.</p>
 *
 * @since 2.0beta1
 */
protected void clearRequestBody() {
    LOG.trace("enter EnreplacedyEnclosingMethod.clearRequestBody()");
    this.requestStream = null;
    this.requestString = null;
    this.requestEnreplacedy = null;
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Sets length information about the request body.
 *
 * <p>
 * Note: If you specify a content length the request is unbuffered. This
 * prevents redirection and automatic retry if a request fails the first
 * time. This means that the HttpClient can not perform authorization
 * automatically but will throw an Exception. You will have to set the
 * necessary 'Authorization' or 'Proxy-Authorization' headers manually.
 * </p>
 *
 * @param length size in bytes or any of CONTENT_LENGTH_AUTO,
 *        CONTENT_LENGTH_CHUNKED. If number of bytes or CONTENT_LENGTH_CHUNKED
 *        is specified the content will not be buffered internally and the
 *        Content-Length header of the request will be used. In this case
 *        the user is responsible to supply the correct content length.
 *        If CONTENT_LENGTH_AUTO is specified the request will be buffered
 *        before it is sent over the network.
 *
 * @deprecated Use {@link #setContentChunked(boolean)} or
 * {@link #setRequestEnreplacedy(RequestEnreplacedy)}
 */
public void setRequestContentLength(int length) {
    LOG.trace("enter EnreplacedyEnclosingMethod.setRequestContentLength(int)");
    this.requestContentLength = length;
}

19 View Complete Implementation : FilePart.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return the length of the data.
 * @return The length.
 * @throws IOException if an IO problem occurs
 * @see org.apache.commons.httpclient.methods.multipart.Part#lengthOfData()
 */
protected long lengthOfData() throws IOException {
    LOG.trace("enter lengthOfData()");
    return source.getLength();
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Reads up to <tt>"\n"</tt> from the (unchunked) input stream.
 * If the stream ends before the line terminator is found,
 * the last part of the string will still be returned.
 *
 * @throws IllegalStateException if the connection is not open
 * @throws IOException if an I/O problem occurs
 * @return a line from the response
 *
 * @deprecated use #readLine(String)
 */
public String readLine() throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.readLine()");
    replacedertOpen();
    return HttpParser.readLine(inputStream);
}

19 View Complete Implementation : BasicScheme.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns a basic <tt>Authorization</tt> header value for the given
 * {@link UsernamePreplacedwordCredentials} and charset.
 *
 * @param credentials The credentials to encode.
 * @param charset The charset to use for encoding the credentials
 *
 * @return a basic authorization string
 *
 * @since 3.0
 */
public static String authenticate(UsernamePreplacedwordCredentials credentials, String charset) {
    LOG.trace("enter BasicScheme.authenticate(UsernamePreplacedwordCredentials, String)");
    if (credentials == null) {
        throw new IllegalArgumentException("Credentials may not be null");
    }
    if (charset == null || charset.length() == 0) {
        throw new IllegalArgumentException("charset may not be null or empty");
    }
    StringBuffer buffer = new StringBuffer();
    buffer.append(credentials.getUserName());
    buffer.append(":");
    buffer.append(credentials.getPreplacedword());
    return "Basic " + EncodingUtil.getAsciiString(Base64.encodeBase64(EncodingUtil.getBytes(buffer.toString(), charset)));
}

19 View Complete Implementation : HttpState.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Removes all of {@link Cookie cookies} in this HTTP state
 * that have expired according to the current system time.
 *
 * @see #purgeExpiredCookies(java.util.Date)
 */
public synchronized boolean purgeExpiredCookies() {
    LOG.trace("enter HttpState.purgeExpiredCookies()");
    return purgeExpiredCookies(new Date());
}

19 View Complete Implementation : PostMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Sets the value of parameter with parameterName to parameterValue. This method
 * does not preserve the initial insertion order.
 *
 * @param parameterName name of the parameter
 * @param parameterValue value of the parameter
 *
 * @since 2.0
 */
public void setParameter(String parameterName, String parameterValue) {
    LOG.trace("enter PostMethod.setParameter(String, String)");
    removeParameter(parameterName);
    addParameter(parameterName, parameterValue);
}

19 View Complete Implementation : HttpClient.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Executes the given {@link HttpMethod HTTP method} using custom
 * {@link HostConfiguration host configuration}.
 *
 * @param hostConfiguration The {@link HostConfiguration host configuration} to use.
 * If <code>null</code>, the host configuration returned by {@link #getHostConfiguration} will be used.
 * @param method the {@link HttpMethod HTTP method} to execute.
 * @return the method's response code
 *
 * @throws IOException If an I/O (transport) error occurs. Some transport exceptions
 *                     can be recovered from.
 * @throws HttpException  If a protocol exception occurs. Usually protocol exceptions
 *                    cannot be recovered from.
 * @since 2.0
 */
public int executeMethod(final HostConfiguration hostConfiguration, final HttpMethod method) throws IOException, HttpException {
    LOG.trace("enter HttpClient.executeMethod(HostConfiguration,HttpMethod)");
    return executeMethod(hostConfiguration, method, null);
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Return a {@link InputStream} suitable for reading the response.
 * @return InputStream The response input stream.
 * @throws IOException If an IO problem occurs
 * @throws IllegalStateException If the connection isn't open.
 */
public InputStream getResponseInputStream() throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.getResponseInputStream()");
    replacedertOpen();
    return inputStream;
}

19 View Complete Implementation : HeaderElement.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Returns parameter with the given name, if found. Otherwise null
 * is returned
 *
 * @param name The name to search by.
 * @return NameValuePair parameter with the given name
 */
public NameValuePair getParameterByName(String name) {
    LOG.trace("enter HeaderElement.getParameterByName(String)");
    if (name == null) {
        throw new IllegalArgumentException("Name may not be null");
    }
    NameValuePair found = null;
    NameValuePair[] parameters = getParameters();
    if (parameters != null) {
        for (int i = 0; i < parameters.length; i++) {
            NameValuePair current = parameters[i];
            if (current.getName().equalsIgnoreCase(name)) {
                found = current;
                break;
            }
        }
    }
    return found;
}

19 View Complete Implementation : HttpParser.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Parses headers from the given stream.  Headers with the same name are not
 * combined.
 *
 * @param is the stream to read headers from
 *
 * @return an array of headers in the order in which they were parsed
 *
 * @throws IOException if an IO error occurs while reading from the stream
 * @throws HttpException if there is an error parsing a header value
 *
 * @deprecated use #parseHeaders(InputStream, String)
 */
public static Header[] parseHeaders(InputStream is) throws IOException, HttpException {
    LOG.trace("enter HeaderParser.parseHeaders(InputStream, String)");
    return parseHeaders(is, "US-ASCII");
}

19 View Complete Implementation : EntityEnclosingMethod.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Generates the request body.
 *
 * <p>This method must be overridden by sub-clreplacedes that implement
 * alternative request content input methods.</p>
 *
 * @return request body as an array of bytes. If the request content
 *          has not been set, returns <tt>null</tt>.
 *
 * @since 2.0beta1
 */
protected byte[] generateRequestBody() {
    LOG.trace("enter EnreplacedyEnclosingMethod.renerateRequestBody()");
    return null;
}

19 View Complete Implementation : HttpConnection.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : knopflerfish
/**
 * Reads up to <tt>"\n"</tt> from the (unchunked) input stream.
 * If the stream ends before the line terminator is found,
 * the last part of the string will still be returned.
 *
 * @param charset the charset to use for reading the data
 *
 * @throws IllegalStateException if the connection is not open
 * @throws IOException if an I/O problem occurs
 * @return a line from the response
 *
 * @since 3.0
 */
public String readLine(final String charset) throws IOException, IllegalStateException {
    LOG.trace("enter HttpConnection.readLine()");
    replacedertOpen();
    return HttpParser.readLine(inputStream, charset);
}