當前位置: 首頁>>代碼示例>>Java>>正文


Java PathParam類代碼示例

本文整理匯總了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();
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:19,代碼來源:ControlResource.java

示例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();
   }
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:26,代碼來源:CommitStatusResource.java

示例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());
}
 
開發者ID:holon-platform,項目名稱:holon-examples,代碼行數:8,代碼來源:ProductEndpoint.java

示例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));
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:ApplianceApis.java

示例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);
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:24,代碼來源:ServiceProviderService1.java

示例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;
}
 
開發者ID:projets2017cl,項目名稱:vc,代碼行數:8,代碼來源:PersonResource.java

示例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);
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:24,代碼來源:ServiceProviderService1.java

示例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();
}
 
開發者ID:xstefank,項目名稱:lra-service,代碼行數:19,代碼來源:Coordinator.java

示例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);
}
 
開發者ID:prestodb,項目名稱:presto-manager,代碼行數:18,代碼來源:LogsAPI.java

示例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;
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:23,代碼來源:ApiTokenResource.java

示例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);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:21,代碼來源:HomeResource.java

示例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));
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:ApplianceApis.java

示例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);
}
 
開發者ID:EricssonResearch,項目名稱:scott-eu,代碼行數:21,代碼來源:ResourceShapeService.java

示例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();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:LiveSalesListFacadeREST.java

示例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);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:20,代碼來源:HomeResource.java


注:本文中的javax.ws.rs.PathParam類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。