Spring Framework AbstractHttpMessageConverter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractHttpMessageConverter class.

This code example shows how to use the following methods:
 */ 
package org.androidannotations.rest; 
 
import org.springframework.http.converter.AbstractHttpMessageConverter; 
 
public abstract class AbstractConverter<T> extends AbstractHttpMessageConverter<T> { 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.springframework.http.converter.HttpMessageNotReadableException; 
import org.springframework.http.converter.HttpMessageNotWritableException; 
 
public class WrongConstructorConverter extends AbstractHttpMessageConverter<String> { 
 
	public WrongConstructorConverter(String someParam) { 
	} 
 
	@Override 
	protected boolean supports(Class<?> clazz) { 
		throw new UnsupportedOperationException(); 
	} 
 
	@Override 
	protected String readInternal(Class<? extends String> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { 
		throw new UnsupportedOperationException(); 
	} 
 
	@Override 
	protected void writeInternal(String t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
/** 
 * @author Mark Fisher 
 * @since 2.0 
 */ 
public class StubHttpMessageConverter extends AbstractHttpMessageConverter<String> { 
 
	@Override 
	protected String readInternal(Class<? extends String> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { 
		return null; 
	} 
 
	@Override 
	protected boolean supports(Class<?> clazz) { 
		return false; 
	} 
 
	@Override 
	protected void writeInternal(String t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { 
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.springframework.http.converter.HttpMessageNotWritableException;
 
import com.alibaba.fastjson.JSON; 
import com.alibaba.fastjson.serializer.SerializerFeature; 
 
public class FastJsonHttpMessageConverter extends AbstractHttpMessageConverter<Object> {
 
    public final static Charset UTF8    = Charset.forName("UTF-8");
 
    private Charset             charset = UTF8;
 
    private SerializerFeature[] serializerFeature;
 
    @Override 
    protected boolean supports(Class<? extends Object> clazz) {
        return true; 
    } 
 
    @SuppressWarnings("rawtypes") 
	@Override 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import org.springframework.http.converter.HttpMessageNotWritableException;
 
import com.hp.hpl.jena.rdf.model.Model; 
import com.hp.hpl.jena.rdf.model.ModelFactory; 
 
public class RdfJenaMessageConverter extends AbstractHttpMessageConverter<Model> {
 
	private String lang = "RDF/XML-ABBREV";
 
	@Override 
	protected boolean supports(Class<?> clazz) {
		return Model.class.isAssignableFrom(clazz);
	} 
 
	@Override 
	protected Model readInternal(Class<? extends Model> clazz, HttpInputMessage inputMessage) throws IOException,
			HttpMessageNotReadableException {
		 
		Model model = ModelFactory.createDefaultModel();
		return model.read(inputMessage.getBody(), lang);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    private Marshaller marshaller;
 
    private Unmarshaller unmarshaller;
 
    public MarshallingHttpMessageConverter(Marshaller marshaller) {
        Assert.isInstanceOf(Unmarshaller.class, marshaller);
        this.marshaller = marshaller;
        this.unmarshaller = (Unmarshaller) marshaller;
    } 
 
    public MarshallingHttpMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller) {
        this.unmarshaller = unmarshaller;
        this.marshaller = marshaller;
    } 
 
    public void setMarshaller(Marshaller<Object> marshaller) {
        this.marshaller = marshaller;
    } 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
{ 
	protected static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
 
	public BaseHttpMessageConverter() 
	{ 
		super(); 
	} 
 
	public BaseHttpMessageConverter(MediaType... supportedMediaTypes)
	{ 
		super(supportedMediaTypes);
	} 
 
	public BaseHttpMessageConverter(MediaType supportedMediaType)
	{ 
		super(supportedMediaType);
	} 
 
	protected Charset getCharset(HttpHeaders headers)
	{ 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
	private static final ObjectMapper MAPPER = new ObjectMapper();
 
	private JsonPatchPatchConverter jsonPatchMaker;
 
	public JsonPatchHttpMessageConverter() { 
		setSupportedMediaTypes(Arrays.asList(JSON_PATCH));
		this.jsonPatchMaker = new JsonPatchPatchConverter();
	} 
	 
	@Override 
	protected boolean supports(Class<?> clazz) {
		return Patch.class.isAssignableFrom(clazz);
	} 
 
	@Override 
	protected Patch readInternal(Class<? extends Patch> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
		return jsonPatchMaker.convert(MAPPER.readTree(inputMessage.getBody()));
	} 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:canWrite
    } 
 
    @Override 
    protected boolean canWrite(MediaType mediaType)
    { 
        return super.canWrite(mediaType) || MediaType.TEXT_XML.equals(mediaType);
    } 
 
    @Override 
    protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws IOException
    { 
        try 
        { 
            Unmarshaller unmarshaller = createUnmarshaller(clazz);
            if (clazz.isAnnotationPresent(XmlRootElement.class))
            { 
                return unmarshaller.unmarshal(source);
            } 
            else 
            { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java