Examples of StringResponse


Examples of com.facebook.presto.jdbc.internal.airlift.http.client.StringResponseHandler.StringResponse

        try {
            String contentType = response.getHeader(CONTENT_TYPE);

            if (contentType != null) {
                MediaType mediaType = MediaType.parse(contentType);
                return new StringResponse(
                        response.getStatusCode(),
                        response.getStatusMessage(),
                        response.getHeaders(),
                        new String(ByteStreams.toByteArray(response.getInputStream()), mediaType.charset().or(Charsets.UTF_8)));
            }

            return new StringResponse(
                    response.getStatusCode(),
                    response.getStatusMessage(),
                    response.getHeaders(),
                    new String(ByteStreams.toByteArray(response.getInputStream()), Charsets.UTF_8));
        }
View Full Code Here

Examples of com.proofpoint.http.client.StringResponseHandler.StringResponse

            throws Exception
    {
        createAndStartServer();

        try (JettyHttpClient httpClient = new JettyHttpClient()) {
            StringResponse response = httpClient.execute(
                    preparePut()
                            .setUri(httpServerInfo.getHttpUri())
                            .setHeader("Content-Encoding", "gzip")
                            .setBodyGenerator(createStaticBodyGenerator(new byte[] {
                                    31, -117, 8, 0, -123, -120, -97, 83, 0, 3, 75, -83,
                                    40, 72, 77, 46, 73, 77, 1, 0, -60, -72, 96, 80, 8, 0, 0, 0
                            }))
                            .build(),
                    createStringResponseHandler());

            assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
            assertEquals(response.getBody(), "expected");
        }
    }
View Full Code Here

Examples of io.airlift.http.client.StringResponseHandler.StringResponse

        String expected = "{\"columns\":[" +
                "{\"name\":\"foo\",\"type\":\"bigint\"}," +
                "{\"name\":\"bar\",\"type\":\"varchar\"}]," +
                "\"data\":[[123,\"abc\"]]}\n";

        StringResponse response = executeQuery("SELECT 123 foo, 'abc' bar FROM dual");
        assertEquals(response.getStatusCode(), HttpStatus.OK.code());
        assertEquals(response.getHeader(HttpHeaders.CONTENT_TYPE), "application/json");
        assertEquals(response.getBody(), expected);
    }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

    // Make sure it is not cached by a client
    response.disableCaching();

    try
    {
      final StringResponse bodyResponse = new StringResponse();
      responseObject.writeTo(bodyResponse, encoding);
      CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
      response.write(filteredResponse);
    }
    finally
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

        attributes = new Attributes(cycle.getRequest(), cycle.getResponse());
      }
      else
      {
        // use empty request and response in case of non-http thread. WICKET-5532
        attributes = new Attributes(new MockWebRequest(Url.parse("")), new StringResponse());
      }
      byte[] processedBytes = processResponse(attributes, bytes);
      return new ByteArrayInputStream(processedBytes);
    }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
        final StringResponse response = new StringResponse();
        getRequestCycle().setResponse(response);

        // Render all header sections of all components on the page
        AbstractHeaderRenderStrategy.get().renderHeader(header, null, getPage());
        response.close();

        if (response.getBuffer().length() > 0)
        {
          // @TODO it is not yet working properly. JDo to fix it
          log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
          log.error("You probably forgot to add a <body> or <head> tag to your markup since no Header Container was \n" +
            "found but components were found which want to write to the <head> section.\n" +
            response.getBuffer());
          log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        }
      }
      catch (Exception e)
      {
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.