protected Map<String, String> getHeaders(AnnotatedElement annotatedElement) { final Map<String, String> headersMap = new HashMap<String, String>(); final Headers headersAnnotation = annotatedElement.getAnnotation(Headers.class); if (null != headersAnnotation && null != headersAnnotation.value()) { for (Header header : headersAnnotation.value()) { addHeaders(headersMap, header); } } addHeaders(headersMap, annotatedElement.getAnnotation(Header.class)); return headersMap; }
protected Map<String, String> getHeaders(Class<?> clazz, Method method) { final Map<String, String> headers = getHeaders(clazz); headers.putAll(getHeaders(method)); return headers; }
@Override public Object[] resolve(Method method) { Object[] values = new Object[method.getParameterTypes().length]; Class<?>[] parameterTypes = method.getParameterTypes(); final Consumes consumes = method.getDeclaringClass().getAnnotation(Consumes.class); final Produces produces = method.getDeclaringClass().getAnnotation(Produces.class); if (responseInst.get() != null) { for (int i = 0; i < parameterTypes.length; i++) { if (Response.class.isAssignableFrom(parameterTypes[i])) { values[i] = responseInst.get(); } } } else { for (int i = 0; i < parameterTypes.length; i++) { final Annotation[] parameterAnnotations = method.getParameterAnnotations()[i]; for (Annotation annotation : parameterAnnotations) { if (annotation instanceof ArquillianResteasyResource) { ArquillianResteasyResource arr = (ArquillianResteasyResource) annotation; Class<?> clazz = parameterTypes[i]; if (isSupportedParameter(clazz)) { values[i] = enrichByType(clazz, method, arr, consumes, produces); } else { throw new RuntimeException("Not able to provide a client injection for type " + clazz); } } } } } return values; }
protected URI getBaseURL() { HTTPContext context = metaDataInst.get().getContext(HTTPContext.class); if (allInSameContext(context.getServlets())) { return context.getServlets().get(0).getBaseURI(); } throw new IllegalStateException("No baseURL found in HTTPContext"); }