Examples of HttpResponse


Examples of org.eclipse.ecf.internal.provider.rss.http.HttpResponse

      lastModified = new Date(feedFile.lastModified());
    } else {
      code = HttpResponse.NOT_FOUND;
    }
    // Create connect response and send it back
    final HttpResponse response = new HttpResponse(code, body);
    if (body != null && body.length() > 0) {
      response.setHeader("Connection", "close");
      response.setHeader("Content-Type", "text/xml");
      response.setHeader("Server", PRODUCT_NAME);
      response.setDateHeader("Last-Modified", lastModified);
    }
    response.writeToStream(socket.getOutputStream());
  }
View Full Code Here

Examples of org.eclipse.jetty.client.HttpResponse

    public void badMessage(int status, String reason)
    {
        HttpExchange exchange = getHttpExchange();
        if (exchange != null)
        {
            HttpResponse response = exchange.getResponse();
            response.status(status).reason(reason);
            failAndClose(new HttpResponseException("HTTP protocol violation: bad response on " + getHttpConnection(), response));
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.common.test.HttpResponse

        {
            client.addExtensions("x-webkit-deflate-frame");
            client.setProtocols("chat");
            client.connect();
            client.sendStandardRequest();
            HttpResponse response = client.expectUpgradeResponse();
            Assert.assertThat("Response",response.getExtensionsHeader(),containsString("x-webkit-deflate-frame"));

            // Generate text frame
            String msg = "this is an echo ... cho ... ho ... o";
            client.write(new TextFrame().setPayload(msg));
View Full Code Here

Examples of org.ektorp.http.HttpResponse

        // get the current replications in the replication db
        Map replicationIDs = getReplicationIDs(instance);
        boolean replicationComplete = false;
        while(!replicationComplete) {
            // need to check the active tasks
            HttpResponse response = instance.getConnection().get("/_active_tasks");
            ObjectMapper mapper = new ObjectMapper();
            try {
                JsonNode results = mapper.readTree(response.getContent());
                replicationComplete = true;
                for (JsonNode element : results) {
                    if ("Replication".equals(element.get("type").getTextValue())) {
                        String task = element.get("task").getTextValue();
                        String repID = task.substring(0, 4);
View Full Code Here

Examples of org.elasticsearch.test.rest.client.http.HttpResponse

                .build();
    }

    @Test
    public void testHealthCheck() throws Exception {
        HttpResponse response = httpClient().path("/").execute();
        assertThat(response.getStatusCode(), equalTo(RestStatus.OK.getStatus()));
    }
View Full Code Here

Examples of org.exoplatform.common.http.client.HTTPResponse

      addBasicAuthorization(this.realm, this.user, this.pass);
   }

   public HTTPResponse addNode(String name, byte[] data) throws IOException, ModuleException
   {
      HTTPResponse response = Put(workspacePath + name, data);
      response.getStatusCode();
      return response;
   }
View Full Code Here

Examples of org.expath.httpclient.HttpResponse

        } else {
            HttpConnection conn = null;
            try {
                conn = new ApacheHttpConnection(uri);
                final EXistResult firstResult = new EXistResult(context);
                final HttpResponse response = request.send(firstResult, conn, null);
                if(response.getStatus() == 401) {
                    conn.disconnect();
                    result = sendOnceWithAuth(uri, request, parser.getCredentials());
                } else {
                    result = firstResult;
                    registerConnectionWithContext(conn);
View Full Code Here

Examples of org.geotools.data.ows.HTTPResponse

                }
                return true;
            }
            InputStream inputStream = null;
            try {
                HTTPResponse response = issueRequest(request);
                String cacheControl = extractHeaderCacheControl(response);
                setMaxCacheAge(cacheControl);
                inputStream = response.getResponseStream();
                // simulate latency if testing
                if (testing) {
                    Random rand = new Random();
                    long delay = rand.nextInt(5000); // delay 1-5 secs
                    System.out.println("request delaying for: " + delay); //$NON-NLS-1$
View Full Code Here

Examples of org.geotools.data.ws.protocol.http.HTTPResponse

            public void writeBody(final OutputStream out) throws IOException {               
                WS_Protocol.encode(request, strategy, out);
            }
        };

        HTTPResponse httpResponse = http.issuePost(url, requestBodyCallback);
        InputStream responseStream = httpResponse.getResponseStream();
               
        return new WSResponse(responseStream);
    }
View Full Code Here

Examples of org.ice.http.HttpResponse

      request.setCharacterEncoding("UTF-8");
    } catch(Exception ex) {
      LogUtils.log(Level.WARNING, "Cannot set character encoding to UTF-8");
    }
    HttpRequest httpRequest = requestParser.parseRequest(new HttpRequest(request));
    HttpResponse httpResponse = new HttpResponse(response);
   
    Exception exception = null;
    try {
      boolean found = false;
      for(IRouter router: routers)  {
        IModule module = router.route(httpRequest);
        if (module != null)  {
          found = true;
          exception = dispatchModule(module, httpRequest, httpResponse, httpRequest.getTaskName());
          break;
        }
      }
      if (!found)
        throw new NotFoundException("No routers match for request: "+request.getRequestURL().toString());
    } catch (IceException ex)  {
      httpResponse.setException(ex);
      httpResponse.setStatus(ex.status);
      exception = ex;
    }
   
    if (Config.get("errorHandler") != null && exception != null)  {
      Class<? extends IErrorHandler> c = (Class<? extends IErrorHandler>) Config.get("errorHandler").getClass();
      try {
        IErrorHandler handler = (IErrorHandler) c.newInstance();
        handler.setException(exception);
        httpResponse.clearContent();
        dispatchModule(handler, httpRequest, httpResponse, "error");
      } catch (Exception ex)  {
        httpResponse.setStatus(500);
        httpResponse.setException(ex);
      }
    }
   
    httpResponse.sendResponse();
    httpResponse = null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.