Package org.apache.wicket.request.resource

Examples of org.apache.wicket.request.resource.IResource


        String token = tokens.nextToken();

        // on the last component of the resource path
        if (tokens.hasMoreTokens() == false && Strings.isEmpty(token) == false)
        {
          final IResource resource = reference.getResource();

          // is resource supposed to be cached?
          if (resource instanceof IStaticCacheableResource)
          {
            final IStaticCacheableResource cacheable = (IStaticCacheableResource)resource;
View Full Code Here


   * @throws Exception
   */
  @Test
  public void urlForResourceReferenceWithNonStaticResource() throws Exception
  {
    final IResource resource = mock(IResource.class);
    ResourceReference reference = new ResourceReference("dummy")
    {
      @Override
      public IResource getResource()
      {
View Full Code Here

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

        if (application.getResourceReferenceRegistry().getResourceReference(
          Application.class, imageReferenceName, locale, style, variation, true, false) == null)
        {
          // Resource not available yet, so create it with factory and
          // share via Application
          final IResource imageResource = getResourceFactory(application, factoryName).newResource(
            specification, locale, style, variation);

          ResourceReference ref = new SimpleStaticResourceReference(Application.class,
            imageReferenceName, locale, style, variation, imageResource);
View Full Code Here

        String token = tokens.nextToken();

        // on the last component of the resource path
        if (tokens.hasMoreTokens() == false && Strings.isEmpty(token) == false)
        {
          final IResource resource = reference.getResource();

          // apply caching if required
          if (resource instanceof IStaticCacheableResource)
          {
            // add caching related information to filename + query parameters
View Full Code Here

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

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

    final String filename = segments.get(lastSegmentAt);

    if (Strings.isEmpty(filename) == false)
    {
      // TODO is calling getResource() a potential performance bottleneck?
      final IResource resource = resourceReference.getResource();

      if (resource instanceof IStaticCacheableResource)
      {
        final IStaticCacheableResource cacheable = (IStaticCacheableResource)resource;
        final ResourceUrl cacheUrl = new ResourceUrl(filename, parameters);
View Full Code Here

      String renderedUrl = getUrlRenderer().renderUrl(url);
      if (handler instanceof ResourceReferenceRequestHandler)
      {
        ResourceReferenceRequestHandler rrrh = (ResourceReferenceRequestHandler) handler;
        IResource resource = rrrh.getResource();
        if (!(resource instanceof IStaticCacheableResource) || shouldEncodeStaticResource)
        {
          renderedUrl = getOriginalResponse().encodeURL(renderedUrl);
        }
      }
      else if (handler instanceof ResourceRequestHandler)
      {
        ResourceRequestHandler rrh = (ResourceRequestHandler) handler;
        IResource resource = rrh.getResource();
        if (!(resource instanceof IStaticCacheableResource) || shouldEncodeStaticResource)
        {
          renderedUrl = getOriginalResponse().encodeURL(renderedUrl);
        }
      }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void urlForResourceReferenceWithNonStaticResource() throws Exception
  {
    final IResource resource = mock(IResource.class);
    ResourceReference reference = new ResourceReference("dummy")
    {
      @Override
      public IResource getResource()
      {
View Full Code Here

    assertEquals(TEST_STRING.length(), tester.getContentLengthFromResponseHeader());
  }

  private void bindToApplicationAsResourceAndRequestIt(IResourceStream iResourceStream)
  {
    IResource resource = new ResourceStreamResource(iResourceStream);
    tester.getApplication().getSharedResources().add("resource", resource);
    tester.getRequest().setUrl(
      tester.getRequestCycle().mapUrlFor(
        tester.getApplication()
          .getSharedResources()
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.resource.IResource

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.