@RequestMapping(value = { "/elastic" })
public void elastic(@ModelAttribute final NoticeEntity entity, final Model model) throws InterruptedException {
final String FMCurl = "http://100.66.10.34:9200/cse_performance/applog/";
final String[] querStringNm = { "나이키", "아디다스", "H&M", "유니클로", "프로스펙스", "청바지", "반바지", "반팔", "패딩", "셔츠" };
try {
final URL url = new URL(FMCurl);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
final JSONObject json = new JSONObject();
final int randomNum = randomRange(500, 3000);
final int tt = (int) (randomNum * 0.6);
json.put("serverTotal", tt);
json.put("serverApi", (int) (tt * 0.8));
json.put("serverService", (int) (tt * 0.2));
json.put("clientTotal", randomNum);
json.put("clientPage", (int) (randomNum * 0.3));
json.put("clientAjax", tt);
json.put("clientRendering", (int) (randomNum * 0.1));
final int test = randomRange(0, 9);
logger.debug("test {}", test);
json.put("queryString", querStringNm[test]);
final Date d = new Date();
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
final Calendar cal = Calendar.getInstance();
cal.setTime(d);
// cal.add(Calendar.HOUR, -9);
final String asd = sdf.format(cal.getTime());
json.put("insertDt", asd);
final OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(json.toString());
logger.debug("pushMessage = [" + json.toString() + "]");
wr.flush();
conn.getInputStream();
} catch (final MalformedURLException e) {
e.printStackTrace();
} catch (final ProtocolException e) {
e.printStackTrace();
} catch (final IOException e) {
e.printStackTrace();
}
}