本文整理汇总了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();
}
示例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));
}
示例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);
示例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();
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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());
}
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
}