diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java index 15ea897589..2b4c02603a 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java @@ -410,6 +410,47 @@ public class RepositoryResource return response; } + /** + * Returns a repository.
+ *
+ * Status codes: + * + * + * @param request the current request + * @param type the type of the repository + * @param name the name of the repository + * + * @return the {@link Repository} with the specified type and name + */ + @GET + @Path("{type}/{name}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @TypeHint(Repository.class) + public Response getByTypeAndName(@Context Request request, + @PathParam("type") String type, + @PathParam("name") String name) + { + Response response = null; + Repository repository = repositoryManager.get(type, name); + + if (repository != null) + { + prepareForReturn(repository); + response = Response.ok(repository).build(); + } + else + { + response = Response.status(Response.Status.NOT_FOUND).build(); + } + + return response; + } + /** * Returns a list of {@link Changeset} for the given repository.
*