当前位置: 首页>>代码示例>>Java>>正文


Java XeSource类代码示例

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


XeSource类属于org.takes.rs.xe包,在下文中一共展示了XeSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: source

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Convert event to Xembly.
 * @param domain The event
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Domain domain) throws IOException {
    final String name = domain.name();
    final Usage usage = domain.usage();
    return new XeDirectives(
        new Directives()
            .add("domain")
            .add("name").set(name).up()
            .add("usage").set(usage.total()).up()
            .append(
                new XeLink(
                    "delete",
                    new Href("/delete").with("name", name)
                ).toXembly()
            )
            .up()
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:24,代码来源:TkDomains.java

示例2: source

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Convert event to Xembly.
 * @param event The event
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Event event) throws IOException {
    final Iterable<Directive> dirs = event.asXembly();
    final String title = new XePrint(dirs).text("{/event/title/text()}");
    return new XeDirectives(
        new Directives()
            .append(dirs)
            .append(
                new XeLink(
                    "delete",
                    new Href("/event-delete").with("title", title)
                ).toXembly()
            )
            .append(
                new XeLink(
                    "down",
                    new Href("/event-down").with("title", title)
                ).toXembly()
            )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:27,代码来源:TkEvents.java

示例3: make

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Ctor.
 * @param req Request
 * @param app Google application ID
 * @param rel Related
 * @param redir Redirect URI
 * @return Source
 * @throws IOException If fails
 * @since 0.14
 * @checkstyle ParameterNumberCheck (4 lines)
 */
private static XeSource make(final Request req, final CharSequence app,
    final CharSequence rel, final CharSequence redir) throws IOException {
    return new XeLink(
        rel,
        new Href("https://accounts.google.com/o/oauth2/auth")
            .with("client_id", app)
            .with("redirect_uri", redir)
            .with("response_type", "code")
            .with("state", new RqHref.Base(req).href())
            .with(
                "scope",
                "https://www.googleapis.com/auth/userinfo.profile"
            )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:27,代码来源:XeGoogleLink.java

示例4: XeIdentity

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Ctor.
 * @param req Request
 */
public XeIdentity(final Request req) {
    super(
        new XeSource() {
            @Override
            public Iterable<Directive> toXembly() throws IOException {
                final Identity identity = new RqAuth(req).identity();
                final Directives dirs = new Directives();
                if (!identity.equals(Identity.ANONYMOUS)) {
                    dirs.add("identity")
                        .add("urn").set(identity.urn()).up();
                    for (final Map.Entry<String, String> prop
                        : identity.properties().entrySet()) {
                        dirs.add(prop.getKey()).set(prop.getValue()).up();
                    }
                }
                return dirs;
            }
        }
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:25,代码来源:XeIdentity.java

示例5: source

import org.takes.rs.xe.XeSource; //导入依赖的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

示例6: make

import org.takes.rs.xe.XeSource; //导入依赖的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

示例7: make

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Make it.
 * @param base Base
 * @param req Request
 * @param src Source
 * @return Response
 * @throws IOException If fails
 */
private static XeSource make(final Base base,
    final Request req, final XeSource... src) throws IOException {
    assert base != null;
    return new XeAppend(
        "page",
        new XeMillis(false),
        new XeChain(src),
        new XeDate(),
        new XeSLA(),
        new XeLinkHome(req),
        new XeLinkSelf(req),
        new XeLocalhost(),
        new XeIdentity(req),
        new XeFlash(req),
        new XeGithubLink(req, Manifests.read("Thindeck-GithubId")),
        new XeLogoutLink(req),
        new XeAppend(
            "version",
            new XeAppend("name", Manifests.read("Thindeck-Version")),
            new XeAppend("rev", Manifests.read("Thindeck-Revision")),
            new XeAppend("date", Manifests.read("Thindeck-Date"))
        ),
        new XeMillis(true)
    );
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:34,代码来源:XePage.java

示例8: act

import org.takes.rs.xe.XeSource; //导入依赖的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

示例9: make

import org.takes.rs.xe.XeSource; //导入依赖的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

示例10: make

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * 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)
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:40,代码来源:RsPage.java

示例11: source

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Convert event to Xembly.
 * @param domain The event
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Domain domain) throws IOException {
    return new XeDirectives(
        new Directives()
            .add("domain")
            .add("name").set(domain.name()).up()
            .add("owner").set(domain.owner()).up()
            .add("usage").set(domain.usage().total()).up()
            .up()
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:17,代码来源:TkIndex.java

示例12: source

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Convert pipe to Xembly.
 * @param pipe The pipe
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Pipe pipe) throws IOException {
    final Iterable<Directive> dirs = pipe.asXembly();
    return new XeDirectives(
        new Directives().append(dirs).append(
            new XeLink(
                "delete",
                new XePrint(pipe.asXembly()).text(
                    "/pipe-delete?id={/pipe/id/text()}"
                )
            ).toXembly()
        )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:20,代码来源:TkPipes.java

示例13: make

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Ctor.
 * @param req Request
 * @param app Github application ID
 * @param rel Related
 * @param flag Flag to add
 * @return Source
 * @throws IOException If fails
 * @checkstyle ParameterNumberCheck (4 lines)
 */
private static XeSource make(final Request req, final CharSequence app,
    final CharSequence rel, final CharSequence flag) throws IOException {
    return new XeLink(
        rel,
        new Href("https://www.facebook.com/dialog/oauth")
            .with("client_id", app)
            .with(
                "redirect_uri",
                new RqHref.Base(req).href()
                    .with(flag, PsFacebook.class.getSimpleName())
            )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:24,代码来源:XeFacebookLink.java

示例14: make

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Ctor.
 * @param req Request
 * @param app Github application ID
 * @param rel Related
 * @param flag Flag to add
 * @return Source
 * @throws IOException If fails
 * @checkstyle ParameterNumberCheck (4 lines)
 */
private static XeSource make(final Request req, final CharSequence app,
    final CharSequence rel, final CharSequence flag) throws IOException {
    return new XeLink(
        rel,
        new Href("https://github.com/login/oauth/authorize")
            .with("client_id", app)
            .with(
                "redirect_uri",
                new RqHref.Base(req).href()
                    .with(flag, PsGithub.class.getSimpleName())
            )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:24,代码来源:XeGithubLink.java

示例15: RsPage

import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
 * Ctor.
 * @param xsl XSL stylesheet name
 * @param source Xembly source
 */
RsPage(final String xsl, final XeSource source) {
    this.origin = new RsXslt(
        new RsXembly(
            new XeStylesheet(xsl),
            new XeAppend(
                "page",
                new XeMillis(false),
                source,
                new XeMillis(true)
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:takes,代码行数:19,代码来源:RsPage.java


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