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


Java MediaType.WILDCARD屬性代碼示例

本文整理匯總了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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:27,代碼來源:AccessResource.java

示例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);
    }
}
 
開發者ID:jmd-stuff,項目名稱:task-app,代碼行數:25,代碼來源:TaskAppIOResource.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:29,代碼來源:AccessPolicyResource.java

示例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
);
 
開發者ID:equella,項目名稱:Equella,代碼行數:10,代碼來源:FileResource.java

示例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;
 
開發者ID:equella,項目名稱:Equella,代碼行數:7,代碼來源:FileResource.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:31,代碼來源:BucketFlowResource.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:30,代碼來源:BucketFlowResource.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:27,代碼來源:BucketFlowResource.java

示例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();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:10,代碼來源:ScrapbookResource.java

示例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);
 
開發者ID:jmd-stuff,項目名稱:task-app,代碼行數:9,代碼來源:ClientApi.java

示例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();
}
 
開發者ID:teamdigitale,項目名稱:ontonethub,代碼行數:27,代碼來源:OntonethubOntologiesResource.java

示例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();
}
 
開發者ID:teamdigitale,項目名稱:ontonethub,代碼行數:30,代碼來源:OntonethubIndexingResource.java

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:32,代碼來源:BucketFlowResource.java

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

示例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();
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:31,代碼來源:TenantResource.java


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