Newer
Older
tampopo-server-dtram / src / main / java / org / example / tampoposerverdtram / resources / PairId.java
package org.example.tampoposerverdtram.resources;

import java.util.*;
import jakarta.ws.rs.*;
import jakarta.ws.rs.client.*;
import jakarta.ws.rs.core.*;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonProcessingException;

@Path("/pairId")
@Component
public class PairId {
	private String value = "0";
	@Produces(MediaType.APPLICATION_JSON)
	@GET
	public String getValue() {
		return new String(this.value);
	}
	@POST
	public void updateFromPair(@FormParam("pid") String pid, @FormParam("pair") String pair_json) throws JsonProcessingException {
		Map<String, Object> pair = new HashMap<>();
		{
			Map<String, Object> i = new ObjectMapper().readValue(pair_json, HashMap.class);
			pair = i;
		}
		this.value = (this.value+"1");
	}
}