Newer
Older
Architecture / src / main / java / ArchitectureTest / CompanyRest.java
yoichiro on 5 Apr 2019 586 bytes new repository
package ArchitectureTest;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

import net.arnx.jsonic.JSON;

@Path("/companies")
public class CompanyRest {

	@GET
	public String getCompanies() {
		return JSON.encode(Companies.getInstance().getCompanies());
	}

	@POST
	public void createCompanies(@FormParam("name") String name, @FormParam("address") String address) {
		Companies.getInstance().getCompanies().put(name, new Company(address));
		System.out.println(Companies.getInstance().getCompanies());
	}
}