Search in sources :

Example 1 with JString

use of com.entwinemedia.fn.data.json.JString in project opencast by opencast.

the class BaseEndpoint method getEndpointInfo.

@GET
@Path("")
@Produces({ "application/json", "application/v1.0.0+json" })
@RestQuery(name = "getendpointinfo", description = "Returns key characteristics of the API such as the server name and the default version.", returnDescription = "", reponses = { @RestResponse(description = "The api information is returned.", responseCode = HttpServletResponse.SC_OK) })
public Response getEndpointInfo() {
    Organization organization = securityService.getOrganization();
    String orgExternalAPIUrl = organization.getProperties().get(OpencastConstants.EXTERNAL_API_URL_ORG_PROPERTY);
    JString url;
    if (StringUtils.isNotBlank(orgExternalAPIUrl)) {
        url = v(orgExternalAPIUrl);
    } else {
        url = v(endpointBaseUrl);
    }
    JValue json = obj(f("url", url), f("version", v(ApiVersion.CURRENT_VERSION.toString())));
    return RestUtil.R.ok(MediaType.APPLICATION_JSON_TYPE, serializer.toJson(json));
}
Also used : Organization(org.opencastproject.security.api.Organization) JValue(com.entwinemedia.fn.data.json.JValue) JString(com.entwinemedia.fn.data.json.JString) JString(com.entwinemedia.fn.data.json.JString) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) RestQuery(org.opencastproject.util.doc.rest.RestQuery)

Aggregations

JString (com.entwinemedia.fn.data.json.JString)1 JValue (com.entwinemedia.fn.data.json.JValue)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Organization (org.opencastproject.security.api.Organization)1 RestQuery (org.opencastproject.util.doc.rest.RestQuery)1