Package org.apache.wicket.util.resource

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


  private MarkupResourceStream newMarkupResourceStream(final IResourceStreamLocator locator,
    final Class<?> cls, final String style, final String variation, final Locale locale,
    final String extension)
  {
    final String path = cls.getName().replace('.', '/');
    final IResourceStream resource = locator.locate(cls, path, style, variation, locale,
      extension, false);

    return new MarkupResourceStream(resource, null, null);
  }
View Full Code Here


        return header;
      }
      final Page page = container.getPage();
      final String pageClassName = (page != null) ? page.getClass().getName() : "unknown";
      final IResourceStream stream = markupStream.getResource();
      final String streamName = (stream != null) ? stream.toString() : "unknown";

      throw new MarkupException(
        "Mis-placed <wicket:head>. <wicket:head> must be outside of <wicket:panel>, <wicket:border>, and <wicket:extend>. Error occured while rendering page: " +
          pageClassName + " using markup stream: " + streamName);
    }
View Full Code Here

      {
        IPropertiesLoader loader = iter.next();
        String fullPath = path + loader.getFileExtension();

        // If not in the cache than try to load properties
        IResourceStream resourceStream = resourceSettings.getResourceStreamLocator()
          .locate(clazz, fullPath);
        if (resourceStream == null)
        {
          continue;
        }
View Full Code Here

    // hierarchy up to MarkupContainer to find the containers markup
    // resource.
    while (containerClass != MarkupContainer.class)
    {
      String path = containerClass.getName().replace('.', '/');
      IResourceStream resourceStream = locator.locate(container.getClass(), path, style,
        variation, locale, ext, false);

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

        container.getClass().getName() + ", but is a " + clazz.getName());
    }

    // 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

  public IResourceStream locate(Class<?> clazz, String path)
  {
    Key key = new Key(clazz.getName(), path, null, null, null);
    IResourceStreamReference resourceStreamReference = cache.get(key);

    final IResourceStream result;
    if (resourceStreamReference == null)
    {
      result = delegate.locate(clazz, path);

      updateCache(key, result);
View Full Code Here

    Locale locale, String extension, boolean strict)
  {
    Key key = new Key(scope.getName(), path, locale, style, variation);
    IResourceStreamReference resourceStreamReference = cache.get(key);

    final IResourceStream result;
    if (resourceStreamReference == null)
    {
      result = delegate.locate(scope, path, style, variation, locale, extension, strict);

      updateCache(key, result);
View Full Code Here

    final ResourceResponse resourceResponse = new ResourceResponse();

    if (resourceResponse.dataNeedsToBeWritten(attributes))
    {
      // get resource stream
      final IResourceStream resourceStream = getResourceStream();

      // bail out if resource stream could not be found
      if (resourceStream == null)
        return sendResourceError(resourceResponse, HttpServletResponse.SC_NOT_FOUND,
          "Unable to find resource");

      // set Content-Type (may be null)
      resourceResponse.setContentType(resourceStream.getContentType());

      // add Last-Modified header (to support HEAD requests and If-Modified-Since)
      final Time lastModified = resourceStream.lastModifiedTime();

      if (lastModified != null)
        resourceResponse.setLastModified(lastModified.toDate());

      try
      {
        // read resource data
        final byte[] bytes;

        try
        {
          bytes = IOUtils.toByteArray(resourceStream.getInputStream());
        }
        finally
        {
          resourceStream.close();
        }

        // send Content-Length header
        resourceResponse.setContentLength(bytes.length);
View Full Code Here

  private StreamInfo lookupStream(IResourceStreamLocator locator, Locale locale, String style,
    String variation)
  {
    String absolutePath = Packages.absolutePath(getScope(), getName());
    IResourceStream stream = locator.locate(getScope(), absolutePath, style, variation, locale,
      null, true);

    if (stream == null)
      return null;
View Full Code Here

  private List<IResourceStream> collectResourceStreams()
  {
    List<IResourceStream> ret = new ArrayList<IResourceStream>(providedResources.size());
    for (IReferenceHeaderItem curItem : providedResources)
    {
      IResourceStream stream = ((PackageResource)curItem.getReference().getResource()).getResourceStream();
      if (stream == null)
        return null;

      ret.add(stream);
    }
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.