Package org.apache.wicket.util.resource

Examples of org.apache.wicket.util.resource.WebExternalResourceStream


      public IRequestTarget decode(RequestParameters requestParameters)
      {
        String path = "/staticpages/" + getURI(requestParameters);
        IResourceStream xslStream = new PackageResourceStream(Application.class,
            "layout.xsl");
        IResourceStream docStream = new WebExternalResourceStream(path);
        return new ResourceStreamRequestTarget(new XSLTResourceStream(xslStream, docStream));
      }
    });
  }
View Full Code Here


  /**
   * @see org.apache.wicket.Resource#getResourceStream()
   */
  public IResourceStream getResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
View Full Code Here

   * @throws Exception
   */
  // FIXME WebExternalResourceStream does not implement length()
  public void testWebExternalResource() throws Exception
  {
    WebExternalResourceStream resource = new WebExternalResourceStream("/index.html");
    ResourceStreamRequestTarget rt = new ResourceStreamRequestTarget(resource);
    WebRequestCycle cycle = tester.createRequestCycle();
    cycle.setRequestTarget(rt);
    tester.processRequestCycle(cycle);
    assertTrue(tester.getContentTypeFromResponseHeader().startsWith("text/html"));
View Full Code Here

   * @param uri
   *            the relative url of the external resource
   */
  public WebExternalResourceRequestTarget(String uri)
  {
    super(new WebExternalResourceStream(uri));
    this.uri = uri;
  }
View Full Code Here

   * @param uri
   *            the relative url of the external resource
   */
  public WebExternalResourceRequestTarget(String uri)
  {
    super(new WebExternalResourceStream(uri));
    this.uri = uri;
    setContentDisposition(ContentDisposition.INLINE);
  }
View Full Code Here

   * @see org.apache.wicket.Resource#getResourceStream()
   */
  @Override
  public IResourceStream getResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
View Full Code Here

      public IRequestTarget decode(RequestParameters requestParameters)
      {
        String path = "/staticpages/" + getURI(requestParameters);
        IResourceStream xslStream = new PackageResourceStream(Application.class,
            "layout.xsl");
        IResourceStream docStream = new WebExternalResourceStream(path);
        return new ResourceStreamRequestTarget(new XSLTResourceStream(xslStream, docStream));
      }
    });

    // All requests to bookmarkable page "Page" will be captured, and the
View Full Code Here

   * @param uri
   *            the relative url of the external resource
   */
  public WebExternalResourceRequestHandler(String uri)
  {
    super(new WebExternalResourceStream(uri));
    this.uri = uri;
    setContentDisposition(ContentDisposition.INLINE);
  }
View Full Code Here

   * @throws Exception
   */
  // FIXME WebExternalResourceStream does not implement length()
  public void testWebExternalResource() throws Exception
  {
    WebExternalResourceStream resource = new WebExternalResourceStream("/index.html");
    ResourceStreamRequestHandler rt = new ResourceStreamRequestHandler(resource);
    tester.processRequest(rt);
    assertTrue(tester.getContentTypeFromResponseHeader().startsWith("text/html"));
    tester.assertContains("<h1>Hello, World!</h1>");
  }
View Full Code Here

  {
    final ResourceResponse resourceResponse = new ResourceResponse();

    if (resourceResponse.dataNeedsToBeWritten(attributes))
    {
      final WebExternalResourceStream webExternalResourceStream = new WebExternalResourceStream(
        path);

      resourceResponse.setContentType(webExternalResourceStream.getContentType());
      resourceResponse.setLastModified(webExternalResourceStream.lastModifiedTime());
      resourceResponse.setFileName(path);
      resourceResponse.setWriteCallback(new WriteCallback()
      {
        @Override
        public void writeData(final Attributes attributes)
        {
          InputStream inputStream = null;
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try
          {
            inputStream = webExternalResourceStream.getInputStream();
            Streams.copy(inputStream, baos);
            attributes.getResponse().write(baos.toByteArray());
          }
          catch (ResourceStreamNotFoundException rsnfx)
          {
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.resource.WebExternalResourceStream

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.