Example usage for org.apache.http.client.methods HttpOptions HttpOptions

List of usage examples for org.apache.http.client.methods HttpOptions HttpOptions

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpOptions HttpOptions.

Prototype

public HttpOptions() 

Source Link

Usage

From source file:com.github.grantjforrester.bdd.rest.httpclient.HttpClientRequest.java

HttpRequestBase getRequestImpl(URI baseUri) {
    HttpRequestBase request = null;//w  w  w  .  ja v  a  2s  .co  m

    switch (method) {
    case HEAD:
        request = new HttpHead();
        break;
    case OPTIONS:
        request = new HttpOptions();
        break;
    case GET:
        request = new HttpGet();
        break;
    case POST:
        request = new HttpPost();
        break;
    case PUT:
        request = new HttpPut();
        break;
    case DELETE:
        request = new HttpDelete();
        break;
    case PATCH:
        request = new HttpPatch();
    }

    request.setURI(baseUri.resolve(uri));
    request.setHeaders(headers.toArray(new Header[headers.size()]));
    if (content != null) {
        ((HttpEntityEnclosingRequest) request).setEntity(new ByteArrayEntity(content));
    }

    return request;
}

From source file:net.javacrumbs.restfire.httpcomponents.HttpComponentsRequestFactory.java

public RequestBuilder options() {
    return createRequestBuilder(new HttpOptions());
}

From source file:pt.sapo.pai.vip.VipServlet.java

@Override
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    processRequest(request, response, () -> new HttpOptions());
}

From source file:com.lonepulse.zombielink.request.RequestUtils.java

/**
 * <p>Retrieves the proper extension of {@link HttpRequestBase} for the given {@link InvocationContext}. 
 * This implementation is solely dependent upon the {@link RequestMethod} property in the annotated 
 * metdata of the endpoint method definition.</p>
 *
 * @param context//from  www . j  a  v  a 2  s .com
 *          the {@link InvocationContext} for which a {@link HttpRequestBase} is to be generated 
 * <br><br>
 * @return the {@link HttpRequestBase} translated from the {@link InvocationContext}'s {@link RequestMethod}
 * <br><br>
 * @throws NullPointerException
 *          if the supplied {@link InvocationContext} was {@code null} 
 * <br><br>
 * @since 1.3.0
 */
static HttpRequestBase translateRequestMethod(InvocationContext context) {

    RequestMethod requestMethod = Metadata.findMethod(assertNotNull(context).getRequest());

    switch (requestMethod) {

    case POST:
        return new HttpPost();
    case PUT:
        return new HttpPut();
    case PATCH:
        return new HttpPatch();
    case DELETE:
        return new HttpDelete();
    case HEAD:
        return new HttpHead();
    case TRACE:
        return new HttpTrace();
    case OPTIONS:
        return new HttpOptions();

    case GET:
    default:
        return new HttpGet();
    }
}

From source file:groovyx.net.http.RESTClient.java

/**
 * <p>Perform an OPTIONS request.</p>
 *
 * @param args named parameters - see/*from www. ja  v  a 2 s. c o  m*/
 *  {@link HTTPBuilder.RequestConfigDelegate#setPropertiesFromMap(Map)}
 * @return a {@link HttpResponseDecorator}, unless the default success
 *      handler is overridden.
 * @throws ClientProtocolException
 * @throws IOException
 * @throws URISyntaxException
 */
public Object options(Map<String, ?> args) throws ClientProtocolException, IOException, URISyntaxException {
    return this.doRequest(new RequestConfigDelegate(args, new HttpOptions(), null));
}

From source file:org.easyj.http.EasyRESTHttpClient.java

/**
 * Executes a OPTIONS HTTP request and returns the body response as {@code String}
 *
 * @param uri URI of the resource to be requested
 * @return The body response of the request as {@code String}
 *//* ww  w  . j  av  a2 s .  c  o  m*/
public EasyRESTHttpClient options(String uri) {
    method = new HttpOptions();
    return execute(uri);
}

From source file:org.easyj.http.EasyHttpClient.java

/**
 * Executes a OPTIONS HTTP request and returns the body response as {@code String}
 *
 * @param uri URI of the resource to be requested
 * @return The body response of the request as {@code String}
 *///from  w  w w .j  a  va2 s.  com
public EasyHttpClient options(String uri) {
    method = new HttpOptions();
    return execute(uri);
}

From source file:com.mirth.connect.client.core.ServerConnection.java

private HttpRequestBase createRequestBase(String method) {
    HttpRequestBase requestBase = null;//from   w w  w . j a  v a  2  s  .  co  m

    if (StringUtils.equalsIgnoreCase(HttpGet.METHOD_NAME, method)) {
        requestBase = new HttpGet();
    } else if (StringUtils.equalsIgnoreCase(HttpPost.METHOD_NAME, method)) {
        requestBase = new HttpPost();
    } else if (StringUtils.equalsIgnoreCase(HttpPut.METHOD_NAME, method)) {
        requestBase = new HttpPut();
    } else if (StringUtils.equalsIgnoreCase(HttpDelete.METHOD_NAME, method)) {
        requestBase = new HttpDelete();
    } else if (StringUtils.equalsIgnoreCase(HttpOptions.METHOD_NAME, method)) {
        requestBase = new HttpOptions();
    } else if (StringUtils.equalsIgnoreCase(HttpPatch.METHOD_NAME, method)) {
        requestBase = new HttpPatch();
    }

    requestBase.setConfig(requestConfig);
    return requestBase;
}

From source file:com.naryx.tagfusion.cfm.http.cfHttpConnection.java

private HttpUriRequest resolveMethod(String _method, boolean _multipart) throws cfmRunTimeException {
    String method = _method.toUpperCase();
    if (method.equals("GET")) {
        return new HttpGet();
    } else if (method.equals("POST")) {
        return new HttpPost();
    } else if (method.equals("HEAD")) {
        return new HttpHead();
    } else if (method.equals("TRACE")) {
        return new HttpTrace();
    } else if (method.equals("DELETE")) {
        return new HttpDelete();
    } else if (method.equals("OPTIONS")) {
        return new HttpOptions();
    } else if (method.equals("PUT")) {
        return new HttpPut();
    }/*from ww  w.j  a v  a 2 s. c om*/
    throw newRunTimeException("Unsupported METHOD value [" + method
            + "]. Valid METHOD values are GET, POST, HEAD, TRACE, DELETE, OPTIONS and PUT.");
}