Package org.apache.wicket.util.resource

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


    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


          // Set parameters from servlet request
          resource.setParameters(webRequest.getParameterMap());

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

   * @return Gets the resource to attach to the component.
   */
  // this method is deliberately non-final. some users depend on it
  public IResourceStream getResourceStream()
  {
    return new IResourceStream()
    {
      private static final long serialVersionUID = 1L;

      private Locale locale = DynamicWebResource.this.getLocale();

View Full Code Here

   * @return Gets the resource for the component.
   */
  public IResourceStream getResourceStream()
  {
    // Locate resource
    IResourceStream resourceStream = Application.get().getResourceSettings()
        .getResourceStreamLocator().locate(getScope(), absolutePath, style, locale, null);

    // Check that resource was found
    if (resourceStream == null)
    {
      String msg = "Unable to find package resource [path = " + absolutePath + ", style = "
          + style + ", locale = " + locale + "]";
      log.warn(msg);
      if (RequestCycle.get() instanceof WebRequestCycle)
      {
        throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, msg);
      }
      else
      {
        throw new AbortException();
      }
    }
    this.locale = resourceStream.getLocale();
    return resourceStream;
  }
View Full Code Here

    {
      // Get request cycle
      final RequestCycle cycle = RequestCycle.get();

      // Fetch resource from subclass if necessary
      IResourceStream resourceStream = init();

      // Get servlet response to use when responding with resource
      final Response response = cycle.getResponse();

      // FIXME WICKET-385 Move HTTP caching features out of org.apache.wicket.Resource
      if (isCacheable())
      {
        response.setLastModifiedTime(resourceStream.lastModifiedTime());
      }
      else
      {
        response.setLastModifiedTime(Time.valueOf(-1));
      }
View Full Code Here

   *
   * @return The resource stream for the current request
   */
  private final IResourceStream init()
  {
    IResourceStream stream = getResourceStream();

    if (stream == null)
    {
      throw new WicketRuntimeException("Could not get resource stream");
    }
View Full Code Here

        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

        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

   *            throw an AbortException when resource does not exist
   */
  public IResourceStream getResourceStream(boolean failOnError)
  {
    // Locate resource
    IResourceStream resourceStream = Application.get()
      .getResourceSettings()
      .getResourceStreamLocator()
      .locate(getScope(), absolutePath, style, locale, null);

    // Check that resource was found
    if (resourceStream == null)
    {
      if (!failOnError)
      {
        // Do not abort the request, as we are not yet serving the resource
        return null;
      }

      String msg = "Unable to find package resource [path = " + absolutePath + ", style = " +
        style + ", locale = " + locale + "]";
      log.warn(msg);
      if (RequestCycle.get() instanceof WebRequestCycle)
      {
        throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, msg);
      }
      else
      {
        throw new AbortException();
      }
    }

    locale = resourceStream.getLocale();

    if (resourceStream != null)
    {
      lastModifiedTime = resourceStream.lastModifiedTime();
      lastModifiedTimeUpdate = System.currentTimeMillis();
    }

    return resourceStream;
  }
View Full Code Here

          // Set parameters from servlet request
          resource.setParameters(request.getParameterMap());

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

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.