카테고리 없음

우편 배달부 양식 데이터 게시 요청을 Java 요청으로 변환

기록만이살길 2021. 3. 1. 01:17
반응형

우편 배달부 양식 데이터 게시 요청을 Java 요청으로 변환

1. 질문(문제점):

우편 배달부에서 아래의 양식 데이터 요청을 Java 코드 (Java 호출자 내)로 "변환"하고 싶습니다. 더 정확하게는 아래 표시된 API에 대한 호출자를 구현하여 항아리를 통해 엔드 포인트에 액세스 할 수 있도록 노력하고 있습니다. 문제는 2 개의 문자열 배열, tocc 및 2 개의 문자열, 내용제목 (분명히 api가 이메일을 보내거나 첨부 파일 필드를 무시 함)을 가지고 있으며 이러한 매개 변수를 내 양식에 어떻게 설정할 수 있는지 모르겠다는 것입니다. -자바의 데이터. 여기에 이미지 설명 입력

여기 Main 클래스의 내 게시 방법

public static void myPostRequest() throws IOException {
        URL object = new URL(POST_ENDPOINT);

        HttpURLConnection postConnection = (HttpURLConnection) object.openConnection();
        postConnection.setRequestMethod("POST");
        postConnection.setRequestProperty("to", "alice@example.com");
        postConnection.setRequestProperty("to", "bob@anotherex.com");
        postConnection.setRequestProperty("cc", "alice@example.com");
        postConnection.setRequestProperty("cc", "bob@anotherex.com");
        postConnection.setRequestProperty("subject", "randomsubject");
        postConnection.setRequestProperty("content", "randomContent");
//        postConnection.setRequestProperty("contentType", "text/html");
//        postConnection.setRequestProperty("Content-Type", "application/json");

        postConnection.setDoOutput(true);
        OutputStream os = postConnection.getOutputStream();
        os.flush();
        os.close();

        int responseCode = postConnection.getResponseCode();
        System.out.println("POST response code " + responseCode);
        System.out.println("POST response message" + postConnection.getResponseMessage());

        if (responseCode == HttpURLConnection.HTTP_OK) { //success
            BufferedReader in = new BufferedReader(new InputStreamReader(postConnection.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();

            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            System.out.println("RESPONSE: " + response.toString());
        } else {
            System.out.println("POST DIDN`T WORK");
        }
    }

그리고 다른 응용 프로그램의 컨트롤러 메서드 ( 우체부에서 작동 ) :

    @ApiOperation("Send notification email")
    @RequestMapping(path = "/email", method = RequestMethod.POST, consumes = {"multipart/form-data"})
    private String sendNotificationEmail(@RequestParam("to") String[] to,
                                         @RequestParam("cc") String[] cc,
                                         @RequestParam("subject") String subject,
                                         @RequestParam("content") String content) String contentType,
                                         @RequestParam(name = "attachments") MultipartFile[] attachements
    ) {
       
        EmailSender.sendMail(new EmailSettings(to, cc, subject, content, null), attachements);
        return "Email sent";
    }

로그:

"C:\Program Files\Java\jdk1.8.0_211\bin\java.exe" "-javaagent:C:\Program Files\Java\jdk1.8.0_211\jre\lib\rt.jar;C:\GIT\ocademo\target\classes;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-web\5.3.2\spring-web-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-beans\5.3.2\spring-beans-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-core\5.3.2\spring-core-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-jcl\5.3.2\spring-jcl-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\apache\httpcomponents\httpclient\4.5.2\httpclient-4.5.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\apache\httpcomponents\httpcore\4.4.14\httpcore-4.4.14.jar;C:\Users\MARIUS1.POP\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-webflux\5.3.2\spring-webflux-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\projectreactor\reactor-core\3.4.1\reactor-core-3.4.1.jar;C:\Users\MARIUS1.POP\.m2\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;C:\Users\MARIUS1.POP\.m2\repository\io\projectreactor\netty\reactor-netty\1.0.2\reactor-netty-1.0.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\projectreactor\netty\reactor-netty-core\1.0.2\reactor-netty-core-1.0.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-handler\4.1.55.Final\netty-handler-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-common\4.1.55.Final\netty-common-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-resolver\4.1.55.Final\netty-resolver-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-buffer\4.1.55.Final\netty-buffer-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-transport\4.1.55.Final\netty-transport-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-codec\4.1.55.Final\netty-codec-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-handler-proxy\4.1.55.Final\netty-handler-proxy-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-codec-socks\4.1.55.Final\netty-codec-socks-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-resolver-dns\4.1.55.Final\netty-resolver-dns-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-codec-dns\4.1.55.Final\netty-codec-dns-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-transport-native-epoll\4.1.55.Final\netty-transport-native-epoll-4.1.55.Final-linux-x86_64.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.55.Final\netty-transport-native-unix-common-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\projectreactor\netty\reactor-netty-http\1.0.2\reactor-netty-http-1.0.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-codec-http\4.1.55.Final\netty-codec-http-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\netty\netty-codec-http2\4.1.55.Final\netty-codec-http2-4.1.55.Final.jar;C:\Users\MARIUS1.POP\.m2\repository\io\projectreactor\netty\reactor-netty-http-brave\1.0.2\reactor-netty-http-brave-1.0.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\zipkin\brave\brave-instrumentation-http\5.13.2\brave-instrumentation-http-5.13.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\zipkin\brave\brave\5.13.2\brave-5.13.2.jar;C:\Users\MARIUS1.POP\.m2\repository\io\zipkin\reporter2\zipkin-reporter-brave\2.16.1\zipkin-reporter-brave-2.16.1.jar;C:\Users\MARIUS1.POP\.m2\repository\io\zipkin\reporter2\zipkin-reporter\2.16.1\zipkin-reporter-2.16.1.jar;C:\Users\MARIUS1.POP\.m2\repository\io\zipkin\zipkin2\zipkin\2.23.0\zipkin-2.23.0.jar;C:\Users\MARIUS1.POP\.m2\repository\com\github\Cloudmersive\Cloudmersive.APIClient.Java\v3.62\Cloudmersive.APIClient.Java-v3.62.jar;C:\Users\MARIUS1.POP\.m2\repository\org\threeten\threetenbp\1.3.5\threetenbp-1.3.5.jar;C:\Users\MARIUS1.POP\.m2\repository\com\squareup\okhttp\okhttp\2.7.5\okhttp-2.7.5.jar;C:\Users\MARIUS1.POP\.m2\repository\com\squareup\okio\okio\1.6.0\okio-1.6.0.jar;C:\Users\MARIUS1.POP\.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar;C:\Users\MARIUS1.POP\.m2\repository\io\gsonfire\gson-fire\1.8.0\gson-fire-1.8.0.jar;C:\Users\MARIUS1.POP\.m2\repository\com\squareup\okhttp\logging-interceptor\2.7.5\logging-interceptor-2.7.5.jar;C:\Users\MARIUS1.POP\.m2\repository\io\swagger\swagger-annotations\1.5.15\swagger-annotations-1.5.15.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\boot\spring-boot-starter\2.4.1\spring-boot-starter-2.4.1.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\boot\spring-boot\2.4.1\spring-boot-2.4.1.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-context\5.3.2\spring-context-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-aop\5.3.2\spring-aop-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\spring-expression\5.3.2\spring-expression-5.3.2.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.4.1\spring-boot-autoconfigure-2.4.1.jar;C:\Users\MARIUS1.POP\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.4.1\spring-boot-starter-logging-2.4.1.jar;C:\Users\MARIUS1.POP\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\MARIUS1.POP\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\MARIUS1.POP\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;C:\Users\MARIUS1.POP\.m2\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;C:\Users\MARIUS1.POP\.m2\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\MARIUS1.POP\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\MARIUS1.POP\.m2\repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;C:\Users\MARIUS1.POP\.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar" oca.demo.ocademo.Main
14:37:03.760 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
14:37:03.789 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
14:37:03.789 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows
14:37:03.791 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
14:37:03.791 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 8
14:37:03.792 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
14:37:03.793 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
14:37:03.793 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
14:37:03.793 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\MARIUS1.POP\AppData\Local\Temp (java.io.tmpdir)
14:37:03.794 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
14:37:03.795 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 3791650816 bytes
14:37:03.795 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
14:37:03.796 [main] DEBUG io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available
14:37:03.796 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
14:37:03.809 [main] DEBUG reactor.netty.tcp.TcpResources - [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=12, workerCount=12}
14:37:03.809 [main] DEBUG reactor.netty.tcp.TcpResources - [http] resources will use the default ConnectionProvider: reactor.netty.resources.DefaultPooledConnectionProvider@614c5515
14:37:03.843 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
14:37:03.843 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
14:37:04.070 [main] DEBUG org.springframework.web.reactive.function.client.ExchangeFunctions - [7e0b85f9] HTTP POST http://mdl07cj001.bt.wan:7003/MIS/Notification/Email/api/notification/email
14:37:04.135 [main] DEBUG reactor.netty.resources.DefaultLoopEpoll - Default Epoll support : false
14:37:04.136 [main] DEBUG reactor.netty.resources.DefaultLoopKQueue - Default KQueue support : false
14:37:04.139 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 24
14:37:04.152 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
14:37:04.152 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
14:37:04.156 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
14:37:04.157 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
14:37:04.162 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
14:37:04.194 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
14:37:04.194 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
14:37:04.228 [main] DEBUG io.netty.util.NetUtilInitializations - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
14:37:04.229 [main] DEBUG io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
14:37:04.278 [main] DEBUG io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider - Default DNS servers: [/10.100.101.50:53, /10.100.101.51:53] (sun.net.dns.ResolverConfiguration)
14:37:04.283 [main] DEBUG reactor.netty.resources.PooledConnectionProvider - Creating a new [http] client pool [PoolFactory{evictionInterval=PT0S, leasingStrategy=fifo, maxConnections=500, maxIdleTime=-1, maxLifeTime=-1, metricsEnabled=false, pendingAcquireMaxCount=1000, pendingAcquireTimeout=45000}] for [mdl07cj001.bt.wan:7003]
14:37:04.317 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 15532 (auto-detected)
14:37:04.356 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: f4:93:9f:ff:fe:f6:06:8a (auto-detected)
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 24
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 24
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
14:37:04.373 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
14:37:04.379 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
14:37:04.379 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
14:37:04.379 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
14:37:04.392 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747] Created a new pooled channel, now 1 active connections and 0 inactive connections
14:37:04.409 [reactor-http-nio-2] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true
14:37:04.409 [reactor-http-nio-2] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true
14:37:04.410 [reactor-http-nio-2] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@22f23501
14:37:04.413 [reactor-http-nio-2] DEBUG reactor.netty.transport.TransportConfig - [id: 0xacaa8747] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpClientCodec), (reactor.left.httpDecompressor = io.netty.handler.codec.http.HttpContentDecompressor), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
14:37:04.438 [reactor-http-nio-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@492aff7f
14:37:04.439 [reactor-http-nio-1] DEBUG io.netty.resolver.dns.DnsQueryContext - [id: 0xa3a7d02f] WRITE: UDP, [23067: /10.100.101.50:53], DefaultDnsQuestion(mdl07cj001.bt.wan. IN A)
14:37:04.443 [reactor-http-nio-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096
14:37:04.443 [reactor-http-nio-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: 2
14:37:04.443 [reactor-http-nio-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: 16
14:37:04.443 [reactor-http-nio-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8
14:37:04.443 [reactor-http-nio-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.delayedQueue.ratio: 8
14:37:04.456 [reactor-http-nio-1] DEBUG io.netty.resolver.dns.DnsNameResolver - [id: 0xa3a7d02f] RECEIVED: UDP [23067: /10.100.101.50:53], DatagramDnsResponse(from: /10.100.101.50:53, to: /0:0:0:0:0:0:0:0:55442, 23067, QUERY(0), NoError(0), RD AA RA)
    DefaultDnsQuestion(mdl07cj001.bt.wan. IN A)
    DefaultDnsRawRecord(mdl07cj001.bt.wan. 3600 IN A 4B)
    DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
14:37:04.460 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Registering pool release on close event for channel
14:37:04.460 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Channel connected, now 1 active connections and 0 inactive connections
14:37:04.461 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}, [connected])
14:37:04.467 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(GET{uri=/, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [configured])
14:37:04.468 [reactor-http-nio-2] DEBUG reactor.netty.http.client.HttpClientConnect - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Handler is being applied: {uri=http://mdl07cj001.bt.wan:7003/MIS/Notification/Email/api/notification/email, method=POST}
14:37:04.470 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(POST{uri=/MIS/Notification/Email/api/notification/email, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [request_prepared])
14:37:04.474 [reactor-http-nio-2] DEBUG org.springframework.http.codec.FormHttpMessageWriter - [7e0b85f9] Writing form fields [to, cc, subject, content, contentType] (content masked)
14:37:04.488 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(POST{uri=/MIS/Notification/Email/api/notification/email, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [request_sent])
14:37:04.517 [reactor-http-nio-2] DEBUG reactor.netty.http.client.HttpClientOperations - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Received response (auto-read:false) : [Cache-Control=no-cache, no-store, max-age=0, must-revalidate, Date=Mon, 18 Jan 2021 12:37:04 GMT, Pragma=no-cache, Transfer-Encoding=chunked, Expires=0, X-ORACLE-DMS-ECID=57445be9-bcb8-496b-bd25-4986e33f3e23-00000135, X-ORACLE-DMS-RID=0, X-Frame-Options=DENY, Accept=multipart/form-data, X-Content-Type-Options=nosniff, X-XSS-Protection=1; mode=block]
14:37:04.517 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(POST{uri=/MIS/Notification/Email/api/notification/email, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [response_received])
14:37:04.519 [reactor-http-nio-2] DEBUG org.springframework.web.reactive.function.client.ExchangeFunctions - [7e0b85f9] Response 415 UNSUPPORTED_MEDIA_TYPE
14:37:04.530 [reactor-http-nio-2] DEBUG reactor.netty.channel.FluxReceive - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] FluxReceive{pending=0, cancelled=false, inboundDone=false, inboundError=null}: subscribing inbound receiver
14:37:04.531 [reactor-http-nio-2] DEBUG reactor.netty.http.client.HttpClientOperations - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Received last HTTP packet
14:37:04.540 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(POST{uri=/MIS/Notification/Email/api/notification/email, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [response_completed])
Exception in thread "main" org.springframework.web.reactive.function.client.WebClientResponseException$UnsupportedMediaType: 415 Unsupported Media Type from POST http://mdl07cj001.bt.wan:7003/MIS/Notification/Email/api/notification/email
    at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:195)
14:37:04.541 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] onStateChange(POST{uri=/MIS/Notification/Email/api/notification/email, connection=PooledConnection{channel=[id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003]}}, [disconnecting])
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
14:37:04.541 [reactor-http-nio-2] DEBUG reactor.netty.resources.DefaultPooledConnectionProvider - [id: 0xacaa8747, L:/10.0.69.115:49384 - R:mdl07cj001.bt.wan/10.100.139.63:7003] Releasing channel
    |_ checkpoint ⇢ 415 from POST http://mdl07cj001.bt.wan:7003/MIS/Notification/Email/api/notification/email [DefaultWebClient]
Stack trace:
        at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:195)
        at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:216)
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
        at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1784)
        at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:107)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:150)
        at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onComplete(FluxContextWrite.java:126)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onComplete(FluxMapFuseable.java:344)
        at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onComplete(FluxFilterFuseable.java:391)
        at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1785)
        at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:159)
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142)
        at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:259)
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142)
        at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:383)
        at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:396)
        at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:452)
        at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:664)
        at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:94)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
        at reactor.core.publisher.Mono.block(Mono.java:1703)
        at oca.demo.ocademo.GetAndPost.newPostMethod(GetAndPost.java:120)
        at oca.demo.ocademo.Main.main(Main.java:8)

Process finished with exit code 1

2. 해결방안:

Postman은 요청을 다른 언어로 변환 할 수 있도록 허용합니다. 요청 URL 아래의 코드 링크를 클릭하기 만하면됩니다.

여기에 이미지 설명 입력

65770226
반응형