本文整理汇总了Java中javax.ws.rs.core.MediaType.WILDCARD属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.WILDCARD属性的具体用法?Java MediaType.WILDCARD怎么用?Java MediaType.WILDCARD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.ws.rs.core.MediaType
的用法示例。
在下文中一共展示了MediaType.WILDCARD属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAccessStatus
/**
* Gets the current client's identity and authorized permissions.
*
* @param httpServletRequest the servlet request
* @return An object describing the current client identity, as determined by the server, and it's permissions.
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Returns the current client's authenticated identity and permissions to top-level resources",
response = CurrentUser.class
)
@ApiResponses({
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.") })
public Response getAccessStatus(@Context HttpServletRequest httpServletRequest) {
final NiFiUser user = NiFiUserUtils.getNiFiUser();
if (user == null) {
// Not expected to happen unless the nifi registry server has been seriously misconfigured.
throw new WebApplicationException(new Throwable("Unable to access details for current user."));
}
final CurrentUser currentUser = authorizationService.getCurrentUser();
return generateOkResponse(currentUser).build();
}
示例2: upload
@POST
@RolesAllowed(value = "TASK_APP_CLIENT")
@Path("/upload")
@Consumes(MediaType.WILDCARD)
public void upload(
@QueryParam("taskId") Long taskId,
@QueryParam("code") String code,
@QueryParam("mimeType") String mimeType,
@QueryParam("name") String name,
InputStream inputStream) {
JmdTaskData jmdTaskData = new JmdTaskData();
jmdTaskData.setTaskFk(taskId);
jmdTaskData.setCode(code);
jmdTaskData.setMimeType(mimeType);
jmdTaskData.setName(name);
taskDao.setData(jmdTaskData);
File file = new TaskAppFile().getFile(taskAppService.getTmpDir(), jmdTaskData, true);
try {
FileUtil.streamToFile(inputStream, file);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
FileUtil.close(inputStream);
}
}
示例3: getAccessPolicies
/**
* Retrieves all access policies
*
* @return A list of access policies
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Gets all access policies",
response = AccessPolicy.class,
responseContainer = "List"
)
@ApiResponses({
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getAccessPolicies() {
verifyAuthorizerIsManaged();
authorizeAccess(RequestAction.READ);
List<AccessPolicy> accessPolicies = authorizationService.getAccessPolicies();
if (accessPolicies == null) {
accessPolicies = Collections.emptyList();
}
return generateOkResponse(accessPolicies).build();
}
示例4: createFolderPut
@PUT
@Path("/{uuid}/dir{parentFolder:(/.*)?}/{foldername}")
@Consumes(MediaType.WILDCARD)
public Response createFolderPut(
//@formatter:off
@PathParam("uuid") String stagingUuid,
@PathParam("parentFolder") String parentFolder,
@PathParam("foldername") String foldername
//@formatter:on
);
示例5: downloadFile
@GET
@Path("/{uuid}/content/{filepath:(.*)}")
@Produces(MediaType.WILDCARD)
@ApiOperation(value = "Download a file")
@Cache(maxAge = 86400, sMaxAge = 0, mustRevalidate = true)
public Response downloadFile(@Context HttpHeaders headers, @PathParam("uuid") String stagingUuid,
@PathParam("filepath") String filepath) throws IOException;
示例6: getFlowVersion
@GET
@Path("{flowId}/versions/{versionNumber: \\d+}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Gets the given version of a flow",
response = VersionedFlowSnapshot.class
)
@ApiResponses({
@ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlowVersion(
@PathParam("bucketId")
@ApiParam("The bucket identifier")
final String bucketId,
@PathParam("flowId")
@ApiParam("The flow identifier")
final String flowId,
@PathParam("versionNumber")
@ApiParam("The version number")
final Integer versionNumber) {
authorizeBucketAccess(RequestAction.READ, bucketId);
final VersionedFlowSnapshot snapshot = registryService.getFlowSnapshot(bucketId, flowId, versionNumber);
populateLinksAndPermissions(snapshot);
return Response.status(Response.Status.OK).entity(snapshot).build();
}
示例7: getFlow
@GET
@Path("{flowId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Gets a flow",
response = VersionedFlow.class
)
@ApiResponses({
@ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlow(
@PathParam("bucketId")
@ApiParam("The bucket identifier")
final String bucketId,
@PathParam("flowId")
@ApiParam("The flow identifier")
final String flowId) {
authorizeBucketAccess(RequestAction.READ, bucketId);
final VersionedFlow flow = registryService.getFlow(bucketId, flowId);
permissionsService.populateItemPermissions(flow);
linkService.populateFlowLinks(flow);
return Response.status(Response.Status.OK).entity(flow).build();
}
示例8: getFlows
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Gets all flows in the given bucket",
response = VersionedFlow.class,
responseContainer = "List"
)
@ApiResponses({
@ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlows(
@PathParam("bucketId")
@ApiParam("The bucket identifier")
final String bucketId) {
authorizeBucketAccess(RequestAction.READ, bucketId);
final List<VersionedFlow> flows = registryService.getFlows(bucketId);
permissionsService.populateItemPermissions(flows);
linkService.populateFlowLinks(flows);
return Response.status(Response.Status.OK).entity(flows).build();
}
示例9: create
@POST
@Path("/")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create new scrapbook item")
public Response create(@ApiParam(value = "Scrapbook item") ScrapbookItemBean itemBean, @Context UriInfo info)
{
return Response.status(Status.CREATED)
.location(getScrapbookItemURI(createOrUpdateScrapbookItem(null, itemBean, info).getItemId())).build();
}
示例10: upload
@POST
@Path("/upload")
@Consumes(MediaType.WILDCARD)
public void upload(
@QueryParam("taskId") Long taskId,
@QueryParam("code") String code,
@QueryParam("mimeType") String mimeType,
@QueryParam("name") String name,
InputStream inputStream);
示例11: listOntologies
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
public Response listOntologies(){
JSONArray array = new JSONArray();
OntologyInfo[] ontologyInfos = ontonetHub.getOntologiesInfo();
for(OntologyInfo ontologyInfo : ontologyInfos){
try {
String jsonString = objectMapper.writeValueAsString(ontologyInfo);
JSONObject json = new JSONObject(jsonString);
String ontologyId = json.getString("ontologyID");
if(ontologyId != null){
String ontologySourceURI = uriInfo.getBaseUri() + "ontonethub/ontology/" + ontologyId + "/source";
json.put("ontologySource", ontologySourceURI);
}
array.put(json);
} catch (JsonProcessingException | JSONException e) {
log.error(e.getMessage(), e);
}
}
return Response.ok(array.toString()).build();
}
示例12: getOntologySource
@GET
@Consumes(MediaType.WILDCARD)
@Produces({
KRFormat.RDF_XML,
KRFormat.RDF_JSON,
KRFormat.TURTLE,
KRFormat.N_TRIPLE,
KRFormat.N3,
"application/json-ld"
})
@Path("/{id}/source")
public Response getOntologySource(@PathParam("id") String id){
ResponseBuilder responseBuilder = null;
Model model;
try {
model = ontonetHub.getOntologySource(id);
responseBuilder = Response.ok(model);
} catch (NoSuchOntologyException e1) {
JSONObject json = new JSONObject();
try {
json.put("error", "No ontology exists with the ID provided.");
} catch (JSONException e) {
log.error(e.getMessage(), e);
}
responseBuilder = Response.status(Status.NOT_FOUND).entity(json);
}
return responseBuilder.build();
}
示例13: getLatestFlowVersionMetadata
@GET
@Path("{flowId}/versions/latest/metadata")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Get the metadata for the latest version of a flow",
response = VersionedFlowSnapshotMetadata.class
)
@ApiResponses({
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getLatestFlowVersionMetadata(
@PathParam("bucketId")
@ApiParam("The bucket identifier")
final String bucketId,
@PathParam("flowId")
@ApiParam("The flow identifier")
final String flowId) {
authorizeBucketAccess(RequestAction.READ, bucketId);
final VersionedFlowSnapshotMetadata latest = registryService.getLatestFlowSnapshotMetadata(bucketId, flowId);
if (latest == null) {
throw new ResourceNotFoundException("No flow versions found for flow with id " + flowId);
}
linkService.populateSnapshotLinks(latest);
return Response.status(Response.Status.OK).entity(latest).build();
}
示例14: errorEmpty
@GET
@Produces(MediaType.WILDCARD)
public Response errorEmpty(@Context HttpServletRequest request) {
Number statusCode = (Number) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
Response.Status finalStatus = statusCode == null ?
Response.Status.OK : Response.Status.fromStatusCode(statusCode.intValue());
return Response.status(finalStatus).build();
}
示例15: getUsers
/**
* Retrieves all the of users in this NiFi.
*
* @return a list of users
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("users")
@ApiOperation(
value = "Gets all users",
notes = NON_GUARANTEED_ENDPOINT,
response = User.class,
responseContainer = "List"
)
@ApiResponses({
@ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
@ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
@ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
@ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getUsers() {
verifyAuthorizerIsManaged();
authorizeAccess(RequestAction.READ);
// get all the users
final List<User> users = authorizationService.getUsers();
// generate the response
return generateOkResponse(users).build();
}