本文整理汇总了Java中org.wisdom.api.annotations.Route类的典型用法代码示例。如果您正苦于以下问题:Java Route类的具体用法?Java Route怎么用?Java Route使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Route类属于org.wisdom.api.annotations包,在下文中一共展示了Route类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: upload
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.POST, uri = "/uploading")
public Result upload() throws IOException {
String cookie = context().cookieValue("token");
for(Session session : coreServerController.getOpenSessionList()) {
if(session.getToken().toString().equalsIgnoreCase(cookie)){
if(!context().files().isEmpty()){
for (FileItem fileItem : context().files()) {
if(fileItem!=null){
byte[] buffer = new byte[8 * 1024];
FileOutputStream out = new FileOutputStream(new File(session.getWorkspaceFolder(),
fileItem.name()));
BufferedInputStream in = new BufferedInputStream(fileItem.stream());
while (in.read(buffer) != -1) {
out.write(buffer);
}
in.close();
out.close();
}
}
}
return ok();
}
}
return badRequest(render(homeContent));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:27,代码来源:MainController.java
示例2: settings
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/user/settings")
public Result settings() {
String token = context().cookieValue("token");
Session session = null;
for(Session s : coreServerController.getOpenSessionList()){
if(s.getToken().toString().equals(token)){
session = s;
}
}
if(session != null) {
return ok(render(userSettings, "session", session));
}
else {
return badRequest("Unexisting session.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:17,代码来源:MainController.java
示例3: database
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/data/database")
public Result database() {
String token = context().cookieValue("token");
Session session = null;
for(Session s : coreServerController.getOpenSessionList()){
if(s.getToken().toString().equals(token)){
session = s;
}
}
if(session != null) {
DatabaseContent dbContent = session.getDatabaseContent();
int maxSize = 0;
for(DatabaseTable dbTable : dbContent.getTableList()){
maxSize = Math.max(maxSize, dbTable.getFieldList().size()+1);
}
return ok(render(databaseView,
"databaseContent", dbContent,
"cell_width_percent", (float)(100)/maxSize));
}
else {
return badRequest("Unexisting session.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:24,代码来源:MainController.java
示例4: createArchive
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/createArchive")
public Result createArchive(@Parameter("jobId") String jobId) {
String token = context().cookieValue("token");
Session session = null;
for(Session s : coreServerController.getOpenSessionList()){
if(s.getToken().toString().equals(token)){
session = s;
}
}
if(session != null) {
File file = session.getResultAchive(jobId);
if(file != null) {
return ok(file, true);
}
return badRequest("Unable to create the result archive.");
}
else{
return badRequest("Unexisting session.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:21,代码来源:MainController.java
示例5: threads
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
/**
* @return information about threads.
*/
@Route(method = HttpMethod.GET, uri = "/threads")
public Result threads() {
ArrayNode array = json.newArray();
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
for (long id : bean.getAllThreadIds()) {
ObjectNode node = json.newObject();
ThreadInfo ti = bean.getThreadInfo(id, 10);
node
.put("threadName", ti.getThreadName())
.put("threadId", ti.getThreadId())
.put("blockedTime", ti.getBlockedTime())
.put("blockedCount", ti.getBlockedCount())
.put("lockName", ti.getLockName())
.put("waitedTime", ti.getWaitedTime())
.put("waitedCount", ti.getWaitedCount())
.put("threadState", ti.getThreadState().toString())
.put("stack", stack(ti.getStackTrace()));
array.add(node);
}
return ok(array);
}
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:25,代码来源:DashboardExtension.java
示例6: authenticate
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
/**
* Authenticates the user.
*
* @param username the username
* @param password the password
* @return the default page if the authentication succeed, the login page otherwise.
*/
@Route(method = HttpMethod.POST, uri = "/monitor/login")
public Result authenticate(@FormParameter("username") String username, @FormParameter("password") String password) {
if (!configuration.getBooleanWithDefault("monitor.auth.enabled", true)) {
// If the authentication is disabled, just jump to the dashboard page.
return dashboard();
}
final String name = configuration.getOrDie("monitor.auth.username");
final String pwd = configuration.getOrDie("monitor.auth.password");
if (name.equals(username) && pwd.equals(password)) {
session().put("wisdom.monitor.username", username);
logger().info("Authentication successful - {}", username);
return dashboard();
} else {
logger().info("Authentication failed - {}", username);
context().flash().error("Authentication failed - check your credentials");
return login();
}
}
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:28,代码来源:MonitorCenter.java
示例7: index
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
/**
* Serves the asset list page, or a JSON form depending on the {@literal ACCEPT} header.
* @return the page, the json form or a bad request. Bad request are returned in "PROD" mode.
*/
@Route(method = HttpMethod.GET, uri = "/assets")
public Result index() {
if (configuration.isProd()) {
// Dumping assets is not enabled in PROD mode,
// returning a bad request result
return badRequest("Sorry, no asset dump in PROD mode.");
}
if (cache.isEmpty() || NOCACHE_VALUE.equalsIgnoreCase(context().header(CACHE_CONTROL))) {
// Refresh the cache.
all();
}
return Negotiation.accept(ImmutableMap.of(
MimeTypes.HTML, ok(render(template, "assets", cache)),
MimeTypes.JSON, ok(cache).json()
));
}
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:23,代码来源:AssetsSingleton.java
示例8: getControllers
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
/**
* @return the JSON structure read by the HTML page.
*/
@Route(method = HttpMethod.GET, uri = "/monitor/controllers/controllers")
public Result getControllers() {
ObjectNode node = json.newObject();
ArrayNode array = json.newArray();
for (org.wisdom.api.Controller controller : controllers) {
array.add(ControllerModel.from(controller, router, json));
}
for (InstanceDescription description : getInvalidControllers()) {
array.add(ControllerModel.from(description, json));
}
node.put("controllers", array);
node.put("invalid", getInvalidControllers().size());
return ok(node);
}
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:22,代码来源:ControllerExtension.java
示例9: login
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.POST, uri = "/login")
@Async
public Result login() throws IOException {
String urlContent = URLDecoder.decode(context().reader().readLine(), "UTF-8");
String[] split = urlContent.split("&");
Session session = coreServerController.getSession(split[0].replaceAll(".*=", ""),
split[1].replaceAll(".*=", ""));
if(session != null) {
return ok(session.getToken().toString());
}
else {
return badRequest("Unrecognized credits.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:15,代码来源:MainController.java
示例10: describeProcess
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/describeProcess")
public Result describeProcess(@Parameter("id") String id) throws IOException {
String token = context().cookieValue("token");
Session session = null;
for(Session s : coreServerController.getOpenSessionList()) {
if (s.getToken().toString().equals(token)) {
session = s;
Operation op = session.getOperation(id);
return ok(render(describeProcess, "operation", op, "session", session));
}
}
return badRequest(render(homeContent));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:14,代码来源:MainController.java
示例11: execute
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.POST, uri = "/execute")
public Result execute() throws IOException {
for(Session session : coreServerController.getOpenSessionList()) {
String urlContent = URLDecoder.decode(context().reader().readLine(), "UTF-8");
String[] split = urlContent.split("&");
String token = context().cookieValue("token");
if (session.getToken().toString().equals(token)) {
Map<String, String> inputData = new HashMap<>();
String id = "";
for (String str : split) {
String[] val = str.split("=");
if (val[0].equals("processId")) {
id = val[1];
} else {
if (val.length == 1) {
inputData.put(val[0], "");
} else {
inputData.put(val[0], val[1]);
}
}
}
session.executeOperation(id, inputData);
return ok();
}
}
return badRequest();
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:28,代码来源:MainController.java
示例12: signIn
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.POST, uri = "/register")
public Result signIn() throws IOException {
String urlContent = URLDecoder.decode(context().reader().readLine(), "UTF-8");
String[] split = urlContent.split("&");
Session session = coreServerController.createSession(split[0].replaceAll(".*=", ""),
split[1].replaceAll(".*=", ""));
if(session != null) {
return ok(session.getToken().toString());
}
else {
return badRequest("Can not create user.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:14,代码来源:MainController.java
示例13: data
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/data")
public Result data() {
String token = context().cookieValue("token");
for (Session session : coreServerController.getOpenSessionList()) {
if (session.getToken().toString().equals(token)) {
return ok(render(data));
}
}
return badRequest(render(data));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:11,代码来源:MainController.java
示例14: dataLeftNav
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/dataleftnav")
public Result dataLeftNav() {
String token = context().cookieValue("token");
for (Session session : coreServerController.getOpenSessionList()) {
if (session.getToken().toString().equals(token)) {
return ok(render(dataLeftNav));
}
}
return badRequest(render(data));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:11,代码来源:MainController.java
示例15: process
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/process")
public Result process() {
String token = context().cookieValue("token");
for(Session session : coreServerController.getOpenSessionList()) {
if (session.getToken().toString().equals(token)) {
return ok(render(process));
}
}
return badRequest(render(process));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:11,代码来源:MainController.java
示例16: leftNavContent
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/process/leftNavContent")
public Result leftNavContent() {
String token = context().cookieValue("token");
for(Session session : coreServerController.getOpenSessionList()) {
if (session.getToken().toString().equals(token)) {
return ok(render(leftNavContent));
}
}
return badRequest(render(process));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:11,代码来源:MainController.java
示例17: user
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/user")
public Result user() {
String token = context().cookieValue("token");
for(Session session : coreServerController.getOpenSessionList()) {
if (session.getToken().toString().equals(token)) {
return ok(render(user, "session", session));
}
}
return ok(render(user, "session", null));
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:11,代码来源:MainController.java
示例18: changePwd
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.POST, uri = "/user/changePwd")
public Result changePwd() throws IOException {
String urlContent = URLDecoder.decode(context().reader().readLine(), "UTF-8");
String newPassword = "";
String newPasswordRepeat = null;
String token = null;
String[] split = urlContent.split("&");
for(String argument : split){
String[] splitArg = argument.split("=");
switch (splitArg[0]) {
case "pwd":
newPassword = splitArg[1];
break;
case "pwd_repeat":
newPasswordRepeat = splitArg[1];
break;
case "token":
token = splitArg[1];
break;
}
}
if(newPassword.equals(newPasswordRepeat) && token != null) {
coreServerController.changePassword(token, newPassword);
return ok("Password changed.");
}
else{
return badRequest("The two passwords are not the same.");
}
}
开发者ID:totone56,项目名称:orbis-lps2ima-dev,代码行数:30,代码来源:MainController.java
示例19: listDb
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.GET, uri = "/db")
@Async
public Result listDb() throws UnirestException {
final HttpResponse<JsonNode> jsonNodeHttpResponse = Unirest.get("http://127.0.0.1:5984/_all_dbs").asJson();
final JSONArray array = jsonNodeHttpResponse.getBody().getArray();
final com.fasterxml.jackson.databind.JsonNode jsonNode = json.parse(array.toString());
return ok(jsonNode);
}
开发者ID:mackristof,项目名称:follow-me-wisdom,代码行数:10,代码来源:WelcomeController.java
示例20: createDb
import org.wisdom.api.annotations.Route; //导入依赖的package包/类
@Route(method = HttpMethod.PUT, uri = "/db/{database}")
@Async
public Result createDb(@PathParameter("database") String database){
Result wisdomResult = new Result();
//"http://localhost:5984/"+database)
return wisdomResult;
}
开发者ID:mackristof,项目名称:follow-me-wisdom,代码行数:9,代码来源:WelcomeController.java
注:本文中的org.wisdom.api.annotations.Route类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论