투케이2K

85. (TWOK/ALGORITHM) [Spring] 문법 - RequestHeader , RequestParam 사용해 http 요청 헤더 값 및 파라미터 값 확인 본문

투케이2K 알고리즘

85. (TWOK/ALGORITHM) [Spring] 문법 - RequestHeader , RequestParam 사용해 http 요청 헤더 값 및 파라미터 값 확인

투케이2K 2023. 1. 22. 12:12
반응형

[환경 설정 및 설명]

언어 / 플랫폼 : Java / Spring

설 명 : 문법 - RequestHeader , RequestParam 사용해 http 요청 헤더 값 및 파라미터 값 확인

 

[소스 코드]

    // -----------------------------------------------------------------------------------------
    // TODO [SEARCH FAST] : [POST] : Request Header 값 확인
    // -----------------------------------------------------------------------------------------
    @PostMapping("/post_request_header")
    public String post_request_header(@RequestHeader Map<String, Object> requestHeader, @RequestParam Map<String, Object> param){
        S_Log.d("\n");
        S_Log.d("================================================");
        S_Log.d("[CLASS] : "+String.valueOf(CLASS_NAME));
        S_Log.d("-----------------------------------------");
        S_Log.d("[METHOD] : "+String.valueOf("post_request_header"));
        S_Log.d("-----------------------------------------");
        S_Log.d("[INPUT] : [Header] : "+String.valueOf(requestHeader.toString()));
        S_Log.d("-----------------------------------------");
        S_Log.d("[INPUT] : [Param] : "+String.valueOf(param.toString()));
        S_Log.d("================================================");
        S_Log.d("\n");


        /**
         * // -----------------------------------------
         * [호출 방법]
         * // -----------------------------------------
         * 1. 호출 방식 : POST
         * // -----------------------------------------
         * 2. 호출 방법 : http://localhost:7000/post_request_header
         * // -----------------------------------------
         * 3. 리턴 데이터 : Y : SUCCESS
         * // -----------------------------------------
         * */


        // [리턴 반환]
        return "Y : SUCCESS";
    }
 

[결과 출력]


반응형
Comments