/** * Gets the file system resource to be used for the resource reference * * @return the file system resource to be used for the resource reference */ protected FileSystemResource getFileSystemResource() { if (path == null) { throw new WicketRuntimeException( "Please override #getResource() and provide a path if using a constructor which doesn't take one as argument."); } return new FileSystemResource(path); }
/** * Gets the file system resource to be used for the resource reference * * @return the file system resource to be used for the resource reference */ protected FileSystemResource getFileSystemResource() { if (path == null) { throw new WicketRuntimeException( "Please override #getResource() and provide a path if using a constructor which doesn't take one as argument."); } return new FileSystemResource(path); }
public IResource toResource() { try { if(source == IImage.URL_IMAGE) { return new ResourceStreamResource(new UrlResourceStream(new URL(getID()))); } else if (source == IImage.FILE_IMAGE) { return new FileSystemResource( Paths.get(FileUtil.getURI(getID()))); } else { return new ByteArrayResource(getMIMEType(), data); } } catch (MalformedURLException e) { throw new WicketRuntimeException("Can't transform to resource", e); } }