Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] Checking client response entity type

I believe ApacheConnector$ConnectionClosingMechanism$1 is an InputStream, so instead of getEntity, you'd better use readEntity.

On 31.10.2020 14:48, Martynas Jusevičius wrote:
Can I get some advice here please?

On Tue, Oct 27, 2020 at 10:17 AM Martynas Jusevičius
<martynas@xxxxxxxxxxxxx> wrote:

I have Jersey 2.30.1 client code roughly like this:

     public Response getClientResponse()
         return getWebTarget().request(getReadableMediaTypes()).get();

         try (Response cr = getClientResponse())
             if (cr.getEntity() instanceof Model)
                 Model model = (Model)cr.getEntity();

The problem is that sometimes the (cr.getEntity() instanceof Model)
check fails -- the entity is actually of type

Why is that so and how can I safely check the client response type?


jersey-dev mailing list
To unsubscribe from this list, visit;!!GqivPVa7Brio!KbdIEOrv27h3DDSLD7NSKFyw3JAJSdLZjCYOZIQDahKpZI2ooyJr8loKDTAADETq$

Back to the top