Example usage for org.springframework.http MediaType APPLICATION_ATOM_XML

List of usage examples for org.springframework.http MediaType APPLICATION_ATOM_XML

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_ATOM_XML.

Prototype

MediaType APPLICATION_ATOM_XML

To view the source code for org.springframework.http MediaType APPLICATION_ATOM_XML.

Click Source Link

Document

Public constant media type for application/atom+xml .

Usage

From source file:com.wavemaker.commons.util.WMUtils.java

public static boolean isXmlMediaType(MediaType mediaType) {
    return MediaType.APPLICATION_XML.equals(mediaType) || MediaType.TEXT_XML.equals(mediaType)
            || MediaType.APPLICATION_ATOM_XML.equals(mediaType);
}

From source file:nl.iwelcome.connector.google.MyJaxb2Converter.java

@Override
public List<MediaType> getSupportedMediaTypes() {
    return Arrays.asList(MediaType.APPLICATION_ATOM_XML);
}

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:com.bodybuilding.argos.controller.SseEmitterUtilTest.java

@Test
public void testBindObservable_mediaType() throws IOException {
    SseEmitterUtil.emitSse(emitter, "test", MediaType.APPLICATION_ATOM_XML);
    verify(emitter).send(eq("test"), eq(MediaType.APPLICATION_ATOM_XML));
}

From source file:com.github.cherimojava.data.spring._EntityConverter.java

@Test
public void testOnlyJson() {
    assertFalse(new EntityConverter(null).canRead(Type.class, Class.class, MediaType.APPLICATION_ATOM_XML));
}

From source file:com.erudika.scoold.controllers.SearchController.java

@ResponseBody
@GetMapping("/feed.xml")
public ResponseEntity<String> feed() {
    String feed = "";
    try {/*from w w w . j a va  2 s  .co  m*/
        feed = new SyndFeedOutput().outputString(getFeed());
    } catch (Exception ex) {
        logger.error("Could not generate feed", ex);
    }
    return ResponseEntity.ok().contentType(MediaType.APPLICATION_ATOM_XML)
            .cacheControl(CacheControl.maxAge(1, TimeUnit.HOURS)).eTag(Utils.md5(feed)).body(feed);
}

From source file:com.devnexus.ting.web.config.WebConfig.java

@Bean
public AtomFeedHttpMessageConverter atomConverter() {
    AtomFeedHttpMessageConverter converter = new AtomFeedHttpMessageConverter();
    converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_ATOM_XML));
    return converter;
}

From source file:org.eclipse.hawkbit.ddi.rest.resource.DdiDeploymentBaseTest.java

@Test
@Description("Test various invalid access attempts to the deployment resource und the expected behaviour of the server.")
public void badDeploymentAction() throws Exception {
    final Target target = testdataFactory.createTarget("4712");

    // not allowed methods
    mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/1", tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());

    mvc.perform(put("/{tenant}/controller/v1/4712/deploymentBase/1", tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());

    mvc.perform(delete("/{tenant}/controller/v1/4712/deploymentBase/1", tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());

    // non existing target
    mvc.perform(get("/{tenant}/controller/v1/4715/deploymentBase/1", tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());

    // no deployment
    mvc.perform(get("/controller/v1/4712/deploymentBase/1", tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());

    // wrong media type
    final List<Target> toAssign = Arrays.asList(target);
    final DistributionSet savedSet = testdataFactory.createDistributionSet("");

    final Long actionId = assignDistributionSet(savedSet, toAssign).getActions().get(0);
    mvc.perform(get("/{tenant}/controller/v1/4712/deploymentBase/" + actionId, tenantAware.getCurrentTenant()))
            .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
    mvc.perform(get("/{tenant}/controller/v1/4712/deploymentBase/" + actionId, tenantAware.getCurrentTenant())
            .accept(MediaType.APPLICATION_ATOM_XML)).andDo(MockMvcResultPrinter.print())
            .andExpect(status().isNotAcceptable());
}

From source file:org.zalando.riptide.FailedDispatchTest.java

@Test
public void shouldThrowOnFailedConversionBecauseOfUnknownContentType() {
    server.expect(requestTo(url))/*from www  . j a  v  a 2 s. com*/
            .andRespond(withSuccess().body("{}").contentType(MediaType.APPLICATION_ATOM_XML));

    exception.expect(RestClientException.class);
    exception.expectMessage("no suitable HttpMessageConverter found for response type");

    unit.execute(GET, url).dispatch(status(),
            on(HttpStatus.OK).dispatch(series(), on(SUCCESSFUL, Success.class).capture(),
                    anySeries().capture()),
            on(HttpStatus.CREATED, Success.class).capture(), anyStatus().call(this::fail));
}