Package org.apache.wicket.util.resource

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


    // load a template with a totally different name from this package using
    // this component's class loader
    final URL url = PageWithCustomLoading.class.getResource("CustomLoadedTemplate.html");
    if (url != null)
    {
      return new UrlResourceStream(url);
    }

    // no resource was not found
    return null;
  }
View Full Code Here


      {
        // try to load the resource from the web context
        url = getServletContext().getResource(location);
        if (url != null)
        {
          return new UrlResourceStream(url);
        }
      }
      catch (MalformedURLException e)
      {
        throw new WicketRuntimeException(e);
View Full Code Here

  @Test
  public void urlResource() throws Exception
  {
    IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);

    UrlResourceStream urs = new UrlResourceStream(new URL("file:///"));

    when(resourceStreamLocator.locate(String.class, "path")).thenReturn(urs);

    CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
      resourceStreamLocator);
View Full Code Here

      try
      {
        final URL url = servletContext.getResource(path + pathname);
        if (url != null)
        {
          return new UrlResourceStream(url);
        }
      }
      catch (Exception ex)
      {
        // ignore, file couldn't be found
View Full Code Here

      url = classLoader.getResource("META-INF/resources/" + path);
    }

    if (url != null)
    {
      return new UrlResourceStream(url);
    }
    return null;
  }
View Full Code Here

  public UrlResourceStream getReference()
  {
    try
    {
      UrlResourceStream resourceStream = new UrlResourceStream(new URL(url));
      restoreResourceStream(resourceStream);
      return resourceStream;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      protected IResourceStream getTemplateResource()
      {
        return new UrlResourceStream(getClass().getResource("testWithMarkup.html"));
      }

      @Override
      public boolean parseGeneratedMarkup()
      {
View Full Code Here

  public VelocityPage()
  {
    HashMap<String, String> values = new HashMap<String, String>();
    values.put("message", TEST_STRING);
    add(VelocityPanel.forTemplateResource("velocityPanel", new Model<HashMap<String, String>>(
      values), new UrlResourceStream(this.getClass().getResource("test.html"))));
  }
View Full Code Here

                // try to load the resource from the web context
                URL url = getServletContext().getResource(location);
               
                if (url != null)
                {
                    return new UrlResourceStream(url);
                }
            }
            catch (MalformedURLException e)
            {
                throw new WicketRuntimeException(e);
View Full Code Here

   *            the url
   * @return the imported contents
   */
  private final String importUrl(URL url)
  {
    return ResourceUtil.readString(new UrlResourceStream(url), getCharset());
  }
View Full Code Here

TOP

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

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.