本文整理汇总了Java中org.springframework.http.MediaType.APPLICATION_XML_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.APPLICATION_XML_VALUE属性的具体用法?Java MediaType.APPLICATION_XML_VALUE怎么用?Java MediaType.APPLICATION_XML_VALUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.http.MediaType
的用法示例。
在下文中一共展示了MediaType.APPLICATION_XML_VALUE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postHTML2
@RequestMapping(
value = "/changeInfo",
method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE },
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<ChangePasswordInfo> postHTML2(@RequestBody ChangePassword info){
if (info.getEmail() == null || info.getPassword() == null || info.getNewPassword() == null
|| info.getEmail().equals("") || info.getPassword().equals("") || info.getNewPassword().equals("")) {
throw new HTTP404Exception("No se han introducido todos los datos");
}
Ciudadano ci = updateInfo.UpdateCitizen(info);
if (ci == null) {
throw new HTTP404Exception("Email o contraseña incorrectas");
}
return new ResponseEntity<ChangePasswordInfo>(new ChangePasswordInfo("Se ha cambiado correctamente la contraseña"),
HttpStatus.OK);
}
示例2: addDoc
@PostMapping(value = "documents", consumes = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<Response> addDoc(@RequestBody Entries entries) {
service.insertDoc(entries);
return ResponseEntity.status(HttpStatus.CREATED)
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(new Response("Document inserted successfully"));
}
示例3: getUser
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE,
MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<User> getUser(@PathVariable("id") long id) {
System.out.println("Fetching User with id " + id);
User user = userRepository.findOne(id);
if (user == null) {
System.out.println("User with id " + id + " not found");
return new ResponseEntity<User>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<User>(user, HttpStatus.OK);
}
示例4: getInfoParticipant
@RequestMapping(value = "/user",
method = RequestMethod.POST,
produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE },
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<ParticipantsInfo> getInfoParticipant(@RequestBody ParticipantsLogin info){
if (info.getEmail() == null || info.getPassword() == null
|| info.getEmail().equals("") || info.getPassword().equals("")) {
throw new HTTP404Exception("No se han intriducido datos");
}
Pattern pattern = Pattern.compile("[A-Za-z0-9._%+-][email protected][A-Za-z0-9.-]+.[A-Za-z]");
Matcher mat = pattern.matcher(info.getEmail());
if(!mat.matches())
throw new HTTP404Exception("El email no cumple con el formato requerido");
Ciudadano ci = getParticipantDB.getCiudadano(info);
if (ci == null) {
throw new HTTP404Exception("No existe un usuario con ese email");
}
if(!ci.getPassword().equals(info.getPassword()))
{
throw new HTTP404Exception("Contraseña incorrecta");
}
return new ResponseEntity<ParticipantsInfo>(new ParticipantsInfo(ci), HttpStatus.OK);
}
示例5: rastrearObjetoXml
@RequestMapping(value = "/rastrear/xml/{objeto}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE)
Sroxml rastrearObjetoXml(@PathVariable String objeto) {
return correiosRastreador.consultaObjeto(objeto);
}
示例6: getVersion
@RequestMapping(value = "/version", method = RequestMethod.GET,
produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
public ServiceInfo getVersion() {
return serviceInfo;
}
示例7: getXml
/**
* Returns a simple XML payload.
*
* @return
*/
@GetMapping(path = "/", produces = MediaType.APPLICATION_XML_VALUE)
String getXml() {
return "<user>".concat(XML_PAYLOAD).concat("</user>");
}
示例8: getChangedXml
/**
* Returns the payload of {@link #getXml()} wrapped into another XML element to simulate a change in the
* representation structure.
*
* @return
*/
@GetMapping(path = "/changed", produces = MediaType.APPLICATION_XML_VALUE)
String getChangedXml() {
return "<user><username>".concat(XML_PAYLOAD).concat("</username></user>");
}