当前位置: 首页>>代码示例>>Java>>正文


Java ResourceStreamNotFoundException类代码示例

本文整理汇总了Java中org.apache.wicket.util.resource.ResourceStreamNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java ResourceStreamNotFoundException类的具体用法?Java ResourceStreamNotFoundException怎么用?Java ResourceStreamNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceStreamNotFoundException类属于org.apache.wicket.util.resource包,在下文中一共展示了ResourceStreamNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResource

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public IResource getResource() {
	ConcatBundleResource bundleResource = new ConcatBundleResource(getProvidedResources()) {

		@Override
		protected byte[] readAllResources(List<IResourceStream> resources)
				throws IOException, ResourceStreamNotFoundException {
			ByteArrayOutputStream output = new ByteArrayOutputStream();
			for (IResourceStream curStream : resources) {
				IOUtils.copy(curStream.getInputStream(), output);
				output.write(";".getBytes());
			}

			byte[] bytes = output.toByteArray();

			if (getCompressor() != null) {
				String nonCompressed = new String(bytes, "UTF-8");
				bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8");
			}

			return bytes;
		}
		
	};
	ITextResourceCompressor compressor = getCompressor();
	if (compressor != null) {
		bundleResource.setCompressor(compressor);
	}
	return bundleResource;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:31,代码来源:JavaScriptConcatResourceBundleReference.java

示例2: getResourceStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public IResourceStream getResourceStream() {
	final InputStream byteStream = initStream();

	if (byteStream == null) {
		return null;
	}
	
	IResourceStream resourceStream = new AbstractResourceStream(){

		private static final long serialVersionUID = 1L;
		@Override
		public String getContentType() {
			return contentType;
		}

		@Override
		public InputStream getInputStream() throws ResourceStreamNotFoundException {
		    return byteStream;
           }

		@Override
		public void close() throws IOException {
			byteStream.close();
		}
		
	};
	return resourceStream;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:30,代码来源:AjaxDownloadBehaviorFromStream.java

示例3: notFound

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
public static FileStoreResourceStream notFound() {
	return new FileStoreResourceStream(new File("")) {
		private static final long serialVersionUID = 1L;
		@Override 
		public InputStream getInputStream() throws ResourceStreamNotFoundException {
			throw new ResourceStreamNotFoundException();
		}
	};
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:10,代码来源:FileStoreResourceStream.java

示例4: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
@Nullable
public InputStream getInputStream() {
	try {
		return new FilterInputStream(resourceStream.getInputStream()) {
			@Override
			public void close() throws IOException {
				resourceStream.close(); // The wicket way: close the resource stream, not the input stream
			}
		};
	} catch (ResourceStreamNotFoundException e) {
		LOGGER.error("Error while getting a resource for CSS parsing", e);
		return null; // The phloc way: return null, do not throw exceptions
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:16,代码来源:PhlocCssHtmlNotificationCssServiceImpl.java

示例5: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public InputStream getInputStream()
        throws ResourceStreamNotFoundException {

    try {
        execute();
        return responseEntity.getContent();
    } catch (Exception e) {
        throw new ResourceStreamNotFoundException(e);
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:12,代码来源:HttpResourceStream.java

示例6: getResourceStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
/**
 * Hook method providing the actual resource stream.
 * 
 * @return the stream.
 */
protected IResourceStream getResourceStream()
{

    return new AbstractResourceStream() {
        private static final long serialVersionUID1 = 1L;
        InputStream inStream;
        @Override
        public InputStream getInputStream()
            throws ResourceStreamNotFoundException
        {
            try {
                inStream = new FileInputStream(fileName);
            }
            catch (IOException e) {
                throw new ResourceStreamNotFoundException(e);
            }
            return inStream;
        }
        @Override
        public void close() throws IOException {
            inStream.close();
            inStream = null;
            FileUtils.forceDelete(new File(fileName));
        }
    };
}
 
开发者ID:webanno,项目名称:webanno,代码行数:32,代码来源:AJAXDownload.java

示例7: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
  try {
    return new Base64InputStream(new ReaderInputStream(reader, "utf-8"), false);
  } catch (UnsupportedEncodingException e) {
    throw new OntopiaRuntimeException(e);
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:9,代码来源:OccurrenceWebResource.java

示例8: getImageData

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
protected byte[] getImageData(Attributes attributes) {
	Long attrUserId = getUserId(attributes);
	int attrMaxSize = getMaxDimension(attributes);
	try {
		BufferedImage im;
		BufferedImage thumb;
		Path userPicturePath = UserProfilePictureUploadHelper.getUserPicturePath(attrUserId);
		if (attrUserId != null && userPicturePath != null) {
			im = ImageIO.read(userPicturePath.toFile());
			setLastModifiedTime(Time.millis(userPicturePath.toFile().lastModified()));
		} else {
			setLastModifiedTime(Time.millis(75675677));
			im = ImageIO.read(defaultProfilePictureRef.getCacheableResourceStream().getInputStream());
		}
		if (im.getWidth() > attrMaxSize || im.getHeight() > attrMaxSize) {
			// TODO add caching, currently every request scales the image!!
			thumb = Scalr.resize(im, Scalr.Method.ULTRA_QUALITY, Scalr.Mode.AUTOMATIC, attrMaxSize);
		} else {
			thumb = im;
		}
		byte[] bytes;
		try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
			ImageIO.write(thumb, "PNG", baos);
			bytes = baos.toByteArray();
		}
		return bytes;
	} catch (IOException | ResourceStreamNotFoundException ignored) {
	}
	return null;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:32,代码来源:UserPictureResource.java

示例9: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public InputStream getInputStream()
        throws ResourceStreamNotFoundException {

    return inputStream == null
            ? new ByteArrayInputStream(new byte[0])
            : inputStream;
}
 
开发者ID:apache,项目名称:syncope,代码行数:9,代码来源:HttpResourceStream.java

示例10: openResourceStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
protected InputStream openResourceStream(IResourceStream rstream) {
    if (rstream == null)
        return null;
    try {
        return rstream.getInputStream();
    } catch (ResourceStreamNotFoundException rsnfx) {
        return null;
    }
}
 
开发者ID:Nocket,项目名称:nocket,代码行数:10,代码来源:DMDWebGenPageContext.java

示例11: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
	return stream;
}
 
开发者ID:pingunaut,项目名称:wicket-stream-download-example,代码行数:5,代码来源:InputStreamResourceStream.java

示例12: makeDownloadBehavior

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
private Behavior makeDownloadBehavior(final String aKey1, final String aKey2)
{
    return new AjaxEventBehavior("click")
    {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onEvent(AjaxRequestTarget aTarget)
        {
            AJAXDownload download = new AJAXDownload() {
                private static final long serialVersionUID = 1L;
                
                @Override
                protected IResourceStream getResourceStream()
                {
                    return new AbstractResourceStream() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public InputStream getInputStream()
                            throws ResourceStreamNotFoundException
                        {
                            try {
                                AgreementResult result = AgreementTable.this.getModelObject()
                                        .getStudy(aKey1, aKey2);
                                
                                switch (settings.getObject().exportFormat) {
                                case CSV:
                                    return AgreementUtils.generateCsvReport(result);
                                case DEBUG:
                                    return generateDebugReport(result);
                                default:
                                    throw new IllegalStateException("Unknown export format ["
                                            + settings.getObject().exportFormat + "]");
                                }
                            }
                            catch (Exception e) {
                                // FIXME Is there some better error handling here?
                                LOG.error("Unable to generate agreement report", e);
                                throw new ResourceStreamNotFoundException(e);
                            }
                        }

                        @Override
                        public void close()
                            throws IOException
                        {
                            // Nothing to do
                        }
                    };
                }
            };
            getComponent().add(download);
            download.initiate(aTarget,
                    "agreement" + settings.getObject().exportFormat.getExtension());
        }
    };      
}
 
开发者ID:webanno,项目名称:webanno,代码行数:59,代码来源:AgreementTable.java

示例13: downloadHtopTable

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
private void downloadHtopTable(Item<UIUserForList> item, final UIUserForList user) {
    Link<Void> downloadHotpTableLink = new Link<Void>("download-hotp-table") {
        @Override
        public void onClick() {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            try {
                hotpProvider.outputSequenceForDownload(user.getUsername(), os);
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
            final byte[] bytes = os.toByteArray();
            IResourceStream resourceStream = new AbstractResourceStream() {
                @Override
                public Time lastModifiedTime() {
                    return Time.now();
                }

                @Override
                public Bytes length() {
                    return Bytes.bytes(bytes.length);
                }

                @Override
                public InputStream getInputStream() throws ResourceStreamNotFoundException {
                    return new ByteArrayInputStream(bytes);
                }

                @Override
                public String getContentType() {
                    return "application/vnd.ms-excel";
                }

                @Override
                public void close() throws IOException {
                }
            };
            getRequestCycle().replaceAllRequestHandlers(new ResourceStreamRequestHandler(resourceStream,
                    hotpProvider.getSequenceForDownloadFileName(user.getUsername())));
        }
    };
    downloadHotpTableLink.setVisible(hotpProvider.outputsSequenceForDownload());
    item.add(downloadHotpTableLink);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:44,代码来源:ListUsersPage.java

示例14: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
public InputStream getInputStream() throws ResourceStreamNotFoundException
{
  return new ByteArrayInputStream(content);
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:5,代码来源:ByteArrayResourceStream.java

示例15: getInputStream

import org.apache.wicket.util.resource.ResourceStreamNotFoundException; //导入依赖的package包/类
public InputStream getInputStream() throws ResourceStreamNotFoundException {
    return (new ByteArrayInputStream(content));
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:4,代码来源:ByteArrayResourceStream.java


注:本文中的org.apache.wicket.util.resource.ResourceStreamNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。