org.takes.rs.xe.XeChain Java Examples
The following examples show how to use
org.takes.rs.xe.XeChain.
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: RsPage.java From jpeek with MIT License | 5 votes |
/** * Make it. * @param req Request * @param xsl XSL stylesheet * @param src Sources * @return Response */ @SuppressWarnings("PMD.AvoidDuplicateLiterals") private static Response make(final Request req, final String xsl, final Scalar<Iterable<XeSource>> src) { final Response raw = new RsXembly( new XeChain( new XeStylesheet( String.format("/org/jpeek/web/%s.xsl", xsl) ), new XeAppend( "page", new XeChain( new XeMillis(), new XeDirectives(new Header()), new XeChain(src), new XeMillis(true) ) ) ) ); return new RsFork( req, new FkTypes( "text/html", new RsXslt(new RsWithType(raw, "text/html")) ), new FkTypes( "application/vnd.jpeek+xml", new RsPrettyXml(new RsWithType(raw, "text/xml")) ), new FkTypes("*/*", raw) ); }
Example #2
Source File: Items.java From takes with MIT License | 5 votes |
@Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Iterable<Directive> toXembly() throws IOException { final Collection<XeSource> items = new LinkedList<>(); final File[] files = this.home.listFiles(); if (files != null) { for (final File file : files) { items.add(new Item(file)); } } return new Directives().add("files").append( new XeChain(items).toXembly() ); }
Example #3
Source File: RsPage.java From jare with MIT License | 4 votes |
/** * Make it. * @param xsl XSL * @param req Request * @param src Source * @return Response * @throws IOException If fails */ private static Response make(final String xsl, final Request req, final Iterable<XeSource> src) throws IOException { final Response raw = new RsXembly( new XeStylesheet(xsl), new XeAppend( "page", new XeMillis(false), new XeChain(src), new XeLinkHome(req), new XeLinkSelf(req), new XeMillis(true), new XeDate(), new XeSla(), new XeLocalhost(), new XeFlash(req), new XeWhen( new RqAuth(req).identity().equals(Identity.ANONYMOUS), new XeChain( new XeGithubLink(req, Manifests.read("Jare-GithubId")) ) ), new XeWhen( !new RqAuth(req).identity().equals(Identity.ANONYMOUS), new XeChain( new XeIdentity(req), new XeLogoutLink(req), new XeLink("domains", "/domains") ) ), new XeAppend( "version", new XeAppend("name", Manifests.read("Jare-Version")), new XeAppend("revision", Manifests.read("Jare-Revision")), new XeAppend("date", Manifests.read("Jare-Date")), new XeAppend("heroku", RsPage.heroku()) ) ) ); return new RsFork( req, new FkTypes( "application/xml,text/xml", new RsPrettyXml(new RsWithType(raw, "text/xml")) ), new FkTypes( "*/*", new RsXslt(new RsWithType(raw, "text/html")) ) ); }