As I see it there are 2 pieces here, both related but separate.
First, adding support for parameter substitution in an expression. This would be handled with the changes I discussed above to StreamFactory, StreamParser, and the addition of a new type StreamExpressionSubstitutionParameter. Note that this doesn't necessarily care how the expressions come in.
And second, adding support for parameter substitution in StreamHandler and in an http request. I like the syntax Joel uses in the description. What this would mean is that StreamHandler would see http params like "expr", "left" and "right", would know that these are expressions (can call into StreamFactory to check if something is a valid expression), and would pass them off independently to be parsed and then together to be pieced together.
This approach modularizes the implementation such that how an expression with substitution comes in via http is independent to how it is handled within the Streaming API.
For example, the following comes into StreamHandler
The StreamHandler will see five parameters, expr, baz, left, right, and foo. It would then determine that expr, left, and right are valid expressions and pass them off to be parsed into three expression objects. It would then pass all three into the factory to be combined into a single Stream object. The factory would then iterate (recursively?) until there aren't any more instances of a StreamExpressionSubstitutionParameter at any level (considering the possibility of infinite loops, of course). At this point it'd then just be passed off to create a Stream object as any other expression would be.
Another possibility would be to parse out the substitution expressions and then register them in the factory for use during Stream object creation. This would negate the need to do that pre-processing of the N substitution expression and would give a place to register "pre-compiled" expressions. I'm not a huge fan of this approach as it would add more state to the factory and I'm not a huge fan of the state it already contains.
I'm happy to take this on unless, Cao Manh Dat, you want to continue your work on it.