// Path: src/main/java/org/mockenize/exception/ProxyPathException.java
// public class ProxyPathException extends WebApplicationException {
// 
// 	private static final long serialVersionUID = 7714442933981404781L;
// 
// 	public ProxyPathException() {
//         super("Can't define proxy path.", Response.Status.INTERNAL_SERVER_ERROR);
//     }
// }
// 
// Path: src/main/java/org/mockenize/model/ProxyBean.java
// @Data
// public class ProxyBean implements Serializable, Cacheable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private static final String UNDERLINE = "_";
// 
// 	private static final String SLASH = "/";
// 
// 	@NotEmpty
// 	private String key;
// 
// 	@NotEmpty
// 	private String path;
// 
// 	@NotNull
// 	private String name;
// 
// 	@NotNull
// 	private URI url;
// 
// 	@Override
// 	public String getKey() {
// 		return path.toLowerCase().replaceAll(SLASH, UNDERLINE);
// 	}
// }
// 
// Path: src/main/java/org/mockenize/repository/ProxyRepository.java
// @Repository
// public class ProxyRepository extends AbstractRepository<ProxyBean> {
// 
// 	private static final String CACHE_KEY = "proxies";
// 
// 	@Autowired
// 	public ProxyRepository(HazelcastInstance hazelcastInstance) {
// 		super(hazelcastInstance, CACHE_KEY);
// 	}
// 
// }


import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.mockenize.exception.ProxyPathException;
import org.mockenize.model.ProxyBean;
import org.mockenize.repository.ProxyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Strings;
package org.mockenize.service;





@Service
public class ProxyService implements ResponseService {

	@Autowired
	private ProxyRepository proxyRepository;

	@Context
	private HttpServletRequest request;

	private Client client = ClientBuilder.newClient();

// Path: src/main/java/org/mockenize/exception/ProxyPathException.java
// public class ProxyPathException extends WebApplicationException {
// 
// 	private static final long serialVersionUID = 7714442933981404781L;
// 
// 	public ProxyPathException() {
//         super("Can't define proxy path.", Response.Status.INTERNAL_SERVER_ERROR);
//     }
// }
// 
// Path: src/main/java/org/mockenize/model/ProxyBean.java
// @Data
// public class ProxyBean implements Serializable, Cacheable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private static final String UNDERLINE = "_";
// 
// 	private static final String SLASH = "/";
// 
// 	@NotEmpty
// 	private String key;
// 
// 	@NotEmpty
// 	private String path;
// 
// 	@NotNull
// 	private String name;
// 
// 	@NotNull
// 	private URI url;
// 
// 	@Override
// 	public String getKey() {
// 		return path.toLowerCase().replaceAll(SLASH, UNDERLINE);
// 	}
// }
// 
// Path: src/main/java/org/mockenize/repository/ProxyRepository.java
// @Repository
// public class ProxyRepository extends AbstractRepository<ProxyBean> {
// 
// 	private static final String CACHE_KEY = "proxies";
// 
// 	@Autowired
// 	public ProxyRepository(HazelcastInstance hazelcastInstance) {
// 		super(hazelcastInstance, CACHE_KEY);
// 	}
// 
// }


// Path: src/main/java/org/mockenize/service/ProxyService.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.mockenize.exception.ProxyPathException;
import org.mockenize.model.ProxyBean;
import org.mockenize.repository.ProxyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Strings;

package org.mockenize.service;





@Service
public class ProxyService implements ResponseService {

	@Autowired
	private ProxyRepository proxyRepository;

	@Context
	private HttpServletRequest request;

	private Client client = ClientBuilder.newClient();

	public Collection<ProxyBean> getAll() {