• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XeAppend类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.takes.rs.xe.XeAppend的典型用法代码示例。如果您正苦于以下问题:Java XeAppend类的具体用法?Java XeAppend怎么用?Java XeAppend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XeAppend类属于org.takes.rs.xe包,在下文中一共展示了XeAppend类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:21,代码来源:TkLogs.java


示例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()
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:23,代码来源:TkScripts.java


示例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()
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:20,代码来源:TkScript.java


示例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()
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:20,代码来源:TkMistakes.java


示例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()
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:17,代码来源:TkAll.java


示例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")
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:17,代码来源:TkDomains.java


示例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))
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:23,代码来源:TkEvents.java


示例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']"
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:22,代码来源:XeLogoutLinkTest.java


示例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']"
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:29,代码来源:XeIdentityTest.java


示例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']"
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:22,代码来源:XeGoogleLinkTest.java


示例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']"
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:22,代码来源:XeGithubLinkTest.java


示例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']"
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:22,代码来源:XeFacebookLinkTest.java


示例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)
            )
        )
    );
}
 
开发者ID:libreio,项目名称:libre,代码行数:22,代码来源:TkDocs.java


示例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();
            }
        }
    );
}
 
开发者ID:libreio,项目名称:libre,代码行数:27,代码来源:XeAccount.java


示例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);
                    }
                }
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:23,代码来源:TkDecks.java


示例16: act

import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
    final URL url = new URL(new RqHref.Smart(req).single("u"));
    return new RsPage(
        "/xsl/info.xsl",
        req,
        () -> new ListOf<>(
            new XeAppend("url", url.toString()),
            new XeAppend(
                "encoded_url",
                URLEncoder.encode(
                    url.toString(), StandardCharsets.UTF_8.name()
                )
            ),
            new XeAppend(
                "targets",
                new XeDirectives(
                    new Joined<>(
                        new Limited<>(
                            this.base.status(url).failures(Long.MAX_VALUE),
                            Tv.TWENTY
                        )
                    )
                )
            ),
            new XeAppend(
                "history",
                new XeDirectives(
                    new Joined<>(
                        new Limited<>(
                            this.base.status(url).history(Long.MAX_VALUE),
                            Tv.TEN
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:40,代码来源:TkInfo.java


示例17: make

import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
/**
 * Make it.
 * @param xsl XSL
 * @param req Request
 * @param src Source
 * @return Response
 */
private static Response make(final String xsl, final Request req,
    final Scalar<Iterable<XeSource>> src) {
    final Response raw = new RsXembly(
        new XeStylesheet(xsl),
        new XeAppend(
            "page",
            new XeMillis(false),
            new XeChain(src),
            new XeMemory(),
            new XeLinkHome(req),
            new XeLinkSelf(req),
            new XeMillis(true),
            new XeDate(),
            new XeSla(),
            new XeLocalhost(),
            new XeFlash(req),
            new XeAppend(
                "version",
                new XeAppend("name", Manifests.read("Rehttp-Version")),
                new XeAppend("revision", Manifests.read("Rehttp-Revision")),
                new XeAppend("date", Manifests.read("Rehttp-Date"))
            )
        )
    );
    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"))
        )
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:44,代码来源:RsPage.java


示例18: act

import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
    return new RsPage(
        "/xsl/index.xsl",
        request,
        () -> new StickyList<>(
            new XeAppend("menu", "index")
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:11,代码来源:TkIndex.java


示例19: apply

import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Func<String, Response> apply(final String group,
    final String artifact) throws IOException {
    final Future<Func<String, Response>> future =
        new IoCheckedBiFunc<>(this.cache).apply(group, artifact);
    final Func<String, Response> output;
    if (future.isDone()) {
        try {
            output = future.get();
        } catch (final InterruptedException | ExecutionException ex) {
            throw new IllegalStateException(ex);
        }
    } else {
        final long msec = System.currentTimeMillis()
            - this.starts.computeIfAbsent(
                String.format("%s:%s", group, artifact),
                s -> System.currentTimeMillis()
            );
        output = input -> new RsPage(
            new RqFake(), "wait",
            () -> new IterableOf<>(
                new XeAppend("group", group),
                new XeAppend("artifact", artifact),
                new XeAppend("future", future.toString()),
                new XeAppend("msec", Long.toString(msec)),
                new XeAppend(
                    "spent",
                    Logger.format("%[ms]s", msec)
                )
            )
        );
    }
    return output;
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:35,代码来源:AsyncReports.java


示例20: act

import org.takes.rs.xe.XeAppend; //导入依赖的package包/类
@Override
public Response act(final Request req) {
    return new RsPage(
        req, "index",
        () -> new IterableOf<>(
            new XeAppend(
                "best",
                new XeDirectives(
                    new Joined<>(
                        new Limited<Iterable<Directive>>(
                            // @checkstyle MagicNumber (1 line)
                            20, new Results().best()
                        )
                    )
                )
            ),
            new XeAppend(
                "recent",
                new XeDirectives(
                    new Joined<>(
                        new Limited<>(
                            // @checkstyle MagicNumber (1 line)
                            25, new Results().recent()
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:31,代码来源:TkIndex.java



注:本文中的org.takes.rs.xe.XeAppend类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WorkItemManager类代码示例发布时间:2022-05-23
下一篇:
Java Response类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap