use of javax.ws.rs.PathParam in project indy by Commonjava.
the class DeprecatedFoloContentAccessResource method doCreate.
@ApiOperation("Store and track file/artifact content under the given artifact store (type/name) and path.")
@ApiResponses({ @ApiResponse(code = 201, message = "Content was stored successfully"), @ApiResponse(code = 400, message = "No appropriate storage location was found in the specified store (this store, or a member if a group is specified).") })
@PUT
@Path("/{path: (.*)}")
public Response doCreate(@ApiParam("User-assigned tracking session key") @PathParam("id") final String id, @ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @PathParam("name") final String name, @PathParam("path") final String path, @Context final HttpServletRequest request, @Context final UriInfo uriInfo) {
final TrackingKey tk = new TrackingKey(id);
EventMetadata metadata = new EventMetadata().set(TRACKING_KEY, tk).set(ACCESS_CHANNEL, AccessChannel.MAVEN_REPO);
final Supplier<URI> uriSupplier = () -> uriInfo.getBaseUriBuilder().path(getClass()).path(path).build(id, type, name);
final Consumer<Response.ResponseBuilder> deprecation = builder -> {
String alt = Paths.get("/api/folo/track/", id, MAVEN_PKG_KEY, type, name, path).toString();
responseHelper.markDeprecated(builder, alt);
};
return handler.doCreate(MAVEN_PKG_KEY, type, name, path, request, metadata, uriSupplier, deprecation);
}
use of javax.ws.rs.PathParam in project indy by Commonjava.
the class DeprecatedContentAccessResource method doDelete.
@ApiOperation("Delete file/artifact content under the given artifact store (type/name) and path.")
@ApiResponses({ @ApiResponse(code = 404, message = "Content is not available"), @ApiResponse(code = 204, message = "Content was deleted successfully") })
@DELETE
@Path("/{path: (.*)}")
public Response doDelete(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam(required = true) @PathParam("name") final String name, @PathParam("path") final String path) {
String packageType = MavenPackageTypeDescriptor.MAVEN_PKG_KEY;
final Consumer<Response.ResponseBuilder> deprecated = builder -> {
String alt = Paths.get("/api/maven", type, name, path).toString();
responseHelper.markDeprecated(builder, alt);
};
return handler.doDelete(packageType, type, name, path, new EventMetadata(), deprecated);
}
use of javax.ws.rs.PathParam in project indy by Commonjava.
the class DeprecatedContentAccessResource method doGet.
@ApiOperation("Retrieve root listing under the given artifact store (type/name).")
@ApiResponses({ @ApiResponse(code = 200, response = String.class, message = "Rendered root content listing"), @ApiResponse(code = 200, response = StreamingOutput.class, message = "Content stream") })
@GET
@Path("/")
public Response doGet(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam(required = true) @PathParam("name") final String name, @Context final UriInfo uriInfo, @Context final HttpServletRequest request) {
String packageType = MavenPackageTypeDescriptor.MAVEN_PKG_KEY;
final String baseUri = uriInfo.getBaseUriBuilder().path(IndyDeployment.API_PREFIX).build().toString();
final Consumer<Response.ResponseBuilder> deprecated = builder -> {
String alt = Paths.get("/api/maven", type, name).toString();
responseHelper.markDeprecated(builder, alt);
};
return handler.doGet(packageType, type, name, "", baseUri, request, new EventMetadata(), deprecated);
}
use of javax.ws.rs.PathParam in project verify-hub by alphagov.
the class CertificatesResource method getEncryptionCertificate.
@GET
@Path(Urls.ConfigUrls.ENCRYPTION_CERTIFICATE_PATH)
@Timed
public CertificateDto getEncryptionCertificate(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId) {
try {
Certificate certificate = certificateService.encryptionCertificateFor(entityId);
Optional<String> base64Encoded = certificate.getBase64Encoded();
return certificate.getBase64Encoded().map(base64 -> aCertificateDto(entityId, base64Encoded.get(), CertificateDto.KeyUse.Encryption, certificate.getFederationEntityType())).orElseThrow(() -> exceptionFactory.createNoDataForEntityException(entityId));
} catch (NoCertificateFoundException ncfe) {
throw exceptionFactory.createNoDataForEntityException(entityId);
} catch (CertificateDisabledException cde) {
throw exceptionFactory.createDisabledTransactionException(entityId);
}
}
use of javax.ws.rs.PathParam in project cxf by apache.
the class JAXRSContainerTest method checkComplexPathMethod.
private void checkComplexPathMethod(Method m, String suffix) {
assertNotNull(m.getAnnotation(GET.class));
Path path = m.getAnnotation(Path.class);
assertNotNull(path);
assertEquals("/get-add-method", path.value());
assertEquals("getGetaddmethod" + suffix, m.getName());
Class<?>[] paramTypes = m.getParameterTypes();
assertEquals(1, paramTypes.length);
Annotation[][] paramAnns = m.getParameterAnnotations();
assertEquals(String.class, paramTypes[0]);
assertEquals(1, paramAnns[0].length);
PathParam methodPathParam1 = (PathParam) paramAnns[0][0];
assertEquals("id", methodPathParam1.value());
}
Aggregations