Hi Stephan,

Thank you for the response. I've implemented a filter and created one while
setting the "next" property to be my client but I am not getting any calls
to the beforeHandle function. My code looks like the following.

class MyFilter extends Filter
{
    public MyFilter() { this(null);
    public MyFilter(Context context) { this(context, null); }
    public MyFilter(Context context, Restlet next) { super(context, next); }

    public int beforeHandle(Request request, Response response)
    {
        System.out.println("HIT!");
        return CONTINUE;
    }
}

And my Spring configuration looks like this...

<bean id="client" class="org.restlet.Client">
    <constructor-arg index="0">
        <bean class="org.restlet.Context"/>
    </constructor-arg>
    <constructor-arg index="1">
        <util:constant static-field="org.restlet.data.Protocol.HTTP"/>
    </constructor-arg>
</bean>
<bean id="clientHelper"
class="com.noelios.restlet.ext.httpclient.HttpClientHelper">
    <constructor-arg ref="client"/>
</bean>
<bean id="myFilter" class="MyFilter">
    <property name="next" ref="client" />
</bean>

What am I missing? Thanks again.

Jean-Philippe

On Sat, May 1, 2010 at 3:49 AM, Stephan Koops <stephan.ko...@web.de> wrote:

> Hi Jean,
>
> the access is on both sides the same. That's an advantage of Restlet.
> To add the header for every request you could create a filter. It adds
> the header. Instead of send the request directly by the Client object
> you set the Client as next Restlet in the filter and your application
> sends all request via the filter.
> (I hope that's right ...)
>
> best regards
>   Stephan
>
> Jean-Philippe Steinmetz schrieb:
> > Hi,
> >
> > I'm trying to add a custom HTTP header to outgoing requests when using
> > the restlet client API. Ideally i'm looking for some way to implement
> > a helper class that can inject my header into every request as they
> > are processed. However in looking through the documentation i'm not
> > really finding what i'm looking for. I see in the FAQ it's possible to
> > access headers but this seems to be from the server perspective. How
> > do I get access from a client perspective?
> >
> > Thanks in advance,
> >
> > Jean-Philippe Steinmetz
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2600427
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2602229

Reply via email to