public ProviderResource(Provider<T> provider) { this.provider = provider; this.resourceClass = ResourceBuilder.rootResourceFromAnnotations(provider.getImpl().getClass()); }
@Override public Class<?> getResourceClass() { return ResourceMethodInvoker.this.method.getResourceClass().getClazz(); } };
public SetterParameterBuilder setter(Method method) { SetterParameter param = new SetterParameter(resourceClass, method, method); return new SetterParameterBuilder(this, param); }
builder.path(base); builder.path(method.getFullpath()); String fullpath = builder.getPath(); if (fullpath == null) { builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) {
@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); } }
public POJOResourceFactory(final ResourceBuilder resourceBuilder, final ResourceClass resourceClass) { this.resourceBuilder = resourceBuilder; this.scannableClass = resourceClass.getClazz(); this.resourceClass = resourceClass; }
@Override public AccessibleObject getAccessibleObject() { return constructor.getConstructor(); }
public ConstructorParameterBuilder param(int i) { return new ConstructorParameterBuilder(this, constructor.getParams()[i]); }
public FieldParameterBuilder field(Field field) { FieldParameter param = new FieldParameter(resourceClass, field); return new FieldParameterBuilder(this, param); }
public LocatorMethodParameterBuilder param(int i) { return new LocatorMethodParameterBuilder(this, locator.getParams()[i]); }
public ResourceMethodParameterBuilder param(int i) { return new ResourceMethodParameterBuilder(this, locator.getParams()[i]); }
public void markMethodAsAsync() { method.markAsynchronous(); } }
public ResourceMethodBuilder consumes(String... consumes) { MediaType[] types = parseMediaTypes(consumes); method.consumes = types; return this; }
public POJOResourceFactory(final ResourceBuilder resourceBuilder, final Class<?> scannableClass) { this.resourceBuilder = resourceBuilder; this.scannableClass = scannableClass; this.resourceClass = resourceBuilder.getRootResourceFromAnnotations(scannableClass); }
protected ConstructorParameter(final ResourceConstructor constructor, final String name, final Class<?> type, final Type genericType, final Annotation[] annotations) { super(constructor.getResourceClass(), type, genericType); this.annotations = annotations; this.constructor = constructor; this.paramName = name; }
public ResourceConstructorBuilder(final ResourceClassBuilder resourceClassBuilder, final Constructor constructor) { this.resourceClassBuilder = resourceClassBuilder; this.constructor = new DefaultResourceConstructor(resourceClassBuilder.resourceClass, constructor); }
public ResourceLocatorBuilder(final ResourceClassBuilder resourceClassBuilder, final Method method, final Method annotatedMethod) { this.resourceClassBuilder = resourceClassBuilder; this.locator = new DefaultResourceLocator(resourceClassBuilder.resourceClass, method, annotatedMethod); }
ResourceMethodBuilder(final ResourceClassBuilder resourceClassBuilder, final Method method, final Method annotatedMethod) { this.method = new DefaultResourceMethod(resourceClassBuilder.resourceClass, method, annotatedMethod); this.locator = this.method; this.resourceClassBuilder = resourceClassBuilder; }
builder.path(base); builder.path(method.getFullpath()); String fullpath = builder.getPath(); if (fullpath == null) { builder.path(base); builder.path(method.getResourceClass().getPath()); String classExpression = builder.getPath(); if (classExpression == null) {
public Class<?> getResourceClass() { return method.getResourceClass().getClazz(); }