Package org.apache.wicket

Examples of org.apache.wicket.Resource


   */
  protected void onComponentTag(final ComponentTag tag)
  {
    checkComponentTag(tag, "img");
    super.onComponentTag(tag);
    final Resource resource = getImageResource();
    if (resource != null)
    {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
View Full Code Here


        if (application.getSharedResources().get(Application.class, imageReferenceName,
          locale, style, true) == null)
        {
          // Resource not available yet, so create it with factory and
          // share via Application
          final Resource imageResource = getResourceFactory(application, factoryName).newResource(
            specification, locale, style);
          application.getSharedResources().add(Application.class, imageReferenceName,
            locale, style, imageResource);
        }
View Full Code Here

        if (application.getSharedResources().get(Application.class, imageReferenceName,
          locale, style, true) == null)
        {
          // Resource not available yet, so create it with factory and
          // share via Application
          final Resource imageResource = getResourceFactory(application, factoryName).newResource(
            specification, locale, style);
          application.getSharedResources().add(Application.class, imageReferenceName,
            locale, style, imageResource);
        }
View Full Code Here

  @Override
  protected void onComponentTag(final ComponentTag tag)
  {
    checkComponentTag(tag, "img");
    super.onComponentTag(tag);
    final Resource resource = getImageResource();
    if (resource != null)
    {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
View Full Code Here

    if (pathInfo.startsWith(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX))
    {

      final String resourceReferenceKey = pathInfo.substring(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX.length());

      Resource resource = null;

      boolean externalCall = !Application.exists();
      try
      {
        // if called externally (i.e. WicketServlet) we need to set the thread local here
        // AND clean it up at the end of the request
        if (externalCall)
        {
          Application.set(webApplication);
        }

        // Try to find shared resource
        resource = webApplication.getSharedResources().get(resourceReferenceKey);

        // If resource found and it is cacheable
        if ((resource != null) && resource.isCacheable())
        {

          final WebRequest request = webApplication.newWebRequest(servletRequest);
          // make the session available.
          Session.findOrCreate(request, new WebResponse());


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

          return time != null ? time.getMilliseconds() : -1;
        }
      }
      catch (AbortException e)
      {
        return -1;
      }
      finally
      {
        if (resource != null)
        {
          resource.setParameters(null);
        }
        if (externalCall)
        {
          // Clean up thread local application if this was an external call
          // (if not, doFilter will clean it up)
View Full Code Here

  protected final void onComponentTag(final ComponentTag tag)
  {
    checkComponentTag(tag, "input");
    checkComponentTagAttribute(tag, "type", "image");

    final Resource resource = getImageResource();
    if (resource != null)
    {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
View Full Code Here

      final String resourceReferenceKey = pathInfo
          .substring(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX.length());

      // Try to find shared resource
      Resource resource = webApplication.getSharedResources().get(resourceReferenceKey);

      // If resource found and it is cacheable
      if ((resource != null) && resource.isCacheable())
      {
        try
        {
          Application.set(webApplication);

          final WebRequest webRequest = webApplication.newWebRequest(request);

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

          return time != null ? time.getMilliseconds() : -1;
        }
        catch (AbortException e)
        {
          return -1;
        }
        finally
        {
          resource.setParameters(null);
          Application.unset();
        }
      }
    }
    return -1;
View Full Code Here

        if (application.getSharedResources().get(Application.class, imageReferenceName,
            locale, style, true) == null)
        {
          // Resource not available yet, so create it with factory and
          // share via Application
          final Resource imageResource = getResourceFactory(application, factoryName)
              .newResource(specification, locale, style);
          application.getSharedResources().add(Application.class, imageReferenceName,
              locale, style, imageResource);
        }
View Full Code Here

   */
  protected void onComponentTag(final ComponentTag tag)
  {
    checkComponentTag(tag, "img");
    super.onComponentTag(tag);
    final Resource resource = getImageResource();
    if (resource != null)
    {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
View Full Code Here

    if (pathInfo.startsWith(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX))
    {

      final String resourceReferenceKey = pathInfo.substring(WebRequestCodingStrategy.RESOURCES_PATH_PREFIX.length());

      Resource resource = null;

      boolean externalCall = !Application.exists();
      try
      {
        // if called externally (i.e. WicketServlet) we need to set the thread local here
        // AND clean it up at the end of the request
        if (externalCall)
        {
          Application.set(webApplication);
        }

        // Try to find shared resource
        resource = webApplication.getSharedResources().get(resourceReferenceKey);

        // If resource found and it is cacheable
        if ((resource != null) && resource.isCacheable())
        {
          // first check the char encoding for getting the parameters
          checkCharacterEncoding(servletRequest);

          final WebRequest request = webApplication.newWebRequest(servletRequest);
          // make the session available.
          Session.findOrCreate(request, new WebResponse());


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

          return time != null ? time.getMilliseconds() : -1;
        }
      }
      catch (AbortException e)
      {
        return -1;
      }
      finally
      {
        if (resource != null)
        {
          resource.setParameters(null);
        }
        if (externalCall)
        {
          // Clean up thread local application if this was an external call
          // (if not, doFilter will clean it up)
View Full Code Here

TOP

Related Classes of org.apache.wicket.Resource

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.