本文整理汇总了Java中org.takes.rs.xe.XeAppend类的典型用法代码示例。如果您正苦于以下问题:Java XeAppend类的具体用法?Java XeAppend怎么用?Java XeAppend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XeAppend类属于org.takes.rs.xe包,在下文中一共展示了XeAppend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
return new RsPage(
"/xsl/logs.xsl",
request,
() -> new StickyList<>(
new XeAppend("menu", "logs"),
new XeDirectives(
new Directives().add("logs").append(
new Joined<>(
new Limited<Iterable<Directive>>(
Tv.TWENTY,
new RqUser(this.base, request).logs()
)
)
)
)
)
);
}
示例2: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
return new RsPage(
"/xsl/scripts.xsl",
request,
() -> new StickyList<>(
new XeAppend("menu", "scripts"),
new XeAppend("stripe_cents", "500"),
new XeAppend(
"stripe_key",
Manifests.read("ThreeCopies-StripeKey")
),
new XeDirectives(
new Directives().add("scripts").append(
new Joined<>(
new RqUser(this.base, request).scripts()
)
)
)
)
);
}
示例3: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
final User user = new RqUser(this.base, request);
final RqHref href = new RqHref.Base(request);
final Iterator<String> name = href.href().param("name").iterator();
return new RsPage(
"/xsl/script.xsl",
request,
() -> new StickyList<>(
new XeAppend("menu", "scripts"),
new XeWhen(
name.hasNext(),
() -> new XeDirectives(
user.script(name.next()).toXembly()
)
)
)
);
}
示例4: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) {
return new RsPage(
req, "mistakes",
() -> new IterableOf<>(
new XeAppend(
"worst",
new XeDirectives(
new Joined<>(
new Limited<>(
// @checkstyle MagicNumber (1 line)
20, new Mistakes().worst()
)
)
)
)
)
);
}
示例5: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) {
return new RsPage(
req, "all",
() -> new IterableOf<>(
new XeAppend(
"recent",
new XeDirectives(
new Joined<>(
new Results().all()
)
)
)
)
);
}
示例6: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
return new RsPage(
"/xsl/domains.xsl",
req,
new XeAppend(
"domains",
new XeTransform<>(
this.base.user(new RqUser(req).name()).mine(),
TkDomains::source
)
),
new XeLink("add", "/add"),
new XeLink("invalidate", "/invalidate")
);
}
示例7: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
final Iterable<Event> events = this.base.user(new RqUser(req).urn())
.events()
.iterate();
return new RsPage(
"/xsl/events.xsl",
req,
new XeAppend(
"events",
new XeChain(
new XeTransform<>(
Iterables.limit(events, Tv.TWENTY),
TkEvents::source
)
),
new XeDirectives(
new Directives().attr("total", Iterables.size(events))
)
)
);
}
示例8: generatesCorrectLink
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* XeLogoutLink can create a correct link.
* @throws IOException If some problem inside
*/
@Test
public void generatesCorrectLink() throws IOException {
MatcherAssert.assertThat(
IOUtils.toString(
new RsXembly(
new XeAppend(
"root",
new XeLogoutLink(new RqFake())
)
).body(),
StandardCharsets.UTF_8
),
XhtmlMatchers.hasXPaths(
"/root/links/link[@rel='takes:logout']"
)
);
}
示例9: generatesIdentityInXml
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* XeIdentity can create a correct link.
* @throws IOException If some problem inside
*/
@Test
public void generatesIdentityInXml() throws IOException {
MatcherAssert.assertThat(
IOUtils.toString(
new RsXembly(
new XeAppend(
"root",
new XeIdentity(
new RqWithHeader(
new RqFake(),
TkAuth.class.getSimpleName(),
"urn:test:1;name=Jeff"
)
)
)
).body(),
StandardCharsets.UTF_8
),
XhtmlMatchers.hasXPaths(
"/root/identity[urn='urn:test:1']",
"/root/identity[name='Jeff']"
)
);
}
示例10: generatesCorrectLink
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* XeGoogleLink can create a correct link.
* @throws IOException If some problem inside
*/
@Test
public void generatesCorrectLink() throws IOException {
MatcherAssert.assertThat(
IOUtils.toString(
new RsXembly(
new XeAppend(
"root",
new XeGoogleLink(new RqFake(), "abcdef")
)
).body(),
StandardCharsets.UTF_8
),
XhtmlMatchers.hasXPaths(
"/root/links/link[@rel='takes:google']"
)
);
}
示例11: generatesCorrectLink
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* XeGithubLink can create a correct link.
* @throws IOException If some problem inside
*/
@Test
public void generatesCorrectLink() throws IOException {
MatcherAssert.assertThat(
IOUtils.toString(
new RsXembly(
new XeAppend(
"root",
new XeGithubLink(new RqFake(), "abcdef")
)
).body(),
StandardCharsets.UTF_8
),
XhtmlMatchers.hasXPaths(
"/root/links/link[@rel='takes:github']"
)
);
}
示例12: generatesCorrectLink
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* XeFacebookLink can create a correct link.
* @throws IOException If some problem inside
*/
@Test
public void generatesCorrectLink() throws IOException {
MatcherAssert.assertThat(
IOUtils.toString(
new RsXembly(
new XeAppend(
"root",
new XeFacebookLink(new RqFake(), "abcdef")
)
).body(),
StandardCharsets.UTF_8
),
XhtmlMatchers.hasXPaths(
"/root/links/link[@rel='takes:facebook']"
)
);
}
示例13: source
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* Convert friend into XE source.
* @param friend Name of the friend
* @param home Home of the doc
* @return Source
*/
private static XeSource source(final String friend,
final Href home) {
return new XeAppend(
"friend",
new XeChain(
new XeDirectives(
new Directives().add("name").set(friend)
),
new XeLink(
"eject",
home.path("eject-friend").with("friend", friend)
)
)
);
}
示例14: make
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
* Make it.
* @param base Base
* @param req Request
* @return Response
* @throws IOException If fails
*/
private static XeSource make(final Base base, final Request req)
throws IOException {
final RqUser user = new RqUser(req, base);
return new XeWhen(
user.exists(),
new XeSource() {
@Override
public Iterable<Directive> toXembly() throws IOException {
return new XeAppend(
"account",
new XeAppend(
"size",
Long.toString(user.user().docs().size())
)
).toXembly();
}
}
);
}
示例15: act
import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
return new RsPage(
"/xsl/decks.xsl",
this.base,
req,
new XeLink("add", "/add"),
new XeAppend(
"items",
new XeTransform<>(
new RqUser(req, this.base).get().decks().iterate(),
new XeTransform.Func<Deck>() {
@Override
public XeSource transform(final Deck deck)
throws IOException {
return TkDecks.source(deck);
}
}
)
)
);
}