public InputStream getInputStream() throws IOException { return context.getInputStream(); } };
public String getContentType() { return context.getContentType(); } public int getContentLength() {
public String getCharacterEncoding() { return context.getCharacterEncoding(); } public String getContentType() {
public int getContentLength() { return context.getContentLenth(); } public InputStream getInputStream() throws IOException {
@Override public void unmarshall( String mediaType, ClientContext context, Iterable<Map.Entry<ContextualParameter, Object>> contextualArguments, Map<String, RequestParameter> parameterArguments) throws IOException { // ObjectMapper mapper = new ObjectMapper(); // Parse the payload first JsonNode tree = mapper.readTree(context.getInputStream()); for (Map.Entry<ContextualParameter, Object> contextualArgument : contextualArguments) { Class<?> type = contextualArgument.getKey().getType(); if (JsonNode.class.isAssignableFrom(type)) { contextualArgument.setValue(tree); } else if (contextualArgument.getKey().getAnnotations().getAnnotation(Jackson.class) != null) { Object value = mapper.readValue(new TreeTraversingParser(tree), type); contextualArgument.setValue(value); } } } }
String contentType = clientContext.getContentType(); if (contentType != null) { Spliterator i = new Spliterator(contentType, ';');
public void unmarshall(String mediaType, ClientContext context, Iterable<Map.Entry<ContextualParameter, Object>> contextualArguments, Map<String, RequestParameter> parameterArguments) throws IOException { byte[] data = Tools.bytes(context.getInputStream()); Foo foo = new Foo(data); for (Map.Entry<ContextualParameter, Object> parameter : contextualArguments) { if (parameter.getKey().getType().equals(Foo.class)) { parameter.setValue(foo); break; } } } }
String contentType = clientContext.getContentType(); if (contentType != null) { Spliterator i = new Spliterator(contentType, ';');
public void unmarshall(String mediaType, ClientContext context, Iterable<Map.Entry<ContextualParameter, Object>> contextualArguments, Map<String, RequestParameter> parameterArguments) throws IOException { byte[] data = Tools.bytes(context.getInputStream()); Foo foo = new Foo(data); for (Map.Entry<ContextualParameter, Object> parameter : contextualArguments) { if (parameter.getKey().getType().equals(Foo.class)) { parameter.setValue(foo); break; } } } }