當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。