Package org.apache.wicket.core.util.resource

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


  }

  @Override
  public IResourceStream getCacheableResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
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

   * @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

  }

  @Override
  public IResourceStream getCacheableResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
View Full Code Here

  @Override
  protected ResourceResponse newResourceResponse(final Attributes attributes)
  {
    final ResourceResponse resourceResponse = new ResourceResponse();

    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) throws IOException
      {
        try
        {
          InputStream inputStream = webExternalResourceStream.getInputStream();
          try
          {
            Streams.copy(inputStream, attributes.getResponse().getOutputStream());
          }
          finally {
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

  }

  @Override
  public IResourceStream getCacheableResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
View Full Code Here

  @Override
  protected ResourceResponse newResourceResponse(final Attributes attributes)
  {
    final ResourceResponse resourceResponse = new ResourceResponse();

    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) throws IOException
      {
        try
        {
          InputStream inputStream = webExternalResourceStream.getInputStream();
          try
          {
            Streams.copy(inputStream, attributes.getResponse().getOutputStream());
          }
          finally {
View Full Code Here

  }

  @Override
  public IResourceStream getCacheableResourceStream()
  {
    return new WebExternalResourceStream(path);
  }
View Full Code Here

  @Override
  protected ResourceResponse newResourceResponse(final Attributes attributes)
  {
    final ResourceResponse resourceResponse = new ResourceResponse();

    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.core.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.