Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.javaswift.joss.headers;
 
 
 import java.util.List;

Basic header that needs to be added to a command. The underlying implementation takes care of the specifics for a header.
public abstract class Header {

    
Called before executing the request by the AbstractCommand. Makes sure the header is set on the request object

Parameters:
request the request to which the header must be applied
    public void setHeader(HttpRequestBase request) {
        request.setHeader(getHeaderName(), getHeaderValue());
    }

    
Returns the value that must be set in the request. Eg, "bytes: 4-12"

Returns:
the value for the request header
    public abstract String getHeaderValue();

    
Returns the header name that must be set in the request. Eg, "Range"

Returns:
the name for the request header
    public abstract String getHeaderName();
    public static List<org.apache.http.HeadergetResponseHeadersStartingWith(HttpResponse responseString prefix) {
        List<org.apache.http.Headerheaders = new ArrayList<org.apache.http.Header>();
        for (org.apache.http.Header header : response.getAllHeaders()) {
            if (header.getName().startsWith(prefix)) {
                headers.add(header);
            }
        }
        return headers;
    }
    public static String convertResponseHeader(HttpResponse responseString name) {
        return response.getHeaders(name) == null ? null : response.getHeaders(name).length == 0 ? null : response.getHeaders(name)[0].getValue();
    }
    public static boolean headerNotEmpty(HttpResponse responseString headerName) {
        return
                response.getHeaders(headerName) != null &&
                response.getHeaders(headerName).length > 0 &&
                response.getHeaders(headerName)[0].getValue().length() > 0;
    }
New to GrepCode? Check out our FAQ X