@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); } } } }
@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; }
if (parameter instanceof ContextualParameter) { Type genericParameterType = genericParameterTypes[i]; parameterList.set(i, new ContextualParameter(parameter.getName(), annotations, parameterTypes[i], genericParameterType)); } else if (parameter instanceof PhaseParameter) { PhaseParameter phaseParameter = (PhaseParameter)parameter;
if (parameter instanceof ContextualParameter) { Type genericParameterType = genericParameterTypes[i]; parameterList.set(i, new ContextualParameter(parameter.getName(), annotations, parameterTypes[i], genericParameterType)); } else if (parameter instanceof PhaseParameter) { PhaseParameter phaseParameter = (PhaseParameter)parameter;
@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 = 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; }
ContextualParameter argument = new ContextualParameter("argument", Response.Error.class); handler = new ControllerHandler<Phase.View>(null, Phase.VIEW, a, m, Collections.<ControlParameter>singletonList(argument)); request = new Request(this, handler, bridge);
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; } } } }
ContextualParameter argument = new ContextualParameter("argument", Response.Error.class); handler = new ControllerHandler<Phase.View>(null, Phase.VIEW, a, m, Collections.<ControlParameter>singletonList(argument)); request = new Request(this, handler, bridge);
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;