Java Code Examples for org.springframework.http.MediaType#APPLICATION_XML

The following examples show how to use org.springframework.http.MediaType#APPLICATION_XML . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtobufHttpMessageConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a new instance with an {@link ExtensionRegistryInitializer}
 * that allows the registration of message extensions.
 */
public ProtobufHttpMessageConverter(ExtensionRegistryInitializer registryInitializer) {
	super(PROTOBUF, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML);
	if (registryInitializer != null) {
		registryInitializer.initializeExtensionRegistry(this.extensionRegistry);
	}
}
 
Example 2
Source File: XMLErrorMessageRendererTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
void shouldHandleRequest() {
    final XMLErrorMessageRenderer messageRenderer = new XMLErrorMessageRenderer(MediaType.APPLICATION_XML);
    assertThat(messageRenderer.getContentType()).isEqualTo(MediaType.APPLICATION_XML);
    assertThat(messageRenderer.getFormattedMessage("You are not authorized to access this URL. Some<xml>!")).isEqualTo("<access-denied>\n" +
            "  <message>You are not authorized to access this URL. Some&lt;xml&gt;!</message>\n" +
            "</access-denied>\n");
}
 
Example 3
Source File: ProtobufHttpMessageConverter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a new instance with an {@link ExtensionRegistryInitializer}
 * that allows the registration of message extensions.
 */
public ProtobufHttpMessageConverter(ExtensionRegistryInitializer registryInitializer) {
	super(PROTOBUF, MediaType.TEXT_PLAIN, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON);
	if (registryInitializer != null) {
		registryInitializer.initializeExtensionRegistry(this.extensionRegistry);
	}
}
 
Example 4
Source File: MappingContentNegotiationStrategyTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected MediaType handleNoMatch(NativeWebRequest request, String mappingKey) {
	return "xml".equals(mappingKey) ? MediaType.APPLICATION_XML : null;
}
 
Example 5
Source File: MethodParameterDetailsTest.java    From jfilter with Apache License 2.0 4 votes vote down vote up
@Test
public void testNotEquals() {
    MethodParameterDetails methodParameterDetails1 = new MethodParameterDetails(methodParameter, MediaType.APPLICATION_JSON, new FilterFields());
    MethodParameterDetails methodParameterDetails2 = new MethodParameterDetails(methodParameter, MediaType.APPLICATION_XML, null);
    assertNotEquals(methodParameterDetails1, methodParameterDetails2);
}
 
Example 6
Source File: MethodParameterDetailsTest.java    From jfilter with Apache License 2.0 4 votes vote down vote up
@Test
public void testNotEqualsMediaType() {
    MethodParameterDetails methodParameterDetails1 = new MethodParameterDetails(methodParameter, MediaType.APPLICATION_JSON, null);
    MethodParameterDetails methodParameterDetails2 = new MethodParameterDetails(methodParameter, MediaType.APPLICATION_XML, null);
    assertNotEquals(methodParameterDetails1, methodParameterDetails2);
}
 
Example 7
Source File: ExceptionThrowingController.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@GetMapping("/re/void/xml")
public void voidWithResponseEntityExceptionAsXml() {
    throw new HandledResponseEntityException("bad state", MediaType.APPLICATION_XML);
}
 
Example 8
Source File: MappingContentNegotiationStrategyTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected MediaType handleNoMatch(NativeWebRequest request, String mappingKey) {
	return "xml".equals(mappingKey) ? MediaType.APPLICATION_XML : null;
}
 
Example 9
Source File: MappingContentNegotiationStrategyTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
protected MediaType handleNoMatch(NativeWebRequest request, String mappingKey) {
	return "xml".equals(mappingKey) ? MediaType.APPLICATION_XML : null;
}
 
Example 10
Source File: AbstractXmlHttpMessageConverter.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Protected constructor that sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
protected AbstractXmlHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 11
Source File: SourceHttpMessageConverter.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
public SourceHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 12
Source File: AbstractXmlHttpMessageConverter.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Protected constructor that sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
protected AbstractXmlHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 13
Source File: AbstractXmlHttpMessageConverter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Protected constructor that sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
protected AbstractXmlHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 14
Source File: SourceHttpMessageConverter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
public SourceHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 15
Source File: AbstractXmlHttpMessageConverter.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Protected constructor that sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
protected AbstractXmlHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 16
Source File: SourceHttpMessageConverter.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
public SourceHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}
 
Example 17
Source File: Entity.java    From sinavi-jfw with Apache License 2.0 2 votes vote down vote up
/**
 * ContentTypeがapplication/xmlのヘッダとリクエストデータを設定します。
 * @param entity リクエストデータ
 * @param <T> リクエストデータの型
 * @return このユーティリティを返します。
 */
public static <T> Entity<T> xml(final T entity) {
    return new Entity<T>(entity, MediaType.APPLICATION_XML);
}
 
Example 18
Source File: SourceHttpMessageConverter.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Sets the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes}
 * to {@code text/xml} and {@code application/xml}, and {@code application/*-xml}.
 */
public SourceHttpMessageConverter() {
	super(MediaType.APPLICATION_XML, MediaType.TEXT_XML, new MediaType("application", "*+xml"));
}