Search in sources :

Example 1 with OrchidResponse

use of com.eden.orchid.server.api.OrchidResponse in project Orchid by JavaEden.

the class AdminController method renderList.

@Get(path = "/lists/:name")
public OrchidResponse renderList(OrchidRequest request, String name) {
    Clog.v("calling /admin/lists/:name");
    OrchidResource resource = resources.getResourceEntry("templates/server/admin/lists/" + name + ".twig");
    if (resource != null) {
        JSONObject data = new JSONObject();
        data.put("httpServerPort", server.get().getHttpServerPort());
        data.put("websocketPort", server.get().getWebsocketPort());
        data.put(name, getList(name));
        return new OrchidResponse(context.getTheme().compile(resource.getReference().getExtension(), resource.getContent(), data));
    }
    return new OrchidResponse("List not found");
}
Also used : JSONObject(org.json.JSONObject) OrchidResponse(com.eden.orchid.server.api.OrchidResponse) OrchidResource(com.eden.orchid.api.resources.resource.OrchidResource) Get(com.eden.orchid.server.api.methods.Get)

Example 2 with OrchidResponse

use of com.eden.orchid.server.api.OrchidResponse in project Orchid by JavaEden.

the class AdminController method doNothing.

@Get(path = "/")
public OrchidResponse doNothing(OrchidRequest request) {
    Clog.v("calling /admin");
    OrchidResource resource = resources.getResourceEntry("templates/server/admin/admin.twig");
    String content = "";
    if (resource != null) {
        JSONObject data = new JSONObject();
        data.put("httpServerPort", server.get().getHttpServerPort());
        data.put("websocketPort", server.get().getWebsocketPort());
        content = context.getTheme().compile(resource.getReference().getExtension(), resource.getContent(), data);
    }
    return new OrchidResponse(content);
}
Also used : JSONObject(org.json.JSONObject) OrchidResponse(com.eden.orchid.server.api.OrchidResponse) OrchidResource(com.eden.orchid.api.resources.resource.OrchidResource) Get(com.eden.orchid.server.api.methods.Get)

Example 3 with OrchidResponse

use of com.eden.orchid.server.api.OrchidResponse in project Orchid by JavaEden.

the class ApiController method doNothing.

@Get(path = "/")
public OrchidResponse doNothing(OrchidRequest request) {
    Clog.v("calling /api");
    JSONObject object = new JSONObject();
    object.put("message", "Successful API hit");
    return new OrchidResponse(object);
}
Also used : JSONObject(org.json.JSONObject) OrchidResponse(com.eden.orchid.server.api.OrchidResponse) Get(com.eden.orchid.server.api.methods.Get)

Aggregations

OrchidResponse (com.eden.orchid.server.api.OrchidResponse)3 Get (com.eden.orchid.server.api.methods.Get)3 JSONObject (org.json.JSONObject)3 OrchidResource (com.eden.orchid.api.resources.resource.OrchidResource)2