org.eclipse.jetty.io.ByteArrayBuffer Java Examples
The following examples show how to use
org.eclipse.jetty.io.ByteArrayBuffer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestfulTestsUtil.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 6 votes |
/** * Send request. * @param url the url * @param method the method name * @param content the content * @return the http status code * @throws Exception exception when error */ public static int sentRequest(final String url, final String method, final String content) throws Exception { HttpClient httpClient = new HttpClient(); try { httpClient.start(); ContentExchange contentExchange = new ContentExchange(); contentExchange.setMethod(method); contentExchange.setRequestContentType(MediaType.APPLICATION_JSON); contentExchange.setRequestContent(new ByteArrayBuffer(content.getBytes("UTF-8"))); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); contentExchange.setURL(url); httpClient.send(contentExchange); contentExchange.waitForDone(); return contentExchange.getResponseStatus(); } finally { httpClient.stop(); } }
Example #2
Source File: RestfulServerTest.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 6 votes |
private static ContentExchange sentRequest(final String content) throws Exception { HttpClient httpClient = new HttpClient(); try { httpClient.start(); ContentExchange result = new ContentExchange(); result.setMethod("POST"); result.setRequestContentType(MediaType.APPLICATION_JSON); result.setRequestContent(new ByteArrayBuffer(content.getBytes("UTF-8"))); httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); result.setURL(URL); httpClient.send(result); result.waitForDone(); return result; } finally { httpClient.stop(); } }
Example #3
Source File: HttpFields.java From IoTgo_Android_App with MIT License | 5 votes |
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void putDateField(Buffer name, long date) { String d=formatDate(date); Buffer v = new ByteArrayBuffer(d); put(name, v); }
Example #4
Source File: HttpFields.java From IoTgo_Android_App with MIT License | 5 votes |
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void addDateField(String name, long date) { String d=formatDate(date); Buffer n = HttpHeaders.CACHE.lookup(name); Buffer v = new ByteArrayBuffer(d); add(n, v); }
Example #5
Source File: HttpFields.java From IoTgo_Android_App with MIT License | 5 votes |
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void putDateField(Buffer name, long date) { String d=formatDate(date); Buffer v = new ByteArrayBuffer(d); put(name, v); }
Example #6
Source File: HttpFields.java From IoTgo_Android_App with MIT License | 5 votes |
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void addDateField(String name, long date) { String d=formatDate(date); Buffer n = HttpHeaders.CACHE.lookup(name); Buffer v = new ByteArrayBuffer(d); add(n, v); }