Example usage for org.apache.commons.httpclient.methods OptionsMethod setRequestHeader

List of usage examples for org.apache.commons.httpclient.methods OptionsMethod setRequestHeader

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods OptionsMethod setRequestHeader.

Prototype

@Override
public void setRequestHeader(String headerName, String headerValue) 

Source Link

Document

Set the specified request header, overwriting any previous value.

Usage

From source file:com.moss.bdbadmin.client.service.BdbClient.java

public Category map(IdProof assertion) throws ServiceException {
    try {/*from   ww w.j  av  a 2  s .  c o m*/
        OptionsMethod method = new OptionsMethod(baseUrl);
        method.setRequestHeader(AuthenticationHeader.HEADER_NAME, AuthenticationHeader.encode(assertion));

        int result = httpClient.executeMethod(method);
        if (result != 200) {
            throw new ServiceException(result);
        } else {
            Unmarshaller u = context.createUnmarshaller();
            return (Category) u.unmarshal(method.getResponseBodyAsStream());
        }
    } catch (Exception ex) {
        throw new ServiceFailure(ex);
    }
}

From source file:com.moss.bdbadmin.client.service.BdbClient.java

public EntryInfo entryInfo(IdProof assertion, String path) throws ServiceException {
    try {//from w w  w. j a v  a2s. co  m
        OptionsMethod method = new OptionsMethod(baseUrl + "/" + path);
        method.setRequestHeader(AuthenticationHeader.HEADER_NAME, AuthenticationHeader.encode(assertion));

        int result = httpClient.executeMethod(method);
        if (result != 200) {
            throw new ServiceException(result);
        } else {
            Unmarshaller u = context.createUnmarshaller();
            return (EntryInfo) u.unmarshal(method.getResponseBodyAsStream());
        }
    } catch (Exception ex) {
        throw new ServiceFailure(ex);
    }
}