org.apache.wicket.util.resource.AbstractResourceStream Java Examples
The following examples show how to use
org.apache.wicket.util.resource.AbstractResourceStream.
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: 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 #4
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 } }; }