org.clazzes.util.http.aop
@Retention(value=RUNTIME) @Target(value={METHOD,TYPE}) public @interface InvocationHttpContext
An annotation, which provides a context for an invocation. It allows to replace bean
properties of the passed MethodInvocation
to be evaluated by a reduced form of
bean retrieval expressions, which supports property fetching through a .
(dot)
operator and subscripts in arrays.
The annotation may be attached to interfaces or individual methods as in the following example:
@InvocationHttpContext(value="/ctxt?m=%s&rv=%s",args={"method.name","method.returnType.simpleName"}) public interface RpcTestInterface extends CheckedRemoteService { @InvocationHttpContext(value="/ctxt?id=%s",args="arguments[0]") public void foo(String bar); @InvocationHttpContext(value="/ctxt?id=%s",args="arguments[0].id") public void pojoFoo(TestPOJO bar); @InvocationHttpContext(value="/ctxt?x=%5.3f",args="arguments[0][arguments[1].count]") public void choose(double[] arr,TestPOJO bar); @InvocationHttpContext(value="/ctxt?nm=%s",args="arguments[0][arguments[1]].name") public void choosePojoList(Listarr,int i); @InvocationHttpContext(value="/ctxt?nm=%s",args="arguments[0][arguments[1]].name") public void choosePojo(TestPOJO[] arr,int i); // use context provided by the annotation to the interface above. public String helloWorld(); }
String properties are inserted to the format expression in HTML-quoted form,
arguments
refers to the actual arguments passed to the method.
public abstract String value
String.format(java.util.Locale, String, Object...)
using Locale.US
. If format specifiers are present,
args()
must be set with bean expressions to set
the arguments.Copyright © 2014 Clazzes.org. All Rights Reserved.