All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.client.jaxrs.internal.AsynchronousInvoke Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha4
Show newest version
package org.jboss.resteasy.client.jaxrs.internal;

import javax.ws.rs.HttpMethod;
import javax.ws.rs.client.AsyncInvoker;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;

import org.jboss.resteasy.spi.NotImplementedYetException;

import java.util.concurrent.Future;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class AsynchronousInvoke implements AsyncInvoker
{
   protected ClientInvocation invocation;

   public AsynchronousInvoke(final ClientInvocation invocation)
   {
      this.invocation = invocation;
   }

   @Override
   public Future get()
   {
      return method(HttpMethod.GET);
   }

   @Override
   public  Future get(Class responseType)
   {
      return method(HttpMethod.GET, responseType);
   }

   @Override
   public  Future get(GenericType responseType)
   {
      return method(HttpMethod.GET, responseType);
   }

   @Override
   public  Future get(InvocationCallback callback)
   {
      return method(HttpMethod.GET, callback);
   }

   @Override
   public Future trace()
   {
      return method("TRACE");
   }

   @Override
   public  Future trace(Class responseType)
   {
      return method("TRACE", responseType);
   }

   @Override
   public  Future trace(GenericType responseType)
   {
      return method("TRACE", responseType);
   }

   @Override
   public  Future trace(InvocationCallback callback)
   {
      return method("TRACE", callback);
   }

   @Override
   public Future put(Entity entity)
   {
      return method(HttpMethod.PUT, entity);
   }

   @Override
   public  Future put(Entity entity, Class responseType)
   {
      return method(HttpMethod.PUT, entity, responseType);
   }

   @Override
   public  Future put(Entity entity, GenericType responseType)
   {
      return method(HttpMethod.PUT, entity, responseType);
   }

   @Override
   public  Future put(Entity entity, InvocationCallback callback)
   {
      return method(HttpMethod.PUT, entity, callback);
   }

   @Override
   public Future post(Entity entity)
   {
      return method(HttpMethod.POST, entity);
   }

   @Override
   public  Future post(Entity entity, Class responseType)
   {
      return method(HttpMethod.POST, entity, responseType);
   }

   @Override
   public  Future post(Entity entity, GenericType responseType)
   {
      return method(HttpMethod.POST, entity, responseType);
   }

   @Override
   public  Future post(Entity entity, InvocationCallback callback)
   {
      return method(HttpMethod.POST, entity, callback);
   }

   @Override
   public Future delete()
   {
      return method(HttpMethod.DELETE);
   }

   @Override
   public  Future delete(Class responseType)
   {
      return method(HttpMethod.DELETE, responseType);
   }

   @Override
   public  Future delete(GenericType responseType)
   {
      return method(HttpMethod.DELETE, responseType);
   }

   @Override
   public  Future delete(InvocationCallback callback)
   {
      return method(HttpMethod.DELETE, callback);
   }

   @Override
   public Future head()
   {
      return method(HttpMethod.HEAD);
   }

   @Override
   public Future head(InvocationCallback callback)
   {
      return method(HttpMethod.HEAD,callback);
   }

   @Override
   public Future options()
   {
      return method(HttpMethod.OPTIONS);
   }

   @Override
   public  Future options(Class responseType)
   {
      return method(HttpMethod.OPTIONS, responseType);
   }

   @Override
   public  Future options(GenericType responseType)
   {
      return method(HttpMethod.OPTIONS, responseType);
   }

   @Override
   public  Future options(InvocationCallback callback)
   {
      return method(HttpMethod.OPTIONS, callback);
   }


   @Override
   public Future method(String name)
   {
      invocation.setMethod(name);
      invocation.setEntity(null);
      return invocation.submit();
   }

   @Override
   public  Future method(String name, Class responseType)
   {
      invocation.setMethod(name);
      invocation.setEntity(null);
      return invocation.submit(responseType);
   }

   @Override
   public  Future method(String name, GenericType responseType)
   {
      invocation.setMethod(name);
      invocation.setEntity(null);
      return invocation.submit(responseType);
   }

   @Override
   public  Future method(String name, InvocationCallback callback)
   {
      invocation.setMethod(name);
      invocation.setEntity(null);
      return invocation.submit(callback);
   }

   @Override
   public Future method(String name, Entity entity)
   {
      invocation.setMethod(name);
      invocation.setEntity(entity);
      return invocation.submit();
   }

   @Override
   public  Future method(String name, Entity entity, Class responseType)
   {
      invocation.setMethod(name);
      invocation.setEntity(entity);
      return invocation.submit(responseType);
   }

   @Override
   public  Future method(String name, Entity entity, GenericType responseType)
   {
      invocation.setMethod(name);
      invocation.setEntity(entity);
      return invocation.submit(responseType);
   }

   @Override
   public  Future method(String name, Entity entity, InvocationCallback callback)
   {
      invocation.setMethod(name);
      invocation.setEntity(entity);
      return invocation.submit(callback);
   }

   public Future patch(Entity entity) {
      throw new NotImplementedYetException();
   }

   public  Future patch(Entity entity, Class responseType)
   {
      return method(HttpMethod.PATCH, entity, responseType);
   }

   public  Future patch(Entity entity, GenericType responseType)
   {
      return method(HttpMethod.PATCH, entity, responseType);
   }

   public  Future patch(Entity entity, InvocationCallback callback)
   {
      return method(HttpMethod.PATCH, entity, callback);
   }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy