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


Java MediaType.APPLICATION_JSON_VALUE属性代码示例

本文整理汇总了Java中org.springframework.http.MediaType.APPLICATION_JSON_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.APPLICATION_JSON_VALUE属性的具体用法?Java MediaType.APPLICATION_JSON_VALUE怎么用?Java MediaType.APPLICATION_JSON_VALUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.http.MediaType的用法示例。


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

示例1: saveProject

@RequestMapping(value = "/project/save", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(
        value = "Creates new project or updates existing one",
        notes = "New project should contain a name field. Updated project should contain id and name fields. <br/>"
                + "Optional parameter parentId stands for creating a new project as a nested project for existing "
                + "one, specified by parentId parameter. Works only for creation of a new project. <br/>"
                + "To move an existing project to another parent project, use <b>/project/{projectId}/move</b> "
                + "service",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public Result<ProjectVO> saveProject(@RequestBody ProjectVO project, @RequestParam(required = false) Long parentId)
    throws FeatureIndexException {
    return Result.success(ProjectConverter.convertTo(projectManager.saveProject(ProjectConverter.convertFrom(
        project), parentId)));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:18,代码来源:ProjectController.java

示例2: create

/**
 * Function to create an Organisation
 *
 * Only a system administrator cna create an Organisation
 *
 * @param organisation
 * @return ResponseEntity
 */
@RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> create(@RequestBody final DtoOrganisation organisation) {
	try {
		LOGGER.debug(() -> "Creating Organisation " + organisation.getName());
		IUser actor = getLoggedInUser();
		return new ResponseEntity<>(convertToDtoOrganisation(actor, serviceOrganisation.createOrganisation(actor,
				organisation)), HttpStatus.OK);
	} catch (ServiceOrganisationExceptionNotAllowed ex) {
		return new ResponseEntity<>(ex, HttpStatus.FORBIDDEN);
	}
}
 
开发者ID:howma03,项目名称:sporticus,代码行数:19,代码来源:RestControllerAdminOrganisation.java

示例3: track

@ResponseBody
@RequestMapping(value = GENE_URL + REFERENCE_ID_FIELD + "}/variation/protein/get", method = RequestMethod.POST)
@ApiOperation(
        value = "Returns reconstructed protein sequence matched to the given query of gene track, "
                + "taking into account variations.",
        notes = "It provides data for a protein sequence with the given scale factor between the beginning " +
                "position with the first base having position 1 and ending position inclusive in a target " +
                "chromosome. All parameters are mandatory and described below:<br/><br/>" +
                "Body: <br/><br/>" +
                "<b>variations: result of call /gene/{" + REFERENCE_ID_FIELD + "}/protein/get <br/>" +
                "<b>trackquery:<br/>" +
                "1) <b>" + REFERENCE_ID_FIELD + "</b> specifies ID of reference genome;<br/>" +
                "2) <b>id</b> specifies ID of a track;<br/>" +
                "3) <b>chromosomeId</b> specifies ID of a chromosome corresponded to a track;<br/>" +
                "4) <b>startIndex</b> is the most left base position for a requested window. The first base in a " +
                "chromosome always has got position 1;<br/>" +
                "5) <b>endIndex</b> is the last base position for a requested window. " +
                "It is treated inclusively;<br/>" +
                "6) <b>scaleFactor</b> specifies an inverse value to number of bases per one visible element on a" +
                " track (e.g., pixel)",
        produces = MediaType.APPLICATION_JSON_VALUE)
public Result<Track<MrnaProteinSequenceVariants>> loadProteinSequenceForVariations(
        @RequestBody final ProteinSequenceVariationQuery psVariationQuery, @PathVariable final Long referenceId)
    throws GeneReadingException {
    return Result.success(proteinSequenceManager.loadProteinSequenceWithVariations(psVariationQuery, referenceId));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:26,代码来源:GeneController.java

示例4: database

@ResponseBody
@RequestMapping(value = "/externaldb/ensembl/{geneId}/get", method = RequestMethod.GET)
@ApiOperation(value = "Ensembl: Retrieves information on gene using geneId.",
        notes = "Ensembl database (http://rest.ensembl.org/) is being queried for information by gene " +
                "identifier <i>in any database</i>. Gene information in JSON form is returned by Ensembl, " +
                "this information is converted to presentation required by NGGB.<br/><br/>" +
                "Examples of id which could be used as a parameter to this service:<br/><br/>" +
                "ENSG00000106683 -- Ensembl ID<br/>" +
                "FBgn0000008 -- Fly Base ID<br/>",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(value = { @ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION) })
public Result<EnsemblEntryVO> fetchEnsemblData(@PathVariable(value = "geneId") final String geneId)
        throws ExternalDbUnavailableException {

    Assert.notNull(geneId, getMessage(MessagesConstants.ERROR_GENEID_NOT_SPECIFIED));
    EnsemblEntryVO ensemblEntryVO = ensemblDataManager.fetchEnsemblEntry(geneId);

    return Result.success(ensemblEntryVO, getMessage(SUCCESS, ENSEMBL));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:19,代码来源:ExternalDBController.java

示例5: forgotPassword

@ApiOperation(value = "Generate a new password for the user and send it to the e-mail address")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "Incorrect data in the form"),
        @ApiResponse(code = 404, message = "No user found")
})
@PutMapping(value = "/password_reset", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public
void forgotPassword(
        @ApiParam(value = "Password recovery form", required = true)
        @RequestBody @Valid final ForgotPasswordDTO forgotPasswordDTO
) {
    log.info("Called with {}", forgotPasswordDTO);

    this.validForgotPasswordDTO(forgotPasswordDTO);

    this.userPersistenceService.resetPassword(forgotPasswordDTO);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:18,代码来源:ForgotRestController.java

示例6: getAllPosts

/**
     * GET  /posts -> get all the posts.
     */
    @RequestMapping(value = "/posts",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    @Transactional(readOnly = true)
    public ResponseEntity<List<PostDTO>> getAllPosts(Pageable pageable, @RequestParam(defaultValue = "") String keywords)
        throws URISyntaxException {
        Page<Post> page;
        if (keywords.trim().equals("")) {
            page = postRepository.findUserPosts(userService.getCurrentUserId(), pageable);
        } else {
//            page = postRepository.searchUserPosts(pageable, userService.getCurrentUserId(), keywords.toUpperCase());
            page = postSearchRepository.searchUserPosts(keywords, SecurityUtils.getCurrentUserLogin(), pageable);
        }
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/posts");
        return new ResponseEntity<>(page.getContent().stream()
            .map(postMapper::postToSimplePostDTO)
            .collect(Collectors.toCollection(LinkedList::new)), headers, HttpStatus.OK);
    }
 
开发者ID:ugouku,项目名称:shoucang,代码行数:22,代码来源:PostResource.java

示例7: getTag

/**
 * GET  /tags/:id -> get the "id" tag.
 */
@RequestMapping(value = "/tags/{id}",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Tag> getTag(@PathVariable Long id) {
    log.debug("REST request to get Tag : {}", id);
    return Optional.ofNullable(tagRepository.findOne(id))
        .map(tag -> new ResponseEntity<>(
            tag,
            HttpStatus.OK))
        .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:15,代码来源:TagResource.java

示例8: signUp

@RequestMapping(value="/signup", method = RequestMethod.POST, consumes={MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})	
public @ResponseBody ResponseEntity<CreateUserResponse> signUp(@RequestBody LoginRequest req){
	CreateUserResponse result=authService.createUser(req);
	req.setPassword("");

	return new ResponseEntity<CreateUserResponse>(result, HttpStatus.OK);
}
 
开发者ID:zafar142007,项目名称:FolderSync,代码行数:7,代码来源:MainController.java

示例9: getTag

/**
 * GET  /admin/tags/:id -> get the "id" tag.
 */
@RequestMapping(value = "/admin/tags/{id}",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Tag> getTag(@PathVariable Long id) {
    log.debug("REST request to get Tag : {}", id);
    return Optional.ofNullable(tagRepository.findOne(id))
        .map(tag -> new ResponseEntity<>(
            tag,
            HttpStatus.OK))
        .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
 
开发者ID:ugouku,项目名称:shoucang,代码行数:15,代码来源:TagResource.java

示例10: details

@RequestMapping(value = "/sdoc/api/detail/{groupIndex}/{beanName}/{apiIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Options details(HttpServletRequest req, @PathVariable Integer groupIndex, @PathVariable String beanName,
        @PathVariable int apiIndex) throws Exception {
    Options options = new Options();
    Documentation documentation = documentScanner.getDocumentations().get(groupIndex);
    if (documentation == null) {
        return options;
    }
    List<Options> optionsList = documentation.getOptionsMap().get(beanName);
    if (optionsList != null) {
        options = optionsList.get(apiIndex);
    }
    return options;
}
 
开发者ID:apcc4m,项目名称:sdoc,代码行数:15,代码来源:SdocController.java

示例11: createBet

@RequestMapping(value="/bets", method=RequestMethod.POST, produces={ MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<Object> createBet(@Valid @RequestBody Bet bet) {
    final Project project = projectRepository.findOne(bet.getProjectId());
    if (project == null || project.getStatus() != 1) return ResponseEntity.notFound().build();
    if (!bet.getSpices().equals(5) &&
            !bet.getSpices().equals(15)) return Utils.jsonError("Bet should be equal to 5 or 15");
    final String user = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
    final User userE = userRepository.findByEmail(user);
    final Bet betE = new Bet();
    if (project.getCurrentSpices() + bet.getSpices() >
            project.getSpices()) return Utils.jsonError("Max spices is reached");
    if (userE.getSpices() - bet.getSpices() < 0) return Utils.jsonError("User haven't enough spices");
    final List<Bet> betsUser = betRepository.findByUserId(userE.getId());
    if (!betsUser.isEmpty()) {
        List <Bet> betsUserProject = betsUser.stream()
                .filter(e -> e.getProjectId().equals(bet.getProjectId()))
                .collect(Collectors.toList());
        if (!betsUserProject.isEmpty()) return Utils.jsonError("User have already bet");
    }
    betE.setSpices(bet.getSpices());
    betE.setProjectId((bet.getProjectId()));
    betE.setUserId(userE.getId());
    betRepository.save(betE);
    project.setCurrentSpices(project.getCurrentSpices() + betE.getSpices());
    projectRepository.save(project);
    userE.setSpices(userE.getSpices() - betE.getSpices());
    userRepository.save(userE);
    return ResponseEntity.ok().build();
}
 
开发者ID:Epi-Tools,项目名称:homer,代码行数:29,代码来源:BetRestController.java

示例12: getPhotoLocationExercise

/**
 * GET  /photoLocationExercises/:id -> get the "id" photoLocationExercise.
 */
@RequestMapping(value = "/photoLocationExercises/{id}",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<PhotoLocationExercise> getPhotoLocationExercise(@PathVariable Long id) {
    log.debug("REST request to get PhotoLocationExercise : {}", id);
    return Optional.ofNullable(photoLocationExerciseRepository.findOneWithEagerRelationships(id))
        .map(photoLocationExercise -> new ResponseEntity<>(
            photoLocationExercise,
            HttpStatus.OK))
        .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:15,代码来源:PhotoLocationExerciseResource.java

示例13: handleRequest

/**
 * Handle request internal response entity.
 *
 * @param request  the request
 * @param response the response
 * @return the response entity
 * @throws Exception the exception
 */
@GetMapping(path = OAuth20Constants.BASE_OAUTH20_URL + '/' + OAuth20Constants.PROFILE_URL, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> handleRequest(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    response.setContentType(MediaType.APPLICATION_JSON_VALUE);

    final String accessToken = getAccessTokenFromRequest(request);
    if (StringUtils.isBlank(accessToken)) {
        LOGGER.error("Missing [{}]", OAuth20Constants.ACCESS_TOKEN);
        return buildUnauthorizedResponseEntity(OAuth20Constants.MISSING_ACCESS_TOKEN);
    }

    final AccessToken accessTokenTicket = this.ticketRegistry.getTicket(accessToken, AccessToken.class);
    if (accessTokenTicket == null || accessTokenTicket.isExpired()) {
        LOGGER.error("Expired/Missing access token: [{}]", accessToken);
        return buildUnauthorizedResponseEntity(OAuth20Constants.EXPIRED_ACCESS_TOKEN);
    }

    final TicketGrantingTicket ticketGrantingTicket = accessTokenTicket.getGrantingTicket();
    if (ticketGrantingTicket == null || ticketGrantingTicket.isExpired()) {
        LOGGER.error("Ticket granting ticket [{}] parenting access token [{}] has expired or is not found", ticketGrantingTicket, accessTokenTicket);
        this.ticketRegistry.deleteTicket(accessToken);
        return buildUnauthorizedResponseEntity(OAuth20Constants.EXPIRED_ACCESS_TOKEN);
    }
    updateAccessTokenUsage(accessTokenTicket);
    final Map<String, Object> map = writeOutProfileResponse(accessTokenTicket);
    final String value = OAuth20Utils.jsonify(map);
    LOGGER.debug("Final user profile is [{}]",
            JsonValue.readHjson(value).toString(Stringify.FORMATTED));
    return new ResponseEntity<>(value, HttpStatus.OK);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:37,代码来源:OAuth20UserProfileControllerController.java

示例14: createUser

@RequestMapping(path = "/create",
        method = RequestMethod.POST,
        consumes = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "This operation creates an user for sync client authentication.")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "Invalid request", response = DataGateError.class),
        @ApiResponse(code = 401, message = "Request is not authorized", response = DataGateError.class),
        @ApiResponse(code = 500, message = "Error processing request", response = DataGateError.class),
})
public void createUser(
        @RequestBody
        @ApiParam("The user account details")
        UserAccount userAccount) {
    userAccountService.insert(userAccount);
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:15,代码来源:UserController.java

示例15: getProjects

@CrossOrigin
@RequestMapping(value = "/all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Find all projects", notes = "Returns a collection of projects")
public List<ProjectDTO> getProjects() {
    return projectService.findProjects();
}
 
开发者ID:Code4SocialGood,项目名称:C4SG-Obsolete,代码行数:6,代码来源:ProjectController.java


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