Search in sources :

Example 1 with GET

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());
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 2 with GET

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();
}
Also used : ManagedRecipe(org.eclipse.che.api.machine.shared.ManagedRecipe) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 3 with GET

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();
    }
}
Also used : Worker(io.druid.indexing.worker.Worker) IOException(java.io.IOException) Path(javax.ws.rs.Path) ResourceFilters(com.sun.jersey.spi.container.ResourceFilters) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 4 with GET

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;
}
Also used : DebuggerInfo(org.eclipse.che.api.debug.shared.model.DebuggerInfo) DebugSessionDto(org.eclipse.che.api.debug.shared.dto.DebugSessionDto) Path(javax.ws.rs.Path) VariablePath(org.eclipse.che.api.debug.shared.model.VariablePath) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 5 with GET

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;
}
Also used : TestRunner(org.eclipse.che.api.testing.server.framework.TestRunner) TestResult(org.eclipse.che.api.testing.shared.TestResult) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

GET (javax.ws.rs.GET)3467 Path (javax.ws.rs.Path)2921 Produces (javax.ws.rs.Produces)2414 ApiOperation (io.swagger.annotations.ApiOperation)709 ApiResponses (io.swagger.annotations.ApiResponses)558 ArrayList (java.util.ArrayList)468 IOException (java.io.IOException)344 Response (javax.ws.rs.core.Response)342 WebApplicationException (javax.ws.rs.WebApplicationException)335 Consumes (javax.ws.rs.Consumes)267 HashMap (java.util.HashMap)242 List (java.util.List)231 URI (java.net.URI)202 Map (java.util.Map)202 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)196 Timed (com.codahale.metrics.annotation.Timed)195 TimedResource (org.killbill.commons.metrics.TimedResource)121 TenantContext (org.killbill.billing.util.callcontext.TenantContext)117 MediaType (javax.ws.rs.core.MediaType)113 ApiResponse (io.swagger.annotations.ApiResponse)111