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

Build method of org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder always return the same instance.

    Details

    • Steps to Reproduce:
      Hide

      public class InvocationBuilderTest {
       
      	public static void main(String[] args) {
      		Client client = ClientBuilder.newClient();
      		try {
      			WebTarget webTarget = client.target("http://www.google.fr");
      			Builder invocationBuilder = webTarget.request();
      			Invocation getInvocation = invocationBuilder.build("GET");
      			// Request http://www.google.fr with GET method
      			getInvocation.invoke(String.class);
      			// invocationBuilder is supposed to build a new
      			// javax.ws.rs.client.Invocation instance but it does not.
      			invocationBuilder.build("POST");
      			// The previously built getInvocation has become a postInvocation
      			// regardless of the fact that there was no assignation to
      			// getInvocation variable on previous line. Error 405 (Method Not
      			// Allowed)
      			getInvocation.invoke(String.class);
      		} finally {
      			client.close();
      		}
      	}
       
      }
      

      Show
      public class InvocationBuilderTest {   public static void main(String[] args) { Client client = ClientBuilder.newClient(); try { WebTarget webTarget = client.target("http://www.google.fr"); Builder invocationBuilder = webTarget.request(); Invocation getInvocation = invocationBuilder.build("GET"); // Request http://www.google.fr with GET method getInvocation.invoke(String.class); // invocationBuilder is supposed to build a new // javax.ws.rs.client.Invocation instance but it does not. invocationBuilder.build("POST"); // The previously built getInvocation has become a postInvocation // regardless of the fact that there was no assignation to // getInvocation variable on previous line. Error 405 (Method Not // Allowed) getInvocation.invoke(String.class); } finally { client.close(); } }   }

      Description

      Implemenation of "javax.ws.rs.client.Invocation.Builder" does not seems to strictly follow the builder pattern. It actually does not build a fresh instance on each build method call.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ron_sigal Ron Sigal
                Reporter:
                nicolas.n Nicolas NESMON
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: