use of javax.ws.rs.GET in project che by eclipse.
the class WorkspaceService method getByKey.
@GET
@Path("/{key:.*}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Get the workspace by the composite key", notes = "Composite key can be just workspace ID or in the " + "namespace:workspace_name form, where namespace is optional (e.g :workspace_name is valid key too." + "namespace/workspace_name form, where namespace can contain '/' character.")
@ApiResponses({ @ApiResponse(code = 200, message = "The response contains requested workspace entity"), @ApiResponse(code = 404, message = "The workspace with specified id does not exist"), @ApiResponse(code = 403, message = "The user is not workspace owner"), @ApiResponse(code = 500, message = "Internal server error occurred") })
public WorkspaceDto getByKey(@ApiParam(value = "Composite key", examples = @Example({ @ExampleProperty("workspace12345678"), @ExampleProperty("namespace/workspace_name"), @ExampleProperty("namespace_part_1/namespace_part_2/workspace_name") })) @PathParam("key") String key) throws NotFoundException, ServerException, ForbiddenException, BadRequestException {
validateKey(key);
final WorkspaceImpl workspace = workspaceManager.getWorkspace(key);
return linksInjector.injectLinks(asDto(workspace), getServiceContext());
}
use of javax.ws.rs.GET in project che by eclipse.
the class RecipeService method getRecipeScript.
@GET
@Path("/{id}/script")
public Response getRecipeScript(@PathParam("id") String id) throws ApiException, UnsupportedEncodingException {
// Do not remove!
// Docker can not use dockerfile in some cases without content-length header.
final ManagedRecipe recipe = recipeDao.getById(id);
byte[] script = recipe.getScript().getBytes("UTF-8");
return Response.ok(script, MediaType.TEXT_PLAIN).header(HttpHeaders.CONTENT_LENGTH, script.length).build();
}
use of javax.ws.rs.GET in project druid by druid-io.
the class WorkerResource method isEnabled.
@GET
@Path("/enabled")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(StateResourceFilter.class)
public Response isEnabled() {
try {
final Worker theWorker = curatorCoordinator.getWorker();
final boolean enabled = !theWorker.getVersion().equalsIgnoreCase(DISABLED_VERSION);
return Response.ok(ImmutableMap.of(theWorker.getHost(), enabled)).build();
} catch (Exception e) {
return Response.serverError().build();
}
}
use of javax.ws.rs.GET in project che by eclipse.
the class DebuggerService method getDebugSession.
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public DebugSessionDto getDebugSession(@PathParam("id") String sessionId) throws DebuggerException {
DebuggerInfo debuggerInfo = debuggerManager.getDebugger(sessionId).getInfo();
DebugSessionDto debugSessionDto = newDto(DebugSessionDto.class);
debugSessionDto.setDebuggerInfo(asDto(debuggerInfo));
debugSessionDto.setId(sessionId);
debugSessionDto.setType(debuggerManager.getDebuggerType(sessionId));
return debugSessionDto;
}
use of javax.ws.rs.GET in project che by eclipse.
the class TestingService method run.
/**
* Execute the Java test cases and return the test result.
*
* <pre>
* Required request parameters.
* <em>projectPath</em> : Relative path to the project directory.
* <em>testFramework</em> : Name of the test framework where the tests should be run on. This should match with
* the name returned by {@link TestRunner#getName()} implementation.
* </pre>
*
* @param uriInfo
* JAX-RS implementation of UrlInfo with set of query parameters.
* @return the test result of test case
* @throws Exception
* when the test runner failed to execute test cases.
*/
@GET
@Path("run")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Execute Java tests and return results", notes = "The GET parameters are passed to the test framework implementation.")
@ApiResponses({ @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 500, message = "Server error") })
public TestResult run(@Context UriInfo uriInfo) throws Exception {
Map<String, String> queryParameters = getMap(uriInfo.getQueryParameters());
String projectPath = queryParameters.get("projectPath");
String absoluteProjectPath = ResourcesPlugin.getPathToWorkspace() + projectPath;
queryParameters.put("absoluteProjectPath", absoluteProjectPath);
String testFramework = queryParameters.get("testFramework");
TestRunner runner = frameworkRegistry.getTestRunner(testFramework);
if (runner == null) {
throw new Exception("No test frameworks found: " + testFramework);
}
TestResult result = frameworkRegistry.getTestRunner(testFramework).execute(queryParameters);
return result;
}
Aggregations