use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getProgramSchedules.
public List<ScheduleDetail> getProgramSchedules(String namespace, String app, String workflow) throws NotFoundException {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/workflows/%s/schedules", getNamespacePath(namespace), app, workflow);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
try {
workflowHttpHandler.getWorkflowSchedules(request, responder, namespace, app, workflow, null);
} catch (BadRequestException e) {
// cannot happen
throw Throwables.propagate(e);
}
List<ScheduleDetail> schedules = responder.decodeResponseContent(SCHEDULE_DETAILS_TYPE, GSON);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Getting workflow schedules failed");
return schedules;
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getWorkerInstances.
public Instances getWorkerInstances(String namespaceId, String appId, String workerId) throws Exception {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/worker/%s/instances", getNamespacePath(namespaceId), appId, workerId);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
programLifecycleHttpHandler.getWorkerInstances(request, responder, namespaceId, appId, workerId);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Get worker instances failed");
return responder.decodeResponseContent(Instances.class);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project load-balancer by RestComm.
the class Client method createRequest.
private HttpRequest createRequest(String packetType, Packet packet) {
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/");
ChannelBuffer buf = ChannelBuffers.copiedBuffer(getStringFromJson(packetType, packet), Charset.forName("UTF-8"));
request.setHeader(HttpHeaders.Names.CONTENT_TYPE, APPLICATION_JSON);
request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, buf.readableBytes());
request.setContent(buf);
return request;
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project load-balancer by RestComm.
the class Server method createRequest.
private HttpRequest createRequest(String command) {
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/");
ChannelBuffer buf = ChannelBuffers.copiedBuffer(getStringFromJson(command), Charset.forName("UTF-8"));
request.setHeader(HttpHeaders.Names.CONTENT_TYPE, APPLICATION_JSON);
request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, buf.readableBytes());
request.setContent(buf);
return request;
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project traccar by tananaev.
the class ProtocolTest method request.
protected DefaultHttpRequest request(HttpMethod method, String url, ChannelBuffer data) {
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, method, url);
request.setContent(data);
return request;
}
Aggregations