本文整理汇总了Java中org.takes.rs.xe.XeSource类的典型用法代码示例。如果您正苦于以下问题:Java XeSource类的具体用法?Java XeSource怎么用?Java XeSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XeSource类属于org.takes.rs.xe包,在下文中一共展示了XeSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: toXembly
import org.takes.rs.xe.XeSource; //导入依赖的package包/类
@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()
);
}
开发者ID:yegor256,项目名称:takes,代码行数:15,代码来源:Items.java
示例17: act
import org.takes.rs.xe.XeSource; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
final User user = this.base.user(new RqAuth(req).identity().urn());
final Docs docs = user.docs();
return new RsPage(
"/xsl/docs.xsl",
req,
this.base,
new XeLink("upload", "/doc/write"),
new XeAppend(
"user",
new XeAppend(
"balance",
new XeDirectives(
new Directives().set(
Integer.toString(user.account().balance())
)
)
)
),
new XeAppend(
"docs",
new XeTransform<>(
docs.names(),
new XeTransform.Func<String>() {
@Override
public XeSource transform(final String doc)
throws IOException {
return TkDocs.source(docs.doc(doc), doc, req);
}
}
)
),
new XeLink("mkdir", "/dir/create")
);
}
开发者ID:libreio,项目名称:libre,代码行数:37,代码来源:TkDocs.java
示例18: make
import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
* Make it.
* @param xsl XSL
* @param req Request
* @param base Base
* @param src Source
* @return Response
* @throws IOException If fails
* @checkstyle ParameterNumberCheck (5 lines)
*/
private static Response make(final String xsl, final Request req,
final Base base, final XeSource... src) throws IOException {
final Response raw = new RsXembly(
new XeStylesheet(xsl),
new XeAppend(
"page",
new XeMillis(false),
new XeChain(src),
new XeMillis(true),
new XeDate(),
new XeSLA(),
new XeLocalhost(),
new XeIdentity(req),
new XeAccount(base, req),
new XeFlash(req),
new XeFacebookLink(req, Manifests.read("libre-FacebookId")),
new XeLogoutLink(req),
new XeAppend(
"version",
new XeAppend("name", Manifests.read("libre-Version")),
new XeAppend(
"revision", Manifests.read("libre-Revision")
),
new XeAppend("date", Manifests.read("libre-Date"))
)
)
);
return new RsFork(
req,
new FkTypes(
"application/xml,text/xml",
new RsWithType(raw, "text/xml")
),
new FkTypes(
"*/*",
new RsXSLT(new RsWithType(raw, "text/html"))
)
);
}
开发者ID:libreio,项目名称:libre,代码行数:50,代码来源:RsPage.java
示例19: act
import org.takes.rs.xe.XeSource; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
final User user = this.base.user(new RqAuth(req).identity().urn());
return new RsPage(
"/xsl/admin.xsl",
req,
this.base,
new XeAppend(
"docs",
new XeTransform<>(
user.docs().names(),
new XeTransform.Func<String>() {
@Override
public XeSource transform(final String name) {
return new XeAppend(
"doc",
new XeDirectives(
new Directives()
.add("path").set(
String.format(
"%s/%s", user.urn(), name
)
)
)
);
}
}
)
)
);
}
开发者ID:libreio,项目名称:libre,代码行数:32,代码来源:TkAdmin.java
示例20: make
import org.takes.rs.xe.XeSource; //导入依赖的package包/类
/**
* Make it.
* @param xsl XSL
* @param base Base
* @param req Request
* @param src Source
* @return Response
* @throws IOException If fails
* @checkstyle ParameterNumberCheck (5 lines)
*/
private static Response make(final String xsl, final Base base,
final Request req, final XeSource... src) throws IOException {
final Response xbl = new RsXembly(
new XeStylesheet(xsl),
new XePage(base, req, src)
);
final Response raw = new RsWithType(xbl, "text/xml");
return new RsFork(
req,
new Fork() {
@Override
public Opt<Response> route(final Request rst)
throws IOException {
final RqHeaders hdr = new RqHeaders.Base(rst);
final Iterator<String> agent =
hdr.header("User-Agent").iterator();
final Opt<Response> opt;
if (agent.hasNext() && agent.next().contains("Firefox")) {
opt = new Opt.Single<Response>(
// @checkstyle MultipleStringLiteralsCheck (1 line)
new RsXSLT(new RsWithType(raw, "text/html"))
);
} else {
opt = new Opt.Empty<>();
}
return opt;
}
},
new FkTypes("application/xml,text/xml", new RsPrettyXML(raw)),
new FkTypes(
"*/*",
new RsXSLT(new RsWithType(raw, "text/html"))
)
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:46,代码来源:RsPage.java
注:本文中的org.takes.rs.xe.XeSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论