users@jersey.java.net

[Jersey] Re: Enforcing custom Host header in jersey client

From: Jakub Skoczen <skoczko_at_gmail.com>
Date: Fri, 13 Apr 2012 01:05:24 +0200

Please, any ideas will be greatly appreciated :)

I can't believe such a straightforward thing is so complicated with
curl it's a matter of:

curl -X GET -H "Host: dummy1" "http://localhost:8080/myapp"

On Wed, Apr 11, 2012 at 6:13 PM, Jakub Skoczen <skoczko_at_gmail.com> wrote:
> Hi Guys,
>
> I am using the Jersey client library to test some web services and I
> need to set the 'Host' header to trigger different behavior (the web
> service configuration is host driven, sort of what VirtualHost
> directive does for Apache) in the server. I tried both the
> HttpURIConnection and Apache based implementations, both without luck.
> I know that for the HttpUriConnection-based one I need to pass
> 'sun.net.http.allowRestrictedHeaders' to the JVM, but doing so doesn't
> help a bit. The custom 'Host' header is always ignored and never
> present in the actual request. What can I do?
>
> --
>
> Cheers,
> Jakub



-- 
Cheers,
Jakub