Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2673

Unable to set cookies per request while retaining ResteasyClient reusability

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.9.3.Final
    • Fix Version/s: None
    • Component/s: jaxrs
    • Labels:
      None
    • Steps to Reproduce:
      Hide
      1. Create an instance of ResteasyClient.
      2. Make a request to a resource that responds with SET-COOKIE header
      3. Make another call to the same resource with the same client. This will result in the previously received cookie being passed on.
      Show
      Create an instance of ResteasyClient. Make a request to a resource that responds with SET-COOKIE header Make another call to the same resource with the same client. This will result in the previously received cookie being passed on.

      Description

      I'm migrating a web  application written for Payara5 to Wildfly 18.

      In my app I use an http client to make requests to Cisco Socialminer API. Since the app has to make these requests often, the client is created only once upon application startup and then is reused indefinitely.

      One of the endpoints that creates a chat session returns a JSESSIONID cookie that is later used to poll for newly created chat session's events. I store the cookie in the database and set it manually when needed.

      This is how I make the request:

      WebTarget target = environment.getClient(false)
         .target(url);
      Response response = target.request()
         .post(Entity.entity(payload, MediaType.APPLICATION_XML));
      

      The first call after application startup works just fine. However, upon receiving a response containing "JSESSIONID" cookie, the client stores the cookie and automatically adds it to the next request that is made with the same client instance.

      This creates a problem, because Socialminer API doesn't expect a JSESSIONID cookie on that request and responds erratically.

      I tried googling for a solution, but only solutions I've found involved rebuilding the client.

      Is there a way to prevent Resteasy from storing the received cookie or at least prevent resteasy from attaching it to the consequent requests?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                weinanli Weinan Li
                Reporter:
                a.djaginov Andro Djaginov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: