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


Java MediaType.TEXT_PLAIN_VALUE屬性代碼示例

本文整理匯總了Java中org.springframework.http.MediaType.TEXT_PLAIN_VALUE屬性的典型用法代碼示例。如果您正苦於以下問題:Java MediaType.TEXT_PLAIN_VALUE屬性的具體用法?Java MediaType.TEXT_PLAIN_VALUE怎麽用?Java MediaType.TEXT_PLAIN_VALUE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.springframework.http.MediaType的用法示例。


在下文中一共展示了MediaType.TEXT_PLAIN_VALUE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bonjour

@RequestMapping(path = "/bonjour", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
@Override
public String bonjour(@RequestParam("name") String name) {
  return super.bonjour(name);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:6,代碼來源:FrenchGreetingRestEndpoint.java

示例2: setDefaultVersion

@RequestMapping(value = "/{id:.+}/defaultVersion", method = RequestMethod.PUT, consumes = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<Object> setDefaultVersion(@PathVariable("id") String id, @RequestBody String body) {
    PluginEntity plugin = pluginRepository.findByPluginNameEquals(id);

    if (null == plugin) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }

    PluginVersionEntity entry = versionRepository.findByPluginEntityAndPluginVersionEquals(plugin, body);
    if(entry == null) {
        return new ResponseEntity<>("Version " + body + "doesn't exists.", HttpStatus.NOT_FOUND);
    }

    plugin.setLatestVersion(body);
    pluginRepository.save(plugin);

    return new ResponseEntity<>(HttpStatus.OK);
}
 
開發者ID:linkedin,項目名稱:custom-gradle-plugin-portal,代碼行數:18,代碼來源:PluginsResource.java

示例3: requestPasswordReset

@RequestMapping(value = "/account/reset_password/init",
    method = RequestMethod.POST,
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<?> requestPasswordReset(@RequestBody String mail, HttpServletRequest request) {
    return userService.requestPasswordReset(mail)
        .map(user -> {
            String baseUrl = request.getScheme() +
                "://" +
                request.getServerName() +
                ":" +
                request.getServerPort();
            mailService.sendPasswordResetMail(user, baseUrl);
            return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
        }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}
 
開發者ID:GastonMauroDiaz,項目名稱:buenojo,代碼行數:16,代碼來源:AccountResource.java

示例4: getInstances

@RequestMapping ( value = "/getInstances" , produces = MediaType.TEXT_PLAIN_VALUE )
public void getInstances (
							@RequestParam ( value = "simpleFormater" , required = false ) String format,
							HttpServletRequest request, HttpServletResponse response ) {

	logger.debug( " simpleFormater: {}", format );

	// updates only if necessary
	csapApp.updateCache( false );
	try {
		response.setContentType( "text/plain" );
		response.getWriter().print( "\n\n ========== showInstances.sh -list ========\n\n" );

		response.getWriter().print( csapApp.toString() );

		response.getWriter().print( "\n\n ========== ========\n\n" );

	} catch (Exception e) {
		logger.error( "Failed to rebuild", e );
	}
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:21,代碼來源:ServiceRequests.java

示例5: requestPasswordReset

/**
 * POST   /account/reset_password/init : Send an email to reset the password of the user
 *
 * @param mail the mail of the user
 * @return the ResponseEntity with status 200 (OK) if the email was sent, or status 400 (Bad Request) if the email address is not registered
 */
@PostMapping(path = "/account/reset_password/init",
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity requestPasswordReset(@RequestBody String mail) {
    return userService.requestPasswordReset(mail)
        .map(user -> {
            mailService.sendPasswordResetMail(user);
            return new ResponseEntity<>("email was sent", HttpStatus.OK);
        }).orElse(new ResponseEntity<>("email address not registered", HttpStatus.BAD_REQUEST));
}
 
開發者ID:michaelhoffmantech,項目名稱:patient-portal,代碼行數:16,代碼來源:AccountResource.java

示例6: requestPasswordReset

/**
 * POST   /account/reset_password/init : Send an e-mail to reset the password of the user
 *
 * @param mail the mail of the user
 * @return the ResponseEntity with status 200 (OK) if the e-mail was sent, or status 400 (Bad Request) if the e-mail address is not registered
 */
@PostMapping(path = "/account/reset_password/init",
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<?> requestPasswordReset(@RequestBody String mail) {
    return userService.requestPasswordReset(mail)
        .map(user -> {
            mailService.sendPasswordResetMail(user);
            return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
        }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:16,代碼來源:AccountResource.java

示例7: finishPasswordReset

/**
 * POST   /account/reset_password/finish : Finish to reset the password of the user
 *
 * @param keyAndPassword the generated key and the new password
 * @return the ResponseEntity with status 200 (OK) if the password has been reset,
 * or status 400 (Bad Request) or 500 (Internal Server Error) if the password could not be reset
 */
@PostMapping(path = "/account/reset_password/finish",
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<String> finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) {
    if (!checkPasswordLength(keyAndPassword.getNewPassword())) {
        return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST);
    }
    return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey())
          .map(user -> new ResponseEntity<String>(HttpStatus.OK))
          .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR));
}
 
開發者ID:oktadeveloper,項目名稱:jhipster-microservices-example,代碼行數:18,代碼來源:AccountResource.java

示例8: eureka

/**
 * GET  / : get the SSH public key
 */
@GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<String> eureka() {
    try {
        String publicKey = getPublicKey();
        if(publicKey != null) return new ResponseEntity<>(publicKey, HttpStatus.OK);
    } catch (IOException e) {
        log.warn("SSH public key could not be loaded: {}", e.getMessage());
    }
    return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
 
開發者ID:oktadeveloper,項目名稱:jhipster-microservices-example,代碼行數:14,代碼來源:SshResource.java

示例9: changePassword

/**
 * POST  /account/change_password : changes the current user's password
 *
 * @param password the new password
 * @return the ResponseEntity with status 200 (OK), or status 400 (Bad Request) if the new password is not strong enough
 */
@PostMapping(path = "/account/change_password",
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity changePassword(@RequestBody String password) {
    if (!checkPasswordLength(password)) {
        return new ResponseEntity<>("Incorrect password", HttpStatus.BAD_REQUEST);
    }
    userService.changePassword(password);
    return new ResponseEntity<>(HttpStatus.OK);
}
 
開發者ID:SGKhmCs,項目名稱:speakTogether,代碼行數:16,代碼來源:AccountResource.java

示例10: getHealthCheck

@RequestMapping(value = "/healthCheck", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> getHealthCheck() {
    try {
        redirectorGateway.getApplications();
    } catch (Exception e) {
        LOGGER.error("", e);
        return new ResponseEntity<>(HttpStatus.SERVICE_UNAVAILABLE);
    }
    return new ResponseEntity<>("OK", HttpStatus.OK);
}
 
開發者ID:Comcast,項目名稱:redirector,代碼行數:10,代碼來源:DataServiceInfoController.java

示例11: requestPasswordReset

/**
 * POST   /account/reset_password/init : Send an e-mail to reset the password of the user
 *
 * @param mail the mail of the user
 * @return the ResponseEntity with status 200 (OK) if the e-mail was sent, or status 400 (Bad Request) if the e-mail address is not registered
 */
@PostMapping(path = "/account/reset_password/init",
    produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity requestPasswordReset(@RequestBody String mail) {
    return userService.requestPasswordReset(mail)
        .map(user -> {
            mailService.sendPasswordResetMail(user);
            return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
        }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}
 
開發者ID:mraible,項目名稱:devoxxus-jhipster-microservices-demo,代碼行數:16,代碼來源:AccountResource.java

示例12: eureka

/**
 * GET  / : get the SSH public key
 */
@GetMapping(value = "/ssh/public_key", produces = MediaType.TEXT_PLAIN_VALUE)
@Timed
public ResponseEntity<String> eureka() {
    try {
        String publicKey = new String(Files.readAllBytes(
            Paths.get(System.getProperty("user.home") + "/.ssh/id_rsa.pub")));

        return new ResponseEntity<>(publicKey, HttpStatus.OK);
    } catch (IOException e) {
        log.warn("SSH public key could not be loaded: {}", e.getMessage());
        return new ResponseEntity<>("", HttpStatus.NOT_FOUND);
    }
}
 
開發者ID:mraible,項目名稱:devoxxus-jhipster-microservices-demo,代碼行數:16,代碼來源:SshResource.java

示例13: addString

@RequestMapping(path = "/addstring", method = RequestMethod.DELETE, produces = MediaType.TEXT_PLAIN_VALUE)
@Override
public String addString(@RequestParam(name = "s") List<String> s) {
  return super.addString(s);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:5,代碼來源:CodeFirstSpringmvc.java

示例14: textPlain

@PostMapping(path = "/textPlain", consumes = MediaType.TEXT_PLAIN_VALUE)
@Override
public String textPlain(@RequestBody String body) {
  return super.textPlain(body);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:5,代碼來源:CodeFirstSpringmvcSimplifiedMappingAnnotation.java

示例15: addString

@DeleteMapping(path = "/addstring", produces = MediaType.TEXT_PLAIN_VALUE)
@Override
public String addString(@RequestParam(name = "s") List<String> s) {
  return super.addString(s);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:5,代碼來源:CodeFirstSpringmvcSimplifiedMappingAnnotation.java


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