本文整理汇总了Java中org.takes.tk.TkClasspath类的典型用法代码示例。如果您正苦于以下问题:Java TkClasspath类的具体用法?Java TkClasspath怎么用?Java TkClasspath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TkClasspath类属于org.takes.tk包,在下文中一共展示了TkClasspath类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TkRefresh
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Ctor.
* @param path Path
* @throws IOException If fails
*/
public TkRefresh(final File path) throws IOException {
this.take = new TkFork(
new FkHitRefresh(
path,
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
示例2: refresh
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Ctor.
* @param path Path of files
* @return Take
* @throws IOException If fails
*/
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
示例3: TkRefresh
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Ctor.
* @param path Path of files
* @throws IOException If fails
*/
TkRefresh(final String path) throws IOException {
super(
new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
)
);
}
示例4: refresh
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Hit refresh fork.
* @param path Path of files
* @return Fork
* @throws IOException If fails
*/
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
() -> new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout(),
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
示例5: refresh
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Hit refresh fork.
* @param path Path of files
* @return Fork
* @throws IOException If fails
*/
@SuppressWarnings("PMD.DoNotUseThreads")
private static Take refresh(final String path) throws IOException {
return new TkFork(
new FkHitRefresh(
new File(path),
new Runnable() {
@Override
public void run() {
new VerboseProcess(
new ProcessBuilder(
"mvn",
"generate-resources"
)
).stdout();
}
},
new TkFiles("./target/classes")
),
new FkFixed(new TkClasspath())
);
}
示例6: app
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Ctor.
* @param base Base
* @return App
* @throws IOException If fails
*/
private static Take app(final Base base) throws IOException {
return new TkWithHeaders(
new TkVersioned(
new TkMeasured(
new TkFlash(
TkApp.auth(
TkApp.safe(
new TkForward(
new TkGzip(
new TkFork(
new FkRegex("/robots.txt", ""),
new FkRegex(
"/org/takes/.+\\.xsl",
new TkClasspath()
),
new FkRegex(
"/xsl/[a-z\\-]+\\.xsl",
new TkWithType(
TkApp.refresh("./src/main/xsl"),
"text/xsl"
)
),
new FkRegex(
"/css/[a-z]+\\.css",
new TkWithType(
TkApp.refresh("./src/main/scss"),
"text/css"
)
),
new FkRegex(
"/images/[a-z]+\\.svg",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/svg+xml"
)
),
new FkRegex(
"/images/[a-z]+\\.png",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/png"
)
),
new FkRegex("/", new TkIndex()),
new FkRegex("/scripts", new TkScripts(base)),
new FkRegex("/script", new TkScript(base)),
new FkRegex("/save", new TkSave(base)),
new FkRegex("/delete", new TkDelete(base)),
new FkRegex("/flush", new TkFlush(base)),
new FkRegex("/pay", new TkPay(base)),
new FkRegex("/delete-log", new TkDeleteLog(base)),
new FkRegex("/logs", new TkLogs(base)),
new FkRegex("/log", new TkLog()),
new FkRegex("/log-link", new TkLogLink(base))
)
)
)
)
)
)
)
),
new Sprintf("X-ThreeCopies-Revision: %s", TkApp.REV).toString(),
"Vary: Cookie"
);
}
示例7: make
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Ctor.
* @param home Home directory
* @return The take
* @throws IOException If fails
*/
private static Take make(final Path home) throws IOException {
final Futures futures = new Futures(new Reports(home));
return new TkFallback(
new TkForward(
new TkFork(
new FkRegex("/", new TkIndex()),
new FkRegex("/robots.txt", new TkText("")),
new FkRegex("/mistakes", new TkMistakes()),
new FkRegex(
"/flush",
(Take) req -> new RsText(
String.format("%d flushed", new Results().flush())
)
),
new FkRegex("/all", new TkAll()),
new FkRegex("/queue", new TkQueue(futures)),
new FkRegex(
".+\\.xsl",
new TkWithType(
new TkClasspath(),
"text/xsl"
)
),
new FkRegex(
"/jpeek\\.css",
new TkWithType(
new TkText(
new TextOf(
new ResourceOf("org/jpeek/jpeek.css")
).asString()
),
"text/css"
)
),
new FkRegex(
"/([^/]+)/([^/]+)(.*)",
new TkReport(
new AsyncReports(
// @checkstyle MagicNumber (1 line)
new SolidBiFunc<>(futures, 100)
)
)
)
)
),
new FbChain(
new FbStatus(
HttpURLConnection.HTTP_NOT_FOUND,
(Fallback) req -> new Opt.Single<>(
new RsWithStatus(
new RsText(req.throwable().getMessage()),
req.code()
)
)
),
req -> {
Sentry.capture(req.throwable());
return new Opt.Single<>(
new RsWithStatus(
new RsText(
new TextOf(req.throwable()).asString()
),
HttpURLConnection.HTTP_INTERNAL_ERROR
)
);
}
)
);
}
示例8: regex
import org.takes.tk.TkClasspath; //导入依赖的package包/类
/**
* Regex takes.
* @param base Base
* @return Takes
* @throws IOException If fails
*/
private static Take regex(final Base base) throws IOException {
return new TkFork(
new FkRegex("/robots.txt", ""),
new FkRegex(
"/org/takes/.+\\.xsl",
new TkClasspath()
),
new FkRegex(
"/xsl/[a-z\\-]+\\.xsl",
new TkWithType(
TkApp.refresh("./src/main/xsl"),
"text/xsl"
)
),
new FkRegex(
"/css/[a-z]+\\.css",
new TkWithType(
TkApp.refresh("./src/main/scss"),
"text/css"
)
),
new FkRegex(
"/images/[a-z]+\\.svg",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/svg+xml"
)
),
new FkRegex(
"/images/[a-z]+\\.png",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/png"
)
),
new FkAnonymous(
new TkFork(
new FkRegex("/", new TkIndex(base))
)
),
new FkAuthenticated(
new TkSecure(
new TkFork(
new FkRegex("/", new TkEvents(base)),
new FkRegex("/favicon", new TkFavicon(base)),
new FkRegex("/pipes", new TkPipes(base)),
new FkRegex("/pipe-add", new TkPipeAdd(base)),
new FkRegex("/pipe-delete", new TkPipeDelete(base)),
new FkRegex("/event-delete", new TkEventDelete(base)),
new FkRegex("/event-down", new TkEventDown(base))
)
)
)
);
}