ゴミ(=JSONConsumer.java)を消した.
1 parent a0e8e12 commit 330efae5bdb6ac24bd441965513fd8c94fcb28d6
r-isitani authored on 2 Jul 2018
Showing 1 changed file
View
46
src/main/java/cactusServer/utils/JSONConsumer.java 100644 → 0
package cactusServer.utils;
 
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
 
import javax.validation.constraints.Null;
import javax.ws.rs.Consumes;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.Provider;
 
import net.arnx.jsonic.JSON;
import net.arnx.jsonic.JSONException;
 
/**
* 多分使用しなくなると思う
* @author student
*
*/
//@Provider
//@Consumes(MediaType.APPLICATION_JSON)
public class JSONConsumer implements MessageBodyReader<Object> {
@Override
public boolean isReadable(Class<?> type, java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations, MediaType mediaType) {
// return true;
return mediaType.isCompatible(MediaType.APPLICATION_JSON_TYPE);
}
 
@Override
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
throws IOException, WebApplicationException {
try {
// return JSON.decode(entityStream,genericType);
return JSON.decode(entityStream, type);
} catch (JSONException e) {
return null;
}
}
}