Package org.apache.wicket.util.resource

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


        log.debug("Load markup: cacheKey=" + cacheKey);
      }

      // Who is going to provide the markup resource stream?
      // And ask the provider to locate the markup resource stream
      final IResourceStream resourceStream = getMarkupResourceStreamProvider(container).getMarkupResourceStream(
        container, containerClass);

      // Found markup?
      if (resourceStream != null)
      {
View Full Code Here


            .decode(request);
          // Set parameters from servlet request
          resource.setParameters(rp.getParameters());

          // Get resource stream
          IResourceStream stream = resource.getResourceStream();

          // Get last modified time from stream
          Time time = stream.lastModifiedTime();

          try
          {
            stream.close();
          }
          catch (IOException e)
          {
            // ignore
          }
View Full Code Here

    Class<?> containerClass = getClass();

    while (!(containerClass.equals(MarkupComponentBorder.class)))
    {
      String path = containerClass.getName().replace('.', '/');
      IResourceStream resourceStream = locator.locate(containerClass, path, style, locale,
        markupType);

      // Did we find it already?
      if (resourceStream != null)
      {
View Full Code Here

      String contentType = null;
      for (int i = 0; i < _specs.length; i++) {
        final Class<?> scope = _specs[i].getScope();
        final String fileName = _specs[i].getFile();

        final IResourceStream resourceStream = findResourceStream(scope, fileName);
        if (contentType != null) {
          if (resourceStream.getContentType() != null
              && !contentType.equalsIgnoreCase(resourceStream.getContentType())) {
            log.warn("content types of merged resources don't match: '" + resourceStream.getContentType()
                + "' and '" + contentType + "'");
          }
        } else {
          contentType = resourceStream.getContentType();
        }

        try {

          final Time lastModified = resourceStream.lastModifiedTime();
          if (max == null || lastModified != null && lastModified.after(max)) {
            max = lastModified;
          }
          if (i > 0) {
            writeFileSeparator(out);
          }
          // process content from single spec
          byte[] preprocessed = preProcess(_specs[i], StreamUtils.bytes(resourceStream.getInputStream()));
          writeContent(out, new ByteArrayInputStream(preprocessed));
          resourceStreams.add(resourceStream);
        } catch (final IOException e) {
          throw new WicketRuntimeException("failed to read from " + resourceStream, e);
        } catch (final ResourceStreamNotFoundException e) {
          throw new WicketRuntimeException("did not find resource", e);
        } finally {
          try {
            if (resourceStream != null) {
              resourceStream.close();
            }
          } catch (final IOException e) {
            log.warn("error while closing reader", e);
          }
        }
View Full Code Here

          + Strings.beforeLast(fileName, '.');
      // Iterator over all the combinations
      final ResourceNameIterator iter = new ResourceNameIterator(path, _style, _locale, Strings.afterLast(
          fileName, '.'));

      IResourceStream resourceStream = null;
      while (resourceStream == null && iter.hasNext()) {
        final String resourceName = iter.next();
        resourceStream = Application.get().getResourceSettings().getResourceStreamLocator()
            .locate(scope, resourceName, _style, _locale, null);
      }
View Full Code Here

        }
        return null;
    }
   
    private static IResourceStream resourceStreamFor(final Blob blob) {
        IResourceStream byteArrayResource = new AbstractResourceStream() {
           
            private static final long serialVersionUID = 1L;

            @Override
            public InputStream getInputStream() throws ResourceStreamNotFoundException {
View Full Code Here

        };
        return byteArrayResource;
    }

    private static IResourceStream resourceStreamFor(final Clob clob) {
        IResourceStream resourceStream = new StringResourceStream(clob.getChars(), clob.getMimeType().toString());
        return resourceStream;
    }
View Full Code Here

    if (Strings.isEmpty(fileName))
    {
      fileName = file.getName();
    }

    IResourceStream resourceStream = new FileResourceStream(
      new org.apache.wicket.util.file.File(file));
    getRequestCycle().scheduleRequestHandlerAfterCurrent(
      new ResourceStreamRequestHandler(resourceStream)
      {
        @Override
View Full Code Here

      .getResourceSettings()
      .getResourceStreamLocator();

    String absolutePath = Packages.absolutePath(getScope(), getName());

    IResourceStream stream = locator.locate(getScope(), absolutePath, style, variation, locale,
      null, false);

    if (stream == null)
      return new ResourceReference.UrlAttributes(null, null, null);

    return new ResourceReference.UrlAttributes(stream.getLocale(), stream.getStyle(), stream.getVariation());
  }
View Full Code Here

    String name = getMinifiedName();
    IResourceStreamLocator locator = Application.get()
        .getResourceSettings()
        .getResourceStreamLocator();
    String absolutePath = Packages.absolutePath(getScope(), name);
    IResourceStream stream = locator.locate(getScope(), absolutePath, getStyle(),
        getVariation(), getLocale(), null, true);

    minifiedName = stream != null ? name : NO_MINIFIED_NAME;
    MINIFIED_NAMES_CACHE.put(this, minifiedName);
    if (minifiedName == NO_MINIFIED_NAME && log.isDebugEnabled())
View Full Code Here

TOP

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

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.