EthController.java 2.38 KB
package org.emercit.app;


import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.*;
import javax.servlet.ServletContext;

import java.io.*;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Vector;

import org.emercit.ethmanager.model.EthBean;
import org.emercit.dnsmanager.model.DnsBean;

import org.emercit.service.EthService;
import org.emercit.service.DnsService;



@Controller
@RequestMapping("api")
public class EthController {
	

	
	@RequestMapping(value = "eth/all",  method = RequestMethod.GET)
	public @ResponseBody Vector<EthBean> getAllEth() {
		
		try { 
			return EthService.INSTANCE.getAllEthbean();
		}
		catch(Exception e)
		{
			return null;
		}
	}
	
	
	/*
	@RequestMapping(value = "net/proxy",  method = RequestMethod.GET)
	public @ResponseBody Vector<ProxyBean> getAllProxy() {
		
		try { 
			return NetService.INSTANCE.getProxy();
		}
		catch(Exception e)
		{
			return null;
		}
	}
	*/
	
	/*
			export http_proxy='http://user:password@prox-server:3128'
			export https_proxy='http://user:password@prox-server:3128'
			export ftp_proxy='http://user:password@prox-server:3128'
	
	*/

	/*
	 * 
	 */
	
	
	@RequestMapping(value = "eth/byeth/{eth}",  method = RequestMethod.GET)
	public @ResponseBody EthBean getEth(@PathVariable String eth)  {

			return EthService.INSTANCE.getByName(eth);
	
	}
	
	 @RequestMapping(value="eth/update" , method = RequestMethod.POST)
	    public @ResponseBody boolean update(@RequestBody EthBean m) {
	
				return  EthService.INSTANCE.Upd(m); 
	 }
	 
}