Examples of HttpResponse


Examples of org.apache.http.HttpResponse

        public int fillBuffer(final ReadableByteChannel channel) throws IOException {
            return this.parser.fillBuffer(channel);
        }

        public HttpResponse parse() throws IOException, HttpException {
            HttpResponse message = this.parser.parse();
            if (message != null && headerlog.isDebugEnabled()) {
                headerlog.debug(id + " << " + message.getStatusLine().toString());
                Header[] headers = message.getAllHeaders();
                for (int i = 0; i < headers.length; i++) {
                    headerlog.debug(id + " << " + headers[i].toString());
                }
            }
            return message;
View Full Code Here

Examples of org.apache.mina.http.api.HttpResponse

    public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
      LOG.debug("encode {}", message.getClass().getCanonicalName());
        if (message instanceof HttpResponse) {
          LOG.debug("HttpResponse");
            HttpResponse msg = (HttpResponse) message;
            StringBuilder sb = new StringBuilder(msg.getStatus().line());

            for (Map.Entry<String, String> header : msg.getHeaders().entrySet()) {
                sb.append(header.getKey());
                sb.append(": ");
                sb.append(header.getValue());
                sb.append("\r\n");
            }
View Full Code Here

Examples of org.apache.openejb.server.httpd.HttpResponse

        if (listener == null) {
            throw new ServletException("RESTServiceContainer has not been set");
        }

        HttpRequest httpRequest = new ServletRequestAdapter(req, res, servletConfig.getServletContext());
        HttpResponse httpResponse = new ServletResponseAdapter(res);

        try {
            listener.onMessage(httpRequest, httpResponse);
        } catch (IOException e) {
            throw e;
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpResponse

* Test PNG handling
*/
public class PNGOptimizerTest extends BaseOptimizerTest {

  public void testRewriteInefficientPNG() throws Exception {
    HttpResponse resp =
        createResponse("org/apache/shindig/gadgets/rewrite/image/inefficient.png", "image/png");
    HttpResponse httpResponse = rewrite(resp);
    assertTrue(httpResponse.getContentLength() <= resp.getContentLength());
    assertEquals(httpResponse.getHeader("Content-Type"), "image/png");
  }
View Full Code Here

Examples of org.archive.wayback.util.http.HttpResponse

      OutputStream socketOut = socket.getOutputStream();
      InputStream socketIn = socket.getInputStream();
      socketOut.write(requestMessage.getBytes(true));
      socketOut.write(headers.getUTF8Bytes());
      socketOut.flush();
      HttpResponse response = HttpResponse.load(socketIn);
      String contentType = response.getHeaders().asMap().get("Content-Type");
      if(contentType == null) {
        contentType = "application/unknown";
      }
      String xferEncoding = response.getHeaders().asMap().get("Transfer-Encoding");
     
      if(xferEncoding != null) {
        if(xferEncoding.equals("chunked")) {
          socketIn = new ChunkedInputStream(socketIn);
        }
View Full Code Here

Examples of org.b3log.latke.urlfetch.HTTPResponse

            httpRequest.setRequestMethod(HTTPRequestMethod.POST);
            httpRequest.setPayload(broadcastRequest.toString().getBytes("UTF-8"));

            @SuppressWarnings("unchecked")
            final Future<HTTPResponse> future = (Future<HTTPResponse>) urlFetchService.fetchAsync(httpRequest);
            final HTTPResponse result = future.get();

            if (HttpServletResponse.SC_OK == result.getResponseCode()) {
                ret.put(Keys.STATUS_CODE, true);

                optionMgmtService.removeOption(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);

                LOGGER.info("Submits broadcast successfully");
View Full Code Here

Examples of org.browsermob.proxy.jetty.http.HttpResponse

    }

    /* ------------------------------------------------------------ */
    public void writeHeader(HttpMessage httpMessage) throws IOException
    {
        HttpResponse response=(HttpResponse)httpMessage;
        response.setState(HttpMessage.__MSG_SENDING);

        _ajpResponse.resetData();
        _ajpResponse.addByte(AJP13ResponsePacket.__SEND_HEADERS);
        _ajpResponse.addInt(response.getStatus());
        _ajpResponse.addString(response.getReason());

        int mark=_ajpResponse.getMark();
        _ajpResponse.addInt(0);
        int nh=0;
        Enumeration e1=response.getFieldNames();
        while (e1.hasMoreElements())
        {
            String h=(String)e1.nextElement();
            Enumeration e2=response.getFieldValues(h);
            while (e2.hasMoreElements())
            {
                _ajpResponse.addHeader(h);
                _ajpResponse.addString((String)e2.nextElement());
                nh++;
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.spi.HttpResponse

      logger.warn("Failed to parse request.", e);
      return;
    }
   
    HttpRequest request = new HttpRequest(req, headers, uriInfo, method);
    HttpResponse response = new HttpResponse(res);

    boolean localeInitializedByServlet = false;
    try
    {
      localeInitializedByServlet = initUserLocaleResolver(request);
      MethodReturn methodReturn = RestDispatcher.dispatch(request, response, false);
      if (!response.isCommitted())
      {
        HttpUtil.writeResponse(request, response, methodReturn);
      }
    }
    catch (RestFailure e)
    {
      response.sendException(e.getResponseCode(), e.getResponseMessage());
      logger.error(e.getMessage(), e);
    }
    catch (Exception e)
    {
      response.sendException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Server error processing request.");
      logger.error(e.getMessage(), e);
    }
    finally
    {
      if (localeInitializedByServlet)
View Full Code Here

Examples of org.cspoker.common.api.shared.http.HTTPResponse

   
    HTTPRequest request =  new HTTPRequest(queue);
   
    marschaller.marshal(request, output);
   
    HTTPResponse response = new HTTPResponse();
    response.addActionResult(new ActionPerformedEvent<Void>(action1,null));
    response.addActionResult(new ActionPerformedEvent<Void>(action2,null));
   
    Queue<ServerEvent> equeue = new LinkedList<ServerEvent>();
    equeue.add(new HoldemTableTreeEventWrapper(tid, new BetEvent(new PlayerId(5),25)));
    response.addEvents(equeue);
   
    marschaller.marshal(response, output);

    output = new File(baseDir,"http.xml");
   
View Full Code Here

Examples of org.cybergarage.http.HTTPResponse

    }

    HTTPRequest httpReq = new HTTPRequest();
    httpReq.setMethod(HTTP.GET);
    httpReq.setURI(uri);
    HTTPResponse httpRes = httpReq.post(host, port);
    if (httpRes.isSuccessful() == false)
      throw new ParserException("HTTP comunication failed: no answer from peer." +
          "Unable to retrive resoure -> "+locationURL.toString());
    String content = new String(httpRes.getContent());
    ByteArrayInputStream strBuf = new ByteArrayInputStream(content.getBytes());
    return parse(strBuf);
  }
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.