@Override public Map<ContextualParameter, Object> getContextualArguments(Set<ContextualParameter> parameters) { Map<ContextualParameter, Object> args = Collections.emptyMap(); for (ContextualParameter parameter : parameters) { if (EventQueue.class.isAssignableFrom(parameter.getType())) { PortletEventProducer producer = new PortletEventProducer(); if (args.isEmpty()) { args = new HashMap<ContextualParameter, Object>(); } args.put(parameter, producer); } } return args; }
@Override public Map<ContextualParameter, Object> getContextualArguments(Set<ContextualParameter> parameters) { Map<ContextualParameter, Object> args = Collections.emptyMap(); for (ContextualParameter parameter : parameters) { if (EventQueue.class.isAssignableFrom(parameter.getType())) { PortletEventProducer producer = new PortletEventProducer(); if (args.isEmpty()) { args = new HashMap<ContextualParameter, Object>(); } args.put(parameter, producer); } } return args; }
@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); } } } }
ContextualParameter contextualParam = argument.getKey(); FileItem file = files.get(contextualParam.getName()); if (file != null && FileItem.class.isAssignableFrom(contextualParam.getType())) { argument.setValue(file);
@Override public Map<ContextualParameter, Object> getContextualArguments(Set<ContextualParameter> parameters) { Map<ContextualParameter, Object> args = super.getContextualArguments(parameters); for (ContextualParameter parameter : parameters) { ContextualParameter contextualParameter = (ContextualParameter)parameter; if (Event.class.isAssignableFrom(contextualParameter.getType())) { Class payloadType = Introspector.resolveToClass(contextualParameter.getGenericType(), Event.class, 0); if (payloadType.isInstance(req.getEvent().getValue())) { if (args.isEmpty()) { args = new HashMap<ContextualParameter, Object>(); } args.put(parameter, new Event(req.getEvent().getName(), req.getEvent().getValue())); } } } return args; }
@Override public Map<ContextualParameter, Object> getContextualArguments(Set<ContextualParameter> parameters) { Map<ContextualParameter, Object> args = super.getContextualArguments(parameters); for (ContextualParameter parameter : parameters) { ContextualParameter contextualParameter = (ContextualParameter)parameter; if (Event.class.isAssignableFrom(contextualParameter.getType())) { Class payloadType = Introspector.resolveToClass(contextualParameter.getGenericType(), Event.class, 0); if (payloadType.isInstance(req.getEvent().getValue())) { if (args.isEmpty()) { args = new HashMap<ContextualParameter, Object>(); } args.put(parameter, new Event(req.getEvent().getName(), req.getEvent().getValue())); } } } return args; }
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; } } } }
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; } } } }
value = request.getContextualArguments().get(contextualParameter); if (value == null) { Class<?> contextualType = contextualParameter.getType(); if (RequestContext.class.isAssignableFrom(contextualType)) { value = context;
value = request.getContextualArguments().get(contextualParameter); if (value == null) { Class<?> contextualType = contextualParameter.getType(); if (RequestContext.class.isAssignableFrom(contextualType)) { value = context;