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