Package org.apache.wicket.response

Examples of org.apache.wicket.response.ByteArrayResponse


    InputStream is = null;
    BufferedImage originalImage = null;
    try
    {
      // read original image
      ByteArrayResponse byteResponse = new ByteArrayResponse();
      Attributes dispatchAttributes = new Attributes(attributes.getRequest(), byteResponse, attributes.getParameters());
      unscaledImageResource.respond(dispatchAttributes);
      is = new ByteArrayInputStream(byteResponse.getBytes());
      originalImage = ImageIO.read(is);
      if (originalImage == null)
      {
        throw new IOException("Unable to read unscaled image");
      }
View Full Code Here


          UrlAttributes urlAttributes = reference.getUrlAttributes();
          assertEquals(locale, urlAttributes.getLocale());
          assertEquals(style, urlAttributes.getStyle());
          assertEquals(variation, urlAttributes.getVariation());

          ByteArrayResponse byteResponse = new ByteArrayResponse();
          Attributes mockAttributes = new Attributes(tester.getRequestCycle()
            .getRequest(), byteResponse);
          reference.getResource().respond(mockAttributes);
          String fileContent = new String(byteResponse.getBytes());
          if (locale != null)
          {
            assertTrue(fileContent.contains(locale.getLanguage()));
            if (locale.getCountry() != null)
            {
View Full Code Here

        for (String variation : variations)
        {
          ResourceReference reference = new PackageResourceReference(scope,
            "resource.txt", locale, style, variation);

          ByteArrayResponse byteResponse = new ByteArrayResponse();
          Attributes mockAttributes = new Attributes(tester.getRequestCycle()
            .getRequest(), byteResponse);
          reference.getResource().respond(mockAttributes);
          String fileContent = new String(byteResponse.getBytes());
          if (locale != null)
          {
            assertTrue(fileContent.contains(locale.getLanguage()));
            if (locale.getCountry() != null)
            {
View Full Code Here

public class MinifiedAwareResourceReferenceTest extends WicketTestCase
{

  private String renderResource(ResourceReference reference)
  {
    ByteArrayResponse byteResponse = new ByteArrayResponse();
    Attributes mockAttributes = new Attributes(tester.getRequestCycle().getRequest(),
      byteResponse);
    reference.getResource().respond(mockAttributes);
    return new String(byteResponse.getBytes());
  }
View Full Code Here

          UrlAttributes urlAttributes = reference.getUrlAttributes();
          assertEquals(locale, urlAttributes.getLocale());
          assertEquals(style, urlAttributes.getStyle());
          assertEquals(variation, urlAttributes.getVariation());

          ByteArrayResponse byteResponse = new ByteArrayResponse();
          Attributes mockAttributes = new Attributes(tester.getRequestCycle()
            .getRequest(), byteResponse);
          reference.getResource().respond(mockAttributes);
          String fileContent = new String(byteResponse.getBytes());
          if (locale != null)
          {
            assertTrue(fileContent.contains(locale.getLanguage()));
            if (locale.getCountry() != null)
            {
View Full Code Here

        for (String variation : variations)
        {
          ResourceReference reference = new PackageResourceReference(scope,
            "resource.txt", locale, style, variation);

          ByteArrayResponse byteResponse = new ByteArrayResponse();
          Attributes mockAttributes = new Attributes(tester.getRequestCycle()
            .getRequest(), byteResponse);
          reference.getResource().respond(mockAttributes);
          String fileContent = new String(byteResponse.getBytes());
          if (locale != null)
          {
            assertTrue(fileContent.contains(locale.getLanguage()));
            if (locale.getCountry() != null)
            {
View Full Code Here

    InputStream is = null;
    BufferedImage originalImage = null;
    try
    {
      // read original image
      ByteArrayResponse byteResponse = new ByteArrayResponse();
      Attributes dispatchAttributes = new Attributes(attributes.getRequest(), byteResponse);
      unscaledImageResource.respond(dispatchAttributes);
      is = new ByteArrayInputStream(byteResponse.getBytes());
      originalImage = ImageIO.read(is);
      if (originalImage == null)
      {
        throw new IOException("Unable to read unscaled image");
      }
View Full Code Here

      public void writeData(Attributes attributes)
      {

      }
    };
    ByteArrayResponse response = new ByteArrayResponse();
    Attributes attributes = new Attributes(new MockWebRequest(new Url()), response);
    byte[] srcData = new byte[5000];
    for (int i = 0; i < srcData.length; i++)
    {
      srcData[i] = (byte)i;
    }
    InputStream in = new ByteArrayInputStream(srcData);
    callback.writeStream(attributes, in);
    assertTrue("Content not equal", Arrays.equals(response.getBytes(), srcData));
  }
View Full Code Here

public class MinifiedAwareResourceReferenceTest extends WicketTestCase
{

  private String renderResource(ResourceReference reference)
  {
    ByteArrayResponse byteResponse = new ByteArrayResponse();
    Attributes mockAttributes = new Attributes(tester.getRequestCycle().getRequest(),
      byteResponse);
    reference.getResource().respond(mockAttributes);
    return new String(byteResponse.getBytes());
  }
View Full Code Here

      public void writeData(Attributes attributes)
      {

      }
    };
    ByteArrayResponse response = new ByteArrayResponse();
    Attributes attributes = new Attributes(new MockWebRequest(new Url()), response);
    byte[] srcData = new byte[5000];
    for (int i = 0; i < srcData.length; i++)
    {
      srcData[i] = (byte)i;
    }
    InputStream in = new ByteArrayInputStream(srcData);
    callback.writeStream(attributes, in);
    assertTrue("Content not equal", Arrays.equals(response.getBytes(), srcData));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.response.ByteArrayResponse

Copyright © 2018 www.massapicom. 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.