List of usage examples for org.springframework.http MediaType APPLICATION_XML
MediaType APPLICATION_XML
To view the source code for org.springframework.http MediaType APPLICATION_XML.
Click Source Link
From source file:example.xmlbeam.XmlBeamHttpMessageConverter.java
@Override public boolean canRead(Class<?> clazz, MediaType mediaType) { return clazz.isInterface() && mediaType.isCompatibleWith(MediaType.APPLICATION_XML); }
From source file:gt.dakaik.config.WebContext.java
@Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false).favorParameter(false).ignoreAcceptHeader(false).useJaf(false) .defaultContentType(MediaType.APPLICATION_JSON).mediaType("xml", MediaType.APPLICATION_XML) .mediaType("json", MediaType.APPLICATION_JSON); }
From source file:at.create.android.ffc.http.HttpBase.java
/** * Set the Accept header for "application/xml". *//*ww w . ja v a 2 s. co m*/ protected void setAcceptHeaderApplicationXml() { List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>(); acceptableMediaTypes.add(MediaType.APPLICATION_XML); requestHeaders.setAccept(acceptableMediaTypes); }
From source file:org.projecthdata.social.api.impl.RootTemplate.java
public RootTemplate(HData hData, RestTemplate restTemplate, boolean isAuthorizedForUser) { super(isAuthorizedForUser); this.restTemplate = restTemplate; this.hData = hData; this.ehrUri = URI.create(hData.getEhrUrl()); // setup the correct accept headers for processing an atom feed List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>(); acceptableMediaTypes.add(MediaType.APPLICATION_ATOM_XML); acceptableMediaTypes.add(MediaType.APPLICATION_XML); HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAccept(acceptableMediaTypes); this.atomFeedRequestEntity = new HttpEntity<Object>(requestHeaders); }
From source file:biz.c24.io.spring.http.C24HttpMessageConverterUnitTests.java
@Test public void cannotConvertNonComplexDataObject() { assertThat(converter.canRead(String.class, MediaType.APPLICATION_XML), is(false)); }
From source file:net.paslavsky.springrest.HttpHeadersHelperTest.java
@DataProvider public Object[][] data() { DateFormat dateFormat = createDateFormat(); final long currentTime = System.currentTimeMillis(); final String currentTimeStr = dateFormat.format(new Date(currentTime)); return new Object[][] { new Object[] { "Other", new Object[] { 123 }, "123" }, new Object[] { "Other", new Object[] { "123" }, "123" }, new Object[] { "Other", new String[] { "123" }, "123" }, new Object[] { "Other", Arrays.asList("123"), "123" }, new Object[] { "Other", "123", "123" }, new Object[] { "Accept", MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON_VALUE }, new Object[] { "Accept", Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML), MediaType.APPLICATION_JSON_VALUE + ", " + MediaType.APPLICATION_XML_VALUE }, new Object[] { "Accept-Charset", java.nio.charset.Charset.forName("UTF-8"), "utf-8" }, new Object[] { "Allow", HttpMethod.GET, "GET" }, new Object[] { "Allow", new TreeSet<HttpMethod>(Arrays.asList(HttpMethod.PUT, HttpMethod.POST)), "POST,PUT" }, new Object[] { "Connection", "close", "close" }, new Object[] { "Content-Disposition", "form-data; name=\"AttachedFile1\"; filename=\"photo-1.jpg\"", "form-data; name=\"AttachedFile1\"; filename=\"photo-1.jpg\"" }, new Object[] { "Content-Disposition", new String[] { "AttachedFile1", "photo-1.jpg" }, "form-data; name=\"AttachedFile1\"; filename=\"photo-1.jpg\"" }, new Object[] { "Content-Disposition", "AttachedFile1", "form-data; name=\"AttachedFile1\"" }, new Object[] { "Content-Length", 123l, "123" }, new Object[] { "Content-Type", MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON_VALUE }, new Object[] { "Content-Type", MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, new Object[] { "Date", currentTime, currentTimeStr }, new Object[] { "ETag", "W/\"123456789\"", "W/\"123456789\"" }, new Object[] { "Expires", currentTime, currentTimeStr }, new Object[] { "If-Modified-Since", currentTime, currentTimeStr }, new Object[] { "If-None-Match", "737060cd8c284d8af7ad3082f209582d", "737060cd8c284d8af7ad3082f209582d" }, new Object[] { "Last-Modified", currentTime, currentTimeStr }, new Object[] { "Location", "http://example.com/", "http://example.com/" }, new Object[] { "Location", URI.create("http://example.com/"), "http://example.com/" }, new Object[] { "Origin", "www.a.com", "www.a.com" }, new Object[] { "Pragma", "no-cache", "no-cache" }, new Object[] { "Upgrade", "HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11", "HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11" }, }; }
From source file:com.orange.ngsi.client.NgsiClientTest.java
@Test public void getRequestHeadersWithoutUrl() { HttpHeaders httpHeaders = ngsiClient.getRequestHeaders(); assertEquals(MediaType.APPLICATION_XML, httpHeaders.getContentType()); assertTrue(httpHeaders.getAccept().contains(MediaType.APPLICATION_XML)); }
From source file:example.users.UserControllerIntegrationTests.java
@Test public void handlesXmlPayLoadWithExactProperties() throws Exception { postAndExpect("<user><firstname>Dave</firstname><lastname>Matthews</lastname></user>", MediaType.APPLICATION_XML); }
From source file:com.expedia.client.WunderGroundClient.java
@Override public ResponseEntity<Response> getXMLResponse(Object request) { ResponseEntity<Response> responseEntity = null; Weather weather = null;/* w ww. jav a 2s .co m*/ if (request instanceof Weather) { weather = (Weather) request; List<MediaType> mediaTypes = new ArrayList<MediaType>(); mediaTypes.add(MediaType.APPLICATION_XML); HttpHeaders headers = new HttpHeaders(); headers.setAccept(mediaTypes); HttpEntity<Weather> httpEntity = new HttpEntity<Weather>(null, headers); try { System.out.println("Hitting weather service!"); responseEntity = restTemplate.exchange(weatherServiceXmlUrl, HttpMethod.GET, httpEntity, Response.class, weatherApiKey, weather.getZipCode()); } catch (RuntimeException e) { e.printStackTrace(); weather.setErrorDesc("Get failed" + e.getMessage()); } } return responseEntity; }
From source file:biz.c24.io.spring.http.C24HttpMessageConverterUnitTests.java
@Test public void cannotConvertNonMatchingMediaType() { C24HttpMessageConverter converter = new C24HttpMessageConverter(model, Collections.singleton(new DataFormat(Type.TEXT))); assertThat(converter.canRead(CustomerLocal.class, MediaType.APPLICATION_XML), is(false)); }