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


Java MediaType.APPLICATION_XML_VALUE属性代码示例

本文整理汇总了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);
}
 
开发者ID:Arquisoft,项目名称:participants1b,代码行数:21,代码来源:UpdateInfoController.java

示例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"));
}
 
开发者ID:durimkryeziu,项目名称:family-tree-xml-parser,代码行数:9,代码来源:DocumentController.java

示例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);
}
 
开发者ID:rhawan,项目名称:microservices-tcc-alfa,代码行数:11,代码来源:UserController.java

示例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);
}
 
开发者ID:Arquisoft,项目名称:participants1b,代码行数:30,代码来源:GetParticipantInfoController.java

示例5: rastrearObjetoXml

@RequestMapping(value = "/rastrear/xml/{objeto}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE)
Sroxml rastrearObjetoXml(@PathVariable String objeto) {
    return correiosRastreador.consultaObjeto(objeto);
}
 
开发者ID:wmixvideo,项目名称:correios-web,代码行数:4,代码来源:CorreiosRastreamentoRestController.java

示例6: getVersion

@RequestMapping(value = "/version", method = RequestMethod.GET,
        produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
public ServiceInfo getVersion() {
    return serviceInfo;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:5,代码来源:DataServiceInfoController.java

示例7: getXml

/**
 * Returns a simple XML payload.
 * 
 * @return
 */
@GetMapping(path = "/", produces = MediaType.APPLICATION_XML_VALUE)
String getXml() {
	return "<user>".concat(XML_PAYLOAD).concat("</user>");
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:9,代码来源:UserController.java

示例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>");
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:10,代码来源:UserController.java


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