本文整理汇总了Java中javax.ws.rs.PathParam类的典型用法代码示例。如果您正苦于以下问题:Java PathParam类的具体用法?Java PathParam怎么用?Java PathParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathParam类属于javax.ws.rs包,在下文中一共展示了PathParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeLogLevel
import javax.ws.rs.PathParam; //导入依赖的package包/类
@PUT
@Path("/log/change-level/{loggerName}/{newLevel}")
public Response changeLogLevel(@PathParam("loggerName") String loggerName,
@PathParam("newLevel") String newLevel) {
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(loggerName);
if (loggerConfig.getName().equals(LogManager.ROOT_LOGGER_NAME)) {
return Response.ok("Not found", MediaType.TEXT_PLAIN).build();
}
loggerConfig.setLevel(Level.valueOf(newLevel));
ctx.updateLoggers(); // This causes all Loggers to refetch information from their LoggerConfig.
return Response.ok("Done", MediaType.TEXT_PLAIN).build();
}
示例2: save
import javax.ws.rs.PathParam; //导入依赖的package包/类
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{projectName}/statuses/{commit}")
@POST
public Response save(@PathParam("projectName") String projectName, @PathParam("commit") String commit,
Map<String, String> commitStatus, @Context UriInfo uriInfo) {
Project project = getProject(projectName);
if (!SecurityUtils.canWrite(project))
throw new UnauthorizedException();
String state = commitStatus.get("state").toUpperCase();
if (state.equals("PENDING"))
state = "RUNNING";
Verification verification = new Verification(Verification.Status.valueOf(state),
new Date(), commitStatus.get("description"), commitStatus.get("target_url"));
String context = commitStatus.get("context");
if (context == null)
context = "default";
verificationManager.saveVerification(project, commit, context, verification);
UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
uriBuilder.path(context);
commitStatus.put("id", "1");
return Response.created(uriBuilder.build()).entity(commitStatus).type(RestConstants.JSON_UTF8).build();
}
示例3: getProduct
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("/products/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response getProduct(@PathParam("id") Long id) {
return getProductStore().get(id).map(p -> Response.ok(p).build())
.orElse(Response.status(Status.NOT_FOUND).build());
}
示例4: createApplianceSoftwareVersion
import javax.ws.rs.PathParam; //导入依赖的package包/类
@ApiOperation(value = "Creates a new appliance software version for a software function model",
notes = "Creates a new appliance software version for a software function model",
response = BaseResponse.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
@ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{applianceId}/versions")
@POST
public Response createApplianceSoftwareVersion(@Context HttpHeaders headers,
@ApiParam(value = "Id of the Appliance Model", required = true) @PathParam("applianceId") Long applianceId, @ApiParam(required = true) ApplianceSoftwareVersionDto asvDto) {
logger.info("Creating an Appliance Software Version");
this.userContext.setUser(OscAuthFilter.getUsername(headers));
this.apiUtil.setIdAndParentIdOrThrow(asvDto, null, applianceId, "Appliance Sofftware Version");
return this.apiUtil.getResponseForBaseRequest(this.addApplianceSoftwareVersionService, new BaseRequest<ApplianceSoftwareVersionDto>(asvDto));
}
示例5: getPlanAsHtml
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("{planId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlanAsHtml(
@PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId
) throws ServletException, IOException, URISyntaxException
{
// Start of user code getPlanAsHtml_init
// End of user code
final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId);
if (aPlan != null) {
httpServletRequest.setAttribute("aPlan", aPlan);
// Start of user code getPlanAsHtml_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例6: deletePerson
import javax.ws.rs.PathParam; //导入依赖的package包/类
@DELETE
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Person deletePerson(@PathParam("id") String id) {
Person PersonResponse = Person_Service.deletePerson(id);
return PersonResponse;
}
示例7: getPlaceAsHtml
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("places/{placeId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlaceAsHtml(
@PathParam("serviceProviderId") final String serviceProviderId, @PathParam("placeId") final String placeId
) throws ServletException, IOException, URISyntaxException
{
// Start of user code getPlaceAsHtml_init
// End of user code
final Place aPlace = WarehouseControllerManager.getPlace(httpServletRequest, serviceProviderId, placeId);
if (aPlace != null) {
httpServletRequest.setAttribute("aPlace", aPlace);
// Start of user code getPlaceAsHtml_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/place.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例8: getNestedLRAStatus
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("{NestedLraId}/status")
public Response getNestedLRAStatus(@PathParam("NestedLraId")String nestedLraId) {
if (!lraService.hasTransaction(nestedLraId)) {
// it must have compensated TODO maybe it's better to keep nested LRAs in separate collection
return Response.ok(CompensatorStatus.Compensated.name()).build();
}
Transaction lra = lraService.getTransaction(toURL(nestedLraId));
CompensatorStatus status = lra.getLRAStatus();
if (status == null || lra.getLRAStatus() == null) {
LRALogger.i18NLogger.error_cannotGetStatusOfNestedLra(nestedLraId, lra.getId());
throw new IllegalLRAStateException(nestedLraId, "The LRA is still active", "getNestedLRAStatus");
}
return Response.ok(lra.getLRAStatus().name()).build();
}
示例9: getLog
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("/{file}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get Presto log file")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Retrieved logs"),
@ApiResponse(code = 400, message = "Invalid parameters"),
@ApiResponse(code = 404, message = "Resource not found")})
public Response getLog(
@PathParam("file") @ApiParam("The name of a file") String file,
@QueryParam("from") @ApiParam("Ignore logs before this date") Instant fromDate,
@QueryParam("to") @ApiParam("Ignore logs after this date") Instant toDate,
@QueryParam("level") @ApiParam("Only get logs of this level") @DefaultValue(LogsHandler.DEFAULT_LOG_LEVEL) String level,
@QueryParam("n") @ApiParam("The maximum number of log entries to get") Integer maxEntries)
{
return logsHandler.getLogs(file, fromDate, toDate, level, maxEntries);
}
示例10: update
import javax.ws.rs.PathParam; //导入依赖的package包/类
/**
* Update a named token with a new generated one.
*
* @param name
* Token to update.
* @return the new generated token.
*/
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("{name:[\\w\\-\\.]+}")
public String update(@PathParam("name") final String name) throws GeneralSecurityException {
final SystemApiToken entity = repository.findByUserAndName(securityHelper.getLogin(), name);
if (entity == null) {
// No token with given name
throw new EntityNotFoundException();
}
// Token has been found, update it
final String token = newToken(entity);
repository.saveAndFlush(entity);
return token;
}
示例11: saveFormatSettings
import javax.ws.rs.PathParam; //导入依赖的package包/类
@PUT
@Path("file_format/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path)
throws FileNotFoundException, HomeNotFoundException, NamespaceException {
FilePath filePath = FilePath.fromURLPath(homeName, path);
// merge file configs
final DatasetConfig existingDSConfig = namespaceService.getDataset(filePath.toNamespaceKey());
final FileConfig oldConfig = toFileConfig(existingDSConfig);
final FileConfig newConfig = fileFormat.asFileConfig();
newConfig.setCtime(oldConfig.getCtime());
newConfig.setFullPathList(oldConfig.getFullPathList());
newConfig.setName(oldConfig.getName());
newConfig.setOwner(oldConfig.getOwner());
newConfig.setLocation(oldConfig.getLocation());
catalogService.createOrUpdateDataset(namespaceService, new NamespaceKey(HomeFileConfig.HOME_PLUGIN_NAME), filePath.toNamespaceKey(), toDatasetConfig(newConfig, DatasetType.PHYSICAL_DATASET_HOME_FILE,
securityContext.getUserPrincipal().getName(), existingDSConfig.getId()));
return new FileFormatUI(FileFormat.getForFile(newConfig), filePath);
}
示例12: deleteApplianceSoftwareVersion
import javax.ws.rs.PathParam; //导入依赖的package包/类
@ApiOperation(value = "Deletes a Security Function Software Version",
notes = "Deletes a Security Function Software Version if not referenced by any Distributed Appliances")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"),
@ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) })
@Path("/{applianceId}/versions/{ApplianceSoftwareVersionId}")
@DELETE
public Response deleteApplianceSoftwareVersion(@Context HttpHeaders headers,
@ApiParam(value = "Id of the Appliance Model", required = true) @PathParam("applianceId") Long applianceId,
@ApiParam(value = "Id of the Appliance Software Version",
required = true) @PathParam("ApplianceSoftwareVersionId") Long applianceSoftwareVersionId) {
logger.info(
"Deleting Appliance Software Version " + applianceSoftwareVersionId + " from appliance " + applianceId);
this.userContext.setUser(OscAuthFilter.getUsername(headers));
return this.apiUtil.getResponseForBaseRequest(this.deleteApplianceSoftwareVersionService,
new BaseIdRequest(applianceSoftwareVersionId, applianceId));
}
示例13: getResourceShapeAsHtml
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Path("{resourceShapePath}")
@Produces({ MediaType.TEXT_HTML })
public Response getResourceShapeAsHtml(
@PathParam("resourceShapePath") final String resourceShapePath
) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
{
final Class<?> resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath);
ResourceShape aResourceShape = null;
if (resourceClass != null)
{
aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null);
httpServletRequest.setAttribute("aResourceShape", aResourceShape);
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/resourceshape.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例14: findRecentRegionProductType
import javax.ws.rs.PathParam; //导入依赖的package包/类
@GET
@Produces({"application/xml", "application/json"})
@Path("/recent/region/producttype/{regionName}/{productTypeId}")
public List<LiveSalesList> findRecentRegionProductType(@PathParam("regionName") String regionName, @PathParam("productTypeId") Integer productTypeId) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
javax.persistence.criteria.CriteriaQuery cq = cb.createQuery();
Root<LiveSalesList> liveSalesList = cq.from(LiveSalesList.class);
cq.select(liveSalesList);
cq.where(cb.and(
cb.equal(liveSalesList.get(LiveSalesList_.productTypeId), productTypeId),
cb.equal(liveSalesList.get(LiveSalesList_.region), regionName)
));
Query q = getEntityManager().createQuery(cq);
q.setMaxResults(500);
return q.getResultList();
}
示例15: createFolder
import javax.ws.rs.PathParam; //导入依赖的package包/类
@POST
@Path("/folder/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Folder createFolder(FolderName name, @PathParam("path") String path) throws Exception {
String fullPath = PathUtils.toFSPathString(Arrays.asList(path, name.toString()));
FolderPath folderPath = FolderPath.fromURLPath(homeName, fullPath);
final FolderConfig folderConfig = new FolderConfig();
folderConfig.setFullPathList(folderPath.toPathList());
folderConfig.setName(folderPath.getFolderName().getName());
try {
namespaceService.addOrUpdateFolder(folderPath.toNamespaceKey(), folderConfig);
} catch(NamespaceNotFoundException nfe) {
throw new ClientErrorException("Parent folder doesn't exist", nfe);
}
return newFolder(folderPath, folderConfig, null);
}