@Override public Object invoke(HttpRequest request, HttpResponse httpResponse, Object resource) throws Failure, ApplicationException { if (!Provider.class.isInstance(resource)) { return super.invoke(request, httpResponse, resource); } Object[] args = injectArguments(request, httpResponse); RestfulContainerRequest req = new RestfulContainerRequest(); req.setInterfaceName(method.getResourceClass().getClazz().getName()); req.setMethodName(method.getMethod().getName()); req.setParamtersDesc(ReflectUtil.getMethodParamDesc(method.getMethod())); req.setArguments(args); req.setHttpRequest(request); req.setAttachments(RestfulUtil.decodeAttachments(request.getMutableHeaders())); try { Response resp = Provider.class.cast(resource).call(req); RestfulUtil.encodeAttachments(httpResponse.getOutputHeaders(), resp.getAttachments()); return resp.getValue(); } catch (Exception e) { if (e != null && e instanceof RuntimeException) { throw (RuntimeException) e; } throw new InternalServerErrorException("provider call process error:" + e.getMessage(), e); } }
protected MethodParameter(final ResourceLocator locator, final String name, final Class<?> type, final Type genericType, final Annotation[] annotations) { super(locator.getResourceClass(), type, genericType); this.annotations = annotations; this.locator = locator; this.paramName = name; }
builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) {
builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) {
public ServiceRegistry(final ServiceRegistry parent, final ResourceMethodRegistry registry, final ResteasyProviderFactory providerFactory, final ResourceLocatorInvoker invoker) throws Exception { this.parent = parent; this.registry = registry; this.providerFactory = providerFactory; this.invoker = invoker; if(invoker != null){ Method method = invoker.getMethod(); ResourceLocator resourceLocator = MethodMetaData.getResourceLocator(invoker); String methodPathVal = resourceLocator.getPath(); String classPathVal = resourceLocator.getResourceClass().getPath(); this.uri = MethodMetaData.appendURIFragments(parent, classPathVal, methodPathVal); if(parent.isRoot()) this.functionPrefix = method.getDeclaringClass().getSimpleName() + "." + method.getName(); else this.functionPrefix = parent.getFunctionPrefix() + "." + method.getName(); } scanRegistry(); }
public MethodInjectorImpl(final ResourceLocator resourceMethod, final ResteasyProviderFactory factory) { this.factory = factory; this.method = resourceMethod; this.interfaceBasedMethod = findInterfaceBasedMethod(resourceMethod.getResourceClass().getClazz(), resourceMethod.getMethod()); params = new ValueInjector[resourceMethod.getParams().length]; int i = 0; for (MethodParameter parameter : resourceMethod.getParams()) { params[i] = factory.getInjectorFactory().createParameterExtractor(parameter, factory); if (params[i] instanceof MessageBodyParameterInjector) expectsBody = true; i++; } }
protected MethodParameter(final ResourceLocator locator, final String name, final Class<?> type, final Type genericType, final Annotation[] annotations) { super(locator.getResourceClass(), type, genericType); this.annotations = annotations; this.locator = locator; this.paramName = name; }
protected MethodParameter(ResourceLocator locator, Class<?> type, Type genericType,Annotation[] annotations) { super(locator.getResourceClass(), type, genericType); this.annotations = annotations; this.locator = locator; }
if (base != null) builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null)
public ServiceRegistry(ServiceRegistry parent, ResourceMethodRegistry registry, ResteasyProviderFactory providerFactory, ResourceLocatorInvoker invoker) throws Exception { this.parent = parent; this.registry = registry; this.providerFactory = providerFactory; this.invoker = invoker; if(invoker != null){ Method method = invoker.getMethod(); ResourceLocator resourceLocator = MethodMetaData.getResourceLocator(invoker); String methodPathVal = resourceLocator.getPath(); String classPathVal = resourceLocator.getResourceClass().getPath(); this.uri = MethodMetaData.appendURIFragments(parent, classPathVal, methodPathVal); if(parent.isRoot()) this.functionPrefix = method.getDeclaringClass().getSimpleName() + "." + method.getName(); else this.functionPrefix = parent.getFunctionPrefix() + "." + method.getName(); } scanRegistry(); }
public MethodInjectorImpl(final ResourceLocator resourceMethod, final ResteasyProviderFactory factory) { this.factory = factory; this.method = resourceMethod; this.interfaceBasedMethod = findInterfaceBasedMethod(resourceMethod.getResourceClass().getClazz(), resourceMethod.getMethod()); params = new ValueInjector[resourceMethod.getParams().length]; int i = 0; for (MethodParameter parameter : resourceMethod.getParams()) { params[i] = factory.getInjectorFactory().createParameterExtractor(parameter, factory); if (params[i] instanceof MessageBodyParameterInjector) expectsBody = true; i++; } }
public MethodInjectorImpl(ResourceLocator resourceMethod, ResteasyProviderFactory factory) { this.factory = factory; this.method = resourceMethod; this.interfaceBasedMethod = findInterfaceBasedMethod(resourceMethod.getResourceClass().getClazz(), resourceMethod.getMethod()); params = new ValueInjector[resourceMethod.getParams().length]; int i = 0; for (MethodParameter parameter : resourceMethod.getParams()) { params[i] = factory.getInjectorFactory().createParameterExtractor(parameter, factory); if (params[i] instanceof MessageBodyParameterInjector) expectsBody = true; i++; } }
if (base != null) builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null)
if (base != null) builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null)
builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) {