<p dir="auto">In <code class="notranslate">onResponse</code> callback, we cannot change the value in AppResponse if the value is a primitive type.</p>
<p dir="auto">The following code doesn't work on 2.7.2.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Activate(group = {&quot;provider&quot;})
public class TraceFilter implements Filter {
    @Override
    public Result invoke(Invoker&lt;?&gt; invoker, Invocation invocation) throws RpcException {
        Result result = invoker.invoke(invocation);
        Object o = result.getValue();
        if (o instanceof String) {
            String s = (String) o;
            s += &quot;filtered: &quot;;
            result.setValue(s);
        }
        return result;
    }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Activate</span>(<span class="pl-s1">group</span> = {<span class="pl-s">"provider"</span>})
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">TraceFilter</span> <span class="pl-k">implements</span> <span class="pl-smi">Filter</span> {
    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">Result</span> <span class="pl-en">invoke</span>(<span class="pl-smi">Invoker</span>&lt;?&gt; <span class="pl-s1">invoker</span>, <span class="pl-smi">Invocation</span> <span class="pl-s1">invocation</span>) <span class="pl-k">throws</span> <span class="pl-smi">RpcException</span> {
        <span class="pl-smi">Result</span> <span class="pl-s1">result</span> = <span class="pl-s1">invoker</span>.<span class="pl-en">invoke</span>(<span class="pl-s1">invocation</span>);
        <span class="pl-smi">Object</span> <span class="pl-s1">o</span> = <span class="pl-s1">result</span>.<span class="pl-en">getValue</span>();
        <span class="pl-k">if</span> (<span class="pl-s1">o</span> <span class="pl-k">instanceof</span> <span class="pl-smi">String</span>) {
            <span class="pl-smi">String</span> <span class="pl-s1">s</span> = (<span class="pl-smi">String</span>) <span class="pl-s1">o</span>;
            <span class="pl-s1">s</span> += <span class="pl-s">"filtered: "</span>;
            <span class="pl-s1">result</span>.<span class="pl-en">setValue</span>(<span class="pl-s1">s</span>);
        }
        <span class="pl-k">return</span> <span class="pl-s1">result</span>;
    }
}</pre></div>