use of co.cask.cdap.common.MethodNotAllowedException in project cdap by caskdata.
the class ProgramLifecycleHttpHandler method programSpecification.
@GET
@Path("/apps/{app-name}/versions/{app-version}/{program-type}/{program-name}")
public void programSpecification(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-name") String appName, @PathParam("app-version") String appVersion, @PathParam("program-type") String type, @PathParam("program-name") String programName) throws Exception {
ProgramType programType = getProgramType(type);
if (programType == null) {
throw new MethodNotAllowedException(request.getMethod(), request.getUri());
}
ApplicationId application = new ApplicationId(namespaceId, appName, appVersion);
ProgramId programId = application.program(programType, programName);
ProgramSpecification specification = lifecycleService.getProgramSpecification(programId);
if (specification == null) {
throw new NotFoundException(programId);
}
responder.sendJson(HttpResponseStatus.OK, specification);
}
Aggregations