org.apache.wicket.util.resource.ResourceStreamNotFoundException Java Examples
The following examples show how to use
org.apache.wicket.util.resource.ResourceStreamNotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SitemapXmlResource.java From yes-cart with Apache License 2.0 | 6 votes |
SitemapResource(final InputStream stream) { super(new AbstractResourceStream() { /** {@inheritDoc} */ @Override public String getContentType() { return "text/xml"; } /** {@inheritDoc} */ @Override public InputStream getInputStream() throws ResourceStreamNotFoundException { return stream; } /** {@inheritDoc} */ @Override public void close() throws IOException { stream.close(); } }); }
Example #2
Source File: RobotsTxtResource.java From yes-cart with Apache License 2.0 | 6 votes |
RobotsResource(final InputStream stream) { super(new AbstractResourceStream() { /** {@inheritDoc} */ @Override public String getContentType() { return "text/plain"; } /** {@inheritDoc} */ @Override public InputStream getInputStream() throws ResourceStreamNotFoundException { return stream; } /** {@inheritDoc} */ @Override public void close() throws IOException { stream.close(); } }); }
Example #3
Source File: CssConcatResourceBundleReference.java From onedev with MIT License | 5 votes |
@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("\n".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; }
Example #4
Source File: JavaScriptConcatResourceBundleReference.java From onedev with MIT License | 5 votes |
@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(";\n".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; }
Example #5
Source File: OccurrenceWebResource.java From ontopia with Apache License 2.0 | 5 votes |
@Override public InputStream getInputStream() throws ResourceStreamNotFoundException { try { return new Base64InputStream(new ReaderInputStream(reader, "utf-8"), false); } catch (UnsupportedEncodingException e) { throw new OntopiaRuntimeException(e); } }
Example #6
Source File: HttpResourceStream.java From syncope with Apache License 2.0 | 5 votes |
@Override public InputStream getInputStream() throws ResourceStreamNotFoundException { return responseHolder.getInputStream() == null ? new ByteArrayInputStream(new byte[0]) : responseHolder.getInputStream(); }
Example #7
Source File: InputStreamResourceStream.java From webanno with Apache License 2.0 | 4 votes |
@Override public InputStream getInputStream() throws ResourceStreamNotFoundException { return inputStream; }
Example #8
Source File: PairwiseCodingAgreementTable.java From webanno with Apache License 2.0 | 4 votes |
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 { CodingAgreementResult result = PairwiseCodingAgreementTable.this .getModelObject().getStudy(aKey1, aKey2); switch (formatField.getModelObject()) { case CSV: return AgreementUtils.generateCsvReport(result); case DEBUG: return generateDebugReport(result); default: throw new IllegalStateException("Unknown export format [" + formatField.getModelObject() + "]"); } } 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" + formatField.getModelObject().getExtension()); } }; }
Example #9
Source File: PairwiseCodingAgreementTable.java From webanno with Apache License 2.0 | 4 votes |
private IResourceStream exportAllAgreements() { return new AbstractResourceStream() { private static final long serialVersionUID = 1L; @Override public InputStream getInputStream() throws ResourceStreamNotFoundException { AnnotationFeature feature = getModelObject().getFeature(); DefaultAgreementTraits traits = getModelObject().getTraits(); Map<String, List<CAS>> casMap = casMapSupplier.get(); List<DiffAdapter> adapters = CasDiff.getDiffAdapters(annotationService, asList(feature.getLayer())); CasDiff diff = doDiff(adapters, traits.getLinkCompareBehavior(), casMap); // AgreementResult agreementResult = AgreementUtils.makeStudy(diff, // feature.getLayer().getName(), feature.getName(), // pref.excludeIncomplete, casMap); // TODO: for the moment, we always include incomplete annotations during this // export. CodingAgreementResult agreementResult = makeCodingStudy(diff, feature.getLayer().getName(), feature.getName(), false, casMap); try { return AgreementUtils.generateCsvReport(agreementResult); } catch (Exception e) { // FIXME Is there some better error handling here? LOG.error("Unable to generate report", e); throw new ResourceStreamNotFoundException(e); } } @Override public void close() throws IOException { // Nothing to do } }; }
Example #10
Source File: ByteArrayResourceStream.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public InputStream getInputStream() throws ResourceStreamNotFoundException { return new ByteArrayInputStream(content); }
Example #11
Source File: ByteArrayResourceStream.java From nextreports-server with Apache License 2.0 | 4 votes |
public InputStream getInputStream() throws ResourceStreamNotFoundException { return (new ByteArrayInputStream(content)); }