当前位置: 首页>>代码示例>>Java>>正文


Java Path类代码示例

本文整理汇总了Java中javax.ws.rs.Path的典型用法代码示例。如果您正苦于以下问题:Java Path类的具体用法?Java Path怎么用?Java Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Path类属于javax.ws.rs包,在下文中一共展示了Path类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insert

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * Cadastra usuario
 * 
 * @param User
 * @return Response
 */
@PermitAll
@POST
@Path("/")
@Consumes("application/json")
@Produces("application/json")
public Response insert(User user) {

	ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
	builder.expires(new Date());

	try {

		Long idUser = (long) UserDao.getInstance().insertU(user);
		user.setId(idUser);
		builder.status(Response.Status.OK).entity(user);

	} catch (SQLException e) {

		builder.status(Response.Status.INTERNAL_SERVER_ERROR);
	}

	return builder.build();
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:30,代码来源:UserController.java

示例2: createApplianceSoftwareVersion

import javax.ws.rs.Path; //导入依赖的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

示例3: updateDeliverableType

import javax.ws.rs.Path; //导入依赖的package包/类
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update Deliverabletypes")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns", response = DeliverableTypesModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updateDeliverableType(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @BeanParam DeliverableTypeInputModel input,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") long id);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:14,代码来源:DeliverableTypesManagement.java

示例4: getMachineMetric

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * Metrics for a machine
 *
 * @param machine
 * @return the metric
 */
@GET
@Path("{machine}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getMachineMetric(@PathParam("machine") String machine) {
    LOGGER.log(Level.INFO, "Fetching metrics for machine {0}", machine);

    KafkaStreams ks = GlobalAppState.getInstance().getKafkaStreams();
    HostInfo thisInstance = GlobalAppState.getInstance().getHostPortInfo();

    Metrics metrics = null;

    StreamsMetadata metadataForMachine = ks.metadataForKey(storeName, machine, new StringSerializer());

    if (metadataForMachine.host().equals(thisInstance.host()) && metadataForMachine.port() == thisInstance.port()) {
        LOGGER.log(Level.INFO, "Querying local store for machine {0}", machine);
        metrics = getLocalMetrics(machine);
    } else {
        //LOGGER.log(Level.INFO, "Querying remote store for machine {0}", machine);
        String url = "http://" + metadataForMachine.host() + ":" + metadataForMachine.port() + "/metrics/remote/" + machine;
        metrics = Utils.getRemoteStoreState(url, 2, TimeUnit.SECONDS);
        LOGGER.log(Level.INFO, "Metric from remote store at {0} == {1}", new Object[]{url, metrics});
    }

    return Response.ok(metrics).build();
}
 
开发者ID:abhirockzz,项目名称:docker-kafka-streams,代码行数:32,代码来源:MetricsResource.java

示例5: registerClientSeeder

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * When a client has a chunk, it registers as a seeder
 */
@Path("registerclientseeder")
@Produces(MediaType.TEXT_PLAIN)
public String registerClientSeeder(@QueryParam("file_hash") String file_hash,
                                   @QueryParam("chunk_hash") String chunk_hash,
                                   @QueryParam("chunk_id") String chunk_id,
                                   @QueryParam("ip") String ip,
                                   @QueryParam("port") String port) {

    String query = "INSERT INTO chunk_owners(file_hash, chunk_hash, chunk_id, "
                                          + "owner_ip, owner_port, is_seeder)"

                 + "VALUES('%s', '%s', %s, '%s', %s, 'f');".format(file_hash,
                                                                   chunk_hash,
                                                                   chunk_id,
                                                                   ip,
                                                                   port);

    runUpdate(query);
    return null;
}
 
开发者ID:freddygv,项目名称:trabblex,代码行数:24,代码来源:ClientManagerResource.java

示例6: run

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * Return complete results of a dataset version. Response contains a pagination URL to fetch the data in chunks.
 *
 * @return
 * @throws DatasetVersionNotFoundException
 * @throws InterruptedException
 */
@GET @Path("run")
@Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON)
public InitialRunResponse run(@QueryParam("tipVersion") DatasetVersion tipVersion) throws DatasetVersionNotFoundException, InterruptedException, NamespaceException {
  final VirtualDatasetUI virtualDatasetUI = getDatasetConfig();
  final SqlQuery query = new SqlQuery(virtualDatasetUI.getSql(), virtualDatasetUI.getState().getContextList(), securityContext);
  RunStartedListener listener = new RunStartedListener();
  final JobUI job = executor.runQueryWithListener(query, QueryType.UI_RUN, datasetPath, version, listener);
  // wait for job to start (or WAIT_FOR_RUN_HISTORY_S seconds).
  boolean success = listener.await(WAIT_FOR_RUN_HISTORY_S, TimeUnit.SECONDS);
  if (!success) {
    throw new InterruptedException("Starting a query timed out after " + WAIT_FOR_RUN_HISTORY_S +
        " seconds, please try again.");
  }

  // tip version is optional, as it is only needed when we are navigated back in history
  // otherwise assume the current version is at the tip of the history
  tipVersion = tipVersion != null ? tipVersion : virtualDatasetUI.getVersion();
  final History history = tool.getHistory(datasetPath, virtualDatasetUI.getVersion(), tipVersion);
  return InitialRunResponse.of(newDataset(virtualDatasetUI, tipVersion), job.getJobId(), history);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:DatasetVersionResource.java

示例7: findById

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * Return a specific user from his/her login. When user does not exist or is
 * within a non managed company, return a 404.
 *
 * @param user
 *            The user to find. A normalized form will be used for the
 *            search.
 * @return found user. Never <code>null</code>.
 */
@GET
@Path("{user:" + SimpleUser.USER_PATTERN + "}")
public UserOrg findById(@PathParam("user") final String user) {
	final UserOrg rawUserOrg = getUser().findByIdExpected(securityHelper.getLogin(), Normalizer.normalize(user));

	// User has been found, secure the object regarding the visible groups
	final UserOrg securedUserOrg = new UserOrg();
	rawUserOrg.copy(securedUserOrg);

	// Show only the groups of user that are also visible to current user
	final Set<GroupOrg> managedGroups = groupResource.getContainers();
	securedUserOrg.setGroups(managedGroups.stream().filter(mGroup -> rawUserOrg.getGroups().contains(mGroup.getId())).sorted()
			.map(GroupOrg::getName).collect(Collectors.toList()));
	return securedUserOrg;
}
 
开发者ID:ligoj,项目名称:plugin-id,代码行数:25,代码来源:UserOrgResource.java

示例8: inventoryObjects

import javax.ws.rs.Path; //导入依赖的package包/类
@GET
@Secured
@Path("/inventory/objects")
@Produces(MediaType.APPLICATION_XML)
public InventoryTrans inventoryObjects() {
	InventoryTrans inventoryTrans = new InventoryTrans();
	ArrayOfInventoryItemTrans arrayOfInventoryItemTrans = new ArrayOfInventoryItemTrans();
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("nosshot", -1681514783, 1842996427L, "0x9bc61ee1"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("runflattires", -537557654, 2876729160L, "0xdff5856a"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("instantcooldown", -1692359144, 2876729162L, "0x9b20a618"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("shield", -364944936, 2876729163L, "0xea3f61d8"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("slingshot", 2236629, 2876729164L, "0x2220d5"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("ready", 957701799, 2876729165L, "0x39155ea7"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("juggernaut", 1805681994, 2876729166L, "0x6ba0854a"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("emergencyevade", -611661916, 2876729167L, "0xdb8ac7a4"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("team_emergencyevade", -1564932069, 2876729168L, "0xa2b9081b"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("onemorelap", 1627606782, 2876729170L, "0x61034efe"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("team_slingshot", 1113720384, 2876729171L, "0x42620640"));
	arrayOfInventoryItemTrans.getInventoryItemTrans().add(getPowerUpInventory("trafficmagnet", 125509666, 2880783203L, "0x77b2022"));
	inventoryTrans.setInventoryItems(arrayOfInventoryItemTrans);
	return inventoryTrans;
}
 
开发者ID:SoapboxRaceWorld,项目名称:soapbox-race-core,代码行数:23,代码来源:Personas.java

示例9: saveFolderFormat

import javax.ws.rs.Path; //导入依赖的package包/类
@PUT
@Path("/folder_format/{path: .*}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path)
    throws NamespaceException, SourceNotFoundException {
  SourceFolderPath folderPath = SourceFolderPath.fromURLPath(sourceName, path);
  sourceService.checkSourceExists(folderPath.getSourceName());
  fileFormat.setFullPath(folderPath.toPathList());

  PhysicalDatasetConfig physicalDatasetConfig = new PhysicalDatasetConfig();
  physicalDatasetConfig.setName(folderPath.getFolderName().getName());
  physicalDatasetConfig.setFormatSettings(fileFormat.asFileConfig());
  physicalDatasetConfig.setType(DatasetType.PHYSICAL_DATASET_SOURCE_FOLDER);
  physicalDatasetConfig.setFullPathList(folderPath.toPathList());
  physicalDatasetConfig.setVersion(fileFormat.getVersion());
  sourceService.createPhysicalDataset(folderPath, physicalDatasetConfig);
  fileFormat.setVersion(physicalDatasetConfig.getVersion());
  return new FileFormatUI(fileFormat, folderPath);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:SourceResource.java

示例10: verifyInjectedAuthTime

import javax.ws.rs.Path; //导入依赖的package包/类
@GET
@Path("/verifyInjectedAuthTime")
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("Tester")
public JsonObject verifyInjectedAuthTime(@QueryParam("auth_time") Long authTime) {
    boolean pass = false;
    String msg;
    // auth_time
    Long authTimeValue = this.authTime.longValue();
    if(authTimeValue == null) {
        msg = Claims.auth_time.name()+" value is null or missing, FAIL";
    }
    else if(authTimeValue.equals(authTime)) {
        msg = Claims.auth_time.name()+" PASS";
        pass = true;
    }
    else {
        msg = String.format("%s: %s != %s", Claims.auth_time.name(), authTimeValue, authTime);
    }
    JsonObject result = Json.createObjectBuilder()
        .add("pass", pass)
        .add("msg", msg)
        .build();
    return result;
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:26,代码来源:JsonValuejectionEndpoint.java

示例11: newUntitledFromParent

import javax.ws.rs.Path; //导入依赖的package包/类
/**
 * Create a new query of SELECT * from [parentDataset].
 *
 * @param parentDataset
 * @return
 * @throws DatasetNotFoundException
 * @throws NamespaceException
 */
@POST @Path("new_untitled") @Produces(MediaType.APPLICATION_JSON)
public InitialPreviewResponse newUntitledFromParent(
    @QueryParam("parentDataset") DatasetPath parentDataset,
    @QueryParam("newVersion") DatasetVersion newVersion,
    @QueryParam("limit") Long limit)
  throws DatasetNotFoundException, DatasetVersionNotFoundException, NamespaceException, NewDatasetQueryException {
  Preconditions.checkNotNull(newVersion, "newVersion should not be null");
  try {
    return newUntitled(new FromTable(parentDataset.toPathString()), newVersion, parentDataset.toParentPathList());
  } catch (DatasetNotFoundException | NamespaceException e) {
    // TODO: this should really be a separate API from the UI.
    // didn't find as virtual dataset, let's return as opaque sql (as this could be a source) .
    return newUntitled(new FromTable(parentDataset.toPathString()), newVersion, parentDataset.toParentPathList());
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:DatasetsResource.java

示例12: createStateInIdpSelectedState

import javax.ws.rs.Path; //导入依赖的package包/类
@Path(IDP_SELECTED_STATE)
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createStateInIdpSelectedState(TestSessionDto testSessionDto) {
    testSessionRepository.createSession(testSessionDto.getSessionId(),
            new IdpSelectedState(testSessionDto.getRequestId(),
                    testSessionDto.getIdentityProviderEntityId(),
                    testSessionDto.getMatchingServiceEntityId(),
                    testSessionDto.getLevelsOfAssurance(),
                    testSessionDto.getUseExactComparisonType(),
                    testSessionDto.getForceAuthentication(),
                    testSessionDto.getAssertionConsumerServiceUri(),
                    testSessionDto.getRequestIssuerId(),
                    testSessionDto.getRelayState(),
                    testSessionDto.getSessionExpiryTimestamp(),
                    testSessionDto.isRegistering(),
                    testSessionDto.getSessionId(),
                    testSessionDto.getAvailableIdentityProviders(),
                    testSessionDto.getTransactionSupportsEidas())
    );
    return Response.ok().build();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:23,代码来源:TestSessionResource.java

示例13: deletePorts

import javax.ws.rs.Path; //导入依赖的package包/类
@DELETE
@Path("{portUUID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deletePorts(@PathParam("portUUID") String id) {
    Set<VirtualPortId> vPortIds = new HashSet<>();
    try {
        if (id != null) {
            vPortIds.add(VirtualPortId.portId(id));
        }
        Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
                .removePorts(vPortIds), VPORT_NOT_FOUND);
        if (!issuccess) {
            return Response.status(INTERNAL_SERVER_ERROR)
                    .entity(VPORT_ID_NOT_EXIST).build();
        }
        return ok(issuccess.toString()).build();
    } catch (Exception e) {
        log.error("Deletes VirtualPort failed because of exception {}",
                  e.toString());
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:VirtualPortWebResource.java

示例14: createStateInCountrySelectingState

import javax.ws.rs.Path; //导入依赖的package包/类
@Path(COUNTRY_SELECTED_STATE)
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createStateInCountrySelectingState(TestSessionDto testSessionDto) {
    testSessionRepository.createSession(testSessionDto.getSessionId(),
            new SessionStartedState(testSessionDto.getRequestId(),
                    testSessionDto.getRelayState(),
                    testSessionDto.getRequestIssuerId(),
                    testSessionDto.getAssertionConsumerServiceUri(),
                    Optional.<Boolean>absent(),
                    Collections.<String>emptyList(),
                    testSessionDto.getSessionExpiryTimestamp(),
                    testSessionDto.getSessionId(),
                    testSessionDto.getTransactionSupportsEidas()));
    return Response.ok().build();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:17,代码来源:TestSessionResource.java

示例15: deleteSingleSubnet

import javax.ws.rs.Path; //导入依赖的package包/类
@DELETE
@Path("{subnetUUID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deleteSingleSubnet(@PathParam("subnetUUID") String id)
        throws IOException {
    try {
        SubnetId subId = SubnetId.subnetId(id);
        Set<SubnetId> subIds = new HashSet<>();
        subIds.add(subId);
        get(SubnetService.class).removeSubnets(subIds);
        return Response.noContent().entity("SUCCESS").build();
    } catch (Exception e) {
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SubnetWebResource.java


注:本文中的javax.ws.rs.Path类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。