本文整理汇总了Java中org.apache.wicket.util.resource.IResourceStream类的典型用法代码示例。如果您正苦于以下问题:Java IResourceStream类的具体用法?Java IResourceStream怎么用?Java IResourceStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceStream类属于org.apache.wicket.util.resource包,在下文中一共展示了IResourceStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onRequest
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public void onRequest() {
final File file = initFile();
IResourceStream resourceStream = new FileResourceStream(new File(file));
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(
new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
try {
super.respond(requestCycle);
} finally {
if (removeFile) {
LOGGER.debug("Removing file '{}'.", new Object[]{file.getAbsolutePath()});
Files.remove(file);
}
}
}
}.setFileName(file.getName()).setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND));
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:AjaxDownloadBehaviorFromFile.java
示例2: onRequest
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public void onRequest() {
IResourceStream resourceStream = getResourceStream();
if (resourceStream == null) {
return; // We hope the error was already processed and will be shown.
}
ResourceStreamRequestHandler reqHandler = new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
super.respond(requestCycle);
}
}.setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND);
if (StringUtils.isNotEmpty(getFileName())){
reqHandler.setFileName(getFileName());
}
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(reqHandler);
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:AbstractAjaxDownloadBehavior.java
示例3: addExportButton
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
/**
* Add a button for exporting the dependencies of the given event type.
*/
private void addExportButton() {
final AjaxButton exportButton = new AjaxButton("exportButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(final AjaxRequestTarget target, final Form form) {
final AJAXDownload jsonDownload = new AJAXDownload() {
@Override
protected IResourceStream getResourceStream() {
final File csv = JsonExporter.generateExportFileWithDependencies(selectedEventType);
return new FileResourceStream(new org.apache.wicket.util.file.File(csv));
}
@Override
protected String getFileName() {
return selectedEventType.getTypeName() + "-dependencies.json";
}
};
ExportImportDependenciesPanel.this.add(jsonDownload);
jsonDownload.initiate(target);
ExportImportDependenciesPanel.this.page.getFeedbackPanel().success("Json created.");
target.add(ExportImportDependenciesPanel.this.page.getFeedbackPanel());
}
};
exportForm.add(exportButton);
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:28,代码来源:ExportImportDependenciesPanel.java
示例4: preloadStyleSheets
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
protected void preloadStyleSheets(ResourceReference... resourcesReferences) {
for (ResourceReference resourceReference : resourcesReferences) {
LOGGER.info("Preloading stylesheet '{}/{}'...", resourceReference.getScope().getName(),
resourceReference.getName());
IResourceStream resourceStream = null;
try {
// Just initialize the underlying cache, whatever the content is.
resourceStream = ((PackageResource) resourceReference.getResource()).getResourceStream();
} finally {
if (resourceStream != null) {
try {
resourceStream.close();
} catch (IOException e) {
LOGGER.error("Error when closing a stream while trying to preload stylesheets.", e);
}
}
}
}
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:20,代码来源:CoreWicketApplication.java
示例5: getRegistry
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
private synchronized IHtmlNotificationCssRegistry getRegistry(LessCssResourceReference cssResourceReference) throws ServiceException {
IResourceStream resourceStream = cssResourceReference.getResource().getResourceStream();
if (resourceStream == null) { // NOSONAR findbugs:RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
throw new ServiceException("Could not retrieve resource stream for resource reference " + cssResourceReference + " when accessing a notification CSS style registry");
}
Time currentResourceLastModifiedTime = resourceStream.lastModifiedTime();
Pair<IHtmlNotificationCssRegistry, Time> cacheEntry = registryCache.get(cssResourceReference);
if (cacheEntry != null && cacheEntry.getRight().equals(currentResourceLastModifiedTime)) {
return cacheEntry.getLeft();
} else {
IHtmlNotificationCssRegistry registry = createRegistry(resourceStream);
registryCache.put(cssResourceReference, Pair.of(registry, currentResourceLastModifiedTime));
return registry;
}
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:17,代码来源:PhlocCssHtmlNotificationCssServiceImpl.java
示例6: StartSharingButton
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public StartSharingButton(String id, String uid) {
super(id);
this.uid = uid;
setOutputMarkupPlaceholderTag(true);
setVisible(false);
add(download = new AjaxDownloadBehavior(new ResourceStreamResource() {
private static final long serialVersionUID = 1L;
{
setCacheDuration(NONE);
}
@Override
protected IResourceStream getResourceStream(Attributes attributes) {
setFileName(String.format("public_%s.jnlp", getOnlineClient(uid).getRoom().getId()));
StringResourceStream srs = new StringResourceStream(app, "application/x-java-jnlp-file");
srs.setCharset(UTF_8);
return srs;
}
}));
}
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:StartSharingButton.java
示例7: onRequest
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public void onRequest() {
final File file = initFile();
IResourceStream resourceStream = new FileResourceStream(new File(file));
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(
new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
try {
super.respond(requestCycle);
} finally {
if (removeFile) {
LOGGER.debug("Removing file '{}'.", new Object[]{file.getAbsolutePath()});
Files.remove(file);
}
}
}
}.setFileName(file.getName()).setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND));
}
开发者ID:Evolveum,项目名称:midpoint,代码行数:21,代码来源:AjaxDownloadBehaviorFromFile.java
示例8: onRequest
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public void onRequest() {
IResourceStream resourceStream = getResourceStream();
if (resourceStream == null) {
return; // We hope the error was already processed and will be shown.
}
ResourceStreamRequestHandler reqHandler = new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
super.respond(requestCycle);
}
}.setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND);
if (StringUtils.isNotEmpty(getFileName())){
reqHandler.setFileName(getFileName());
}
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(reqHandler);
}
开发者ID:Evolveum,项目名称:midpoint,代码行数:20,代码来源:AbstractAjaxDownloadBehavior.java
示例9: locate
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Checks for {@link DMDResourceStreamReferenceI} in the cache and returns
* <code>null</code> if the result is
* {@link DMDNullResourceStreamReference#INSTANCE}, or
* {@link FileResourceStream} / {@link UrlResourceStream} if there is an
* entry in the cache. Otherwise asks the delegate to find one and puts it
* in the cache.
*/
public IResourceStream locate(Class<?> clazz, String path) {
Key key = new Key(clazz.getName(), path, null, null, null);
DMDResourceStreamReferenceI resourceStreamReference = cache.get(key);
final IResourceStream result;
if (resourceStreamReference == null) {
result = delegate.locate(clazz, path);
updateCache(key, result);
} else {
result = resourceStreamReference.getReference();
}
return result;
}
开发者ID:Nocket,项目名称:nocket,代码行数:26,代码来源:DMDCachingResourceStreamLocator.java
示例10: loadDocument
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
private Document loadDocument() {
synchronized (DMDWebGenPageContext.class) {
String pagePath = htmlPath(getPage().getClass());
WebDomainProperties props = getConfiguration();
HTMLDocumentCachingPolicy cachingPolicy = props.getHTMLDocumentCachingPolicy();
Document document = readCachedDocument(getPage().getClass(), props);
if (document == null) {
IResourceStream rstream = getInputStreamForHtmlFile(getPage().getClass(), props);
InputStream in = openResourceStream(rstream);
if (in == null) {
in = createHtmlFileOnTheFly(props);
}
try {
String html = IOUtils.toString(in);
document = Jsoup.parse(html);
if (cachingPolicy != HTMLDocumentCachingPolicy.none)
documentCache.put(pagePath, document);
} catch (IOException e) {
throw new SevereGUIException(e);
} finally {
IOUtils.closeQuietly(in);
}
}
return document;
}
}
开发者ID:Nocket,项目名称:nocket,代码行数:27,代码来源:DMDWebGenPageContext.java
示例11: readCachedDocument
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
protected Document readCachedDocument(Class<? extends MarkupContainer> pageClass, WebDomainProperties props) {
String pagePath = htmlPath(pageClass);
HTMLDocumentCachingPolicy cachingPolicy = props.getHTMLDocumentCachingPolicy();
switch (cachingPolicy) {
case none:
return null;
case age:
IResourceStream rstream = getInputStreamForHtmlFile(pageClass, props);
if (rstream == null)
return null;
//TODO JL: HERE WE ARE!!!!!!!!!!!!!!!!!
// Fall through
default:
return documentCache.get(pagePath);
}
}
开发者ID:Nocket,项目名称:nocket,代码行数:17,代码来源:DMDWebGenPageContext.java
示例12: createHtmlFileOnTheFly
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
protected InputStream createHtmlFileOnTheFly(WebDomainProperties props) {
IResourceStreamLocator locator = Application.get().getResourceSettings().getResourceStreamLocator();
// Without a DMDCachinResourceStreamLocator we could create the HTML but we could
// not force a re-allocation of the created file.
if (locator instanceof DMDCachingResourceStreamLocator) {
DMDCachingResourceStreamLocator dmdLocator = (DMDCachingResourceStreamLocator) locator;
Class<? extends MarkupContainer> pageClass = getPage().getClass();
dmdLocator.drop(pageClass, htmlLookupPaths(pageClass));
JfdRetentionStrategy strategy = props.getJFDRetentionStrategy();
if (strategy != JfdRetentionStrategy.none) {
runHtmlGenerator(props);
IResourceStream rstream = getInputStreamForHtmlFile(pageClass, props);
InputStream in = openResourceStream(rstream);
if (in != null)
return in;
}
}
throw new SevereGUIException("No HTML file found for page " + getPage().getClass());
}
开发者ID:Nocket,项目名称:nocket,代码行数:20,代码来源:DMDWebGenPageContext.java
示例13: getInputStreamForHtmlFile
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected IResourceStream getInputStreamForHtmlFile(Class<? extends MarkupContainer> pageClass,
WebDomainProperties props) {
IResourceStream rstream = null;
IResourceStreamLocator resourceStreamLocator = Application.get().getResourceSettings()
.getResourceStreamLocator();
for (String htmlLookupPath : htmlLookupPaths(pageClass)) {
rstream = fetchStream(pageClass, htmlLookupPath, resourceStreamLocator);
if (rstream != null)
break;
}
if (rstream == null) {
Class<?> superclass = pageClass.getSuperclass();
if (superclass != props.getHTMLPageBaseClass() &&
MarkupContainer.class.isAssignableFrom(superclass)) {
rstream = getInputStreamForHtmlFile((Class<? extends MarkupContainer>) superclass, props);
}
}
return rstream;
}
开发者ID:Nocket,项目名称:nocket,代码行数:21,代码来源:DMDWebGenPageContext.java
示例14: onRequest
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
@Override
public void onRequest() {
IResourceStream resourceStream = new AbstractResourceStreamWriter() {
@Override
public String getContentType() {
return exportAction.getContentType();
}
@Override
public void write(OutputStream output) throws IOException {
exportAction.writeContent(output);
}
};
RequestCycle.get().scheduleRequestHandlerAfterCurrent(new ResourceStreamRequestHandler(resourceStream, exportAction.getFileName()));
}
开发者ID:jkrasnay,项目名称:panelized,代码行数:19,代码来源:ExportBehavior.java
示例15: createResourceStreamWriter
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public IResourceStream createResourceStreamWriter()
{
final IResourceStream iResourceStream = new AbstractResourceStreamWriter() {
private static final long serialVersionUID = 7780552906708508709L;
@Override
public String getContentType()
{
return "application/zip";
}
@Override
public void write(final OutputStream output)
{
ExportZipArchive.this.write(output);
}
};
return iResourceStream;
}
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:20,代码来源:ExportZipArchive.java
示例16: createResourceStreamWriter
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public IResourceStream createResourceStreamWriter()
{
final IResourceStream iResourceStream = new AbstractResourceStreamWriter() {
private static final long serialVersionUID = 7780552906708508709L;
@Override
public String getContentType()
{
return "application/json";
}
@Override
public void write(final OutputStream output)
{
try {
IOUtils.write(new Gson().toJson(result), output);
} catch (IOException ex) {
log.error("Exception encountered " + ex, ex);
}
}
};
return iResourceStream;
}
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:24,代码来源:ExportJson.java
示例17: getResource
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的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
示例18: getMarkupResourceStream
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
public IResourceStream getMarkupResourceStream(
MarkupContainer container, Class<?> containerClass) {
String html =
"<wicket:panel>" +
" <input type='checkbox' wicket:id='checkbox'></input>" +
"</wicket:panel>";
return new StringResourceStream(html);
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:SelectionColumn.java
示例19: getMarkupResourceStream
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
@Override
public final IResourceStream getMarkupResourceStream(MarkupContainer container, Class<?> containerClass) {
if (CmsPage.class.isAssignableFrom(containerClass) && containerClass != CmsPage.class) {
DSLContext context = Spring.getBean(DSLContext.class);
PageTable pageTable = Tables.PAGE.as("pageTable");
PagePojo page = context.select(pageTable.fields()).from(pageTable).where(pageTable.PAGE_ID.eq(getPageUUID())).fetchOneInto(PagePojo.class);
String html = page.getHtml();
StringResourceStream stream = new StringResourceStream("page_" + page.getPageId(), html);
return stream;
} else {
DefaultMarkupResourceStreamProvider streamProvider = new DefaultMarkupResourceStreamProvider();
return streamProvider.getMarkupResourceStream(container, containerClass);
}
}
开发者ID:PkayJava,项目名称:MBaaS,代码行数:15,代码来源:CmsPage.java
示例20: getMarkupResourceStream
import org.apache.wicket.util.resource.IResourceStream; //导入依赖的package包/类
@Override
public final IResourceStream getMarkupResourceStream(MarkupContainer container, Class<?> containerClass) {
if (CmsLayout.class.isAssignableFrom(containerClass) && containerClass != CmsLayout.class) {
DSLContext context = Spring.getBean(DSLContext.class);
LayoutTable layoutTable = Tables.LAYOUT.as("layoutTable");
LayoutPojo layout = context.select(layoutTable.fields()).from(layoutTable).where(layoutTable.LAYOUT_ID.eq(getLayoutUUID())).fetchOneInto(LayoutPojo.class);
String html = layout.getHtml();
StringResourceStream stream = new StringResourceStream("layout_" + layout.getLayoutId(), html);
return stream;
} else {
DefaultMarkupResourceStreamProvider streamProvider = new DefaultMarkupResourceStreamProvider();
return streamProvider.getMarkupResourceStream(container, containerClass);
}
}
开发者ID:PkayJava,项目名称:MBaaS,代码行数:15,代码来源:CmsLayout.java
注:本文中的org.apache.wicket.util.resource.IResourceStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论