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

com.jdroid.java.http.okhttp.OkHttpServiceFactory Maven / Gradle / Ivy

package com.jdroid.java.http.okhttp;

import com.jdroid.java.http.HttpService;
import com.jdroid.java.http.HttpServiceFactory;
import com.jdroid.java.http.HttpServiceProcessor;
import com.jdroid.java.http.MultipartHttpService;
import com.jdroid.java.http.Server;
import com.jdroid.java.http.okhttp.delete.OkDeleteHttpService;
import com.jdroid.java.http.okhttp.get.OkGetHttpService;
import com.jdroid.java.http.okhttp.patch.OkPatchHttpService;
import com.jdroid.java.http.okhttp.post.OkPostHttpService;
import com.jdroid.java.http.okhttp.put.OkPutHttpService;
import com.jdroid.java.http.post.BodyEnclosingHttpService;

import java.util.List;

public class OkHttpServiceFactory implements HttpServiceFactory {
	
	@Override
	public HttpService newGetService(Server server, List urlSegments,
										   List httpServiceProcessors) {
		return new OkGetHttpService(server, urlSegments, httpServiceProcessors);
	}
	
	@Override
	public BodyEnclosingHttpService newPostService(Server server, List urlSegments,
														   List httpServiceProcessors) {
		return new OkPostHttpService(server, urlSegments, httpServiceProcessors);
	}
	
	@Override
	public MultipartHttpService newMultipartPostService(Server server, List urlSegments, List httpServiceProcessors) {
		throw new UnsupportedOperationException();
	}
	
	@Override
	public MultipartHttpService newMultipartPutService(Server server, List urlSegments, List httpServiceProcessors) {
		throw new UnsupportedOperationException();
	}
	
	@Override
	public BodyEnclosingHttpService newFormPostService(Server server, List urlSegments, List httpServiceProcessors) {
		throw new UnsupportedOperationException();
	}
	
	@Override
	public BodyEnclosingHttpService newPutService(Server server, List urlSegments,
														  List httpServiceProcessors) {
		return new OkPutHttpService(server, urlSegments, httpServiceProcessors);
	}
	
	@Override
	public BodyEnclosingHttpService newPatchService(Server baseURL, List urlSegments,
															List httpServiceProcessors) {
		return new OkPatchHttpService(baseURL, urlSegments, httpServiceProcessors);
	}
	
	@Override
	public HttpService newDeleteService(Server server, List urlSegments,
											  List httpServiceProcessors) {
		return new OkDeleteHttpService(server, urlSegments, httpServiceProcessors);
	}
}