Java Code Examples for com.alipay.api.internal.util.AlipayLogger#logBizDebug()
The following examples show how to use
com.alipay.api.internal.util.AlipayLogger#logBizDebug() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractAlipayClient.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
/** * @param request * @return * @throws AlipayApiException */ private Map<String, Object> doPost(BatchAlipayRequest request) throws AlipayApiException { Map<String, Object> result = new HashMap<String, Object>(); RequestParametersHolder requestHolder = getRequestHolderWithSign(request); String url = getRequestUrl(requestHolder); // 打印完整请求报文 if (AlipayLogger.isBizDebugEnabled()) { AlipayLogger.logBizDebug(getRedirectUrl(requestHolder)); } result.put("prepareTime", System.currentTimeMillis()); String rsp = null; try { rsp = WebUtils.doPost(url, requestHolder.getApplicationParams(), charset, connectTimeout, readTimeout, proxyHost, proxyPort); } catch (IOException e) { throw new AlipayApiException(e); } result.put("requestTime", System.currentTimeMillis()); result.put("rsp", rsp); result.put("textParams", requestHolder.getApplicationParams()); result.put("protocalMustParams", requestHolder.getProtocalMustParams()); result.put("protocalOptParams", requestHolder.getProtocalOptParams()); result.put("url", url); return result; }
Example 2
Source File: DefaultAlipayClient.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * * * @param request * @param accessToken * @param appAuthToken * @return * @throws AlipayApiException */ private <T extends AlipayResponse> Map<String, Object> doPost(AlipayRequest<T> request, String accessToken, String appAuthToken) throws AlipayApiException { Map<String, Object> result = new HashMap<String, Object>(); RequestParametersHolder requestHolder = getRequestHolderWithSign(request, accessToken, appAuthToken); String url = getRequestUrl(requestHolder); // 打印完整请求报文 if (AlipayLogger.isBizDebugEnabled()) { AlipayLogger.logBizDebug(getRedirectUrl(requestHolder)); } String rsp = null; try { if (request instanceof AlipayUploadRequest) { AlipayUploadRequest<T> uRequest = (AlipayUploadRequest<T>) request; Map<String, FileItem> fileParams = AlipayUtils.cleanupMap(uRequest.getFileParams()); rsp = WebUtils.doPost(url, requestHolder.getApplicationParams(), fileParams, charset, connectTimeout, readTimeout, proxyHost, proxyPort); } else { rsp = WebUtils.doPost(url, requestHolder.getApplicationParams(), charset, connectTimeout, readTimeout, proxyHost, proxyPort); } } catch (IOException e) { throw new AlipayApiException(e); } result.put("rsp", rsp); result.put("textParams", requestHolder.getApplicationParams()); result.put("protocalMustParams", requestHolder.getProtocalMustParams()); result.put("protocalOptParams", requestHolder.getProtocalOptParams()); result.put("url", url); return result; }
Example 3
Source File: DefaultAlipayClient.java From pay with Apache License 2.0 | 5 votes |
/** * * * @param request * @param accessToken * @param signType * @return * @throws AlipayApiException */ private <T extends AlipayResponse> Map<String, Object> doPost(AlipayRequest<T> request, String accessToken, String appAuthToken) throws AlipayApiException { Map<String, Object> result = new HashMap<String, Object>(); RequestParametersHolder requestHolder = getRequestHolderWithSign(request, accessToken, appAuthToken); String url = getRequestUrl(requestHolder); // 打印完整请求报文 if (AlipayLogger.isBizDebugEnabled()) { AlipayLogger.logBizDebug(getRedirectUrl(requestHolder)); } String rsp = null; try { if (request instanceof AlipayUploadRequest) { AlipayUploadRequest<T> uRequest = (AlipayUploadRequest<T>) request; Map<String, FileItem> fileParams = AlipayUtils.cleanupMap(uRequest.getFileParams()); rsp = WebUtils.doPost(url, requestHolder.getApplicationParams(), fileParams, charset, connectTimeout, readTimeout); } else { rsp = WebUtils.doPost(url, requestHolder.getApplicationParams(), charset, connectTimeout, readTimeout); } } catch (IOException e) { throw new AlipayApiException(e); } result.put("rsp", rsp); result.put("textParams", requestHolder.getApplicationParams()); result.put("protocalMustParams", requestHolder.getProtocalMustParams()); result.put("protocalOptParams", requestHolder.getProtocalOptParams()); result.put("url", url); return result; }
Example 4
Source File: MsgConnector.java From alipay-sdk-java-all with Apache License 2.0 | 4 votes |
public void onOpen(ServerHandshake handshakedata) { AlipayLogger.logBizDebug("conn open"); }
Example 5
Source File: MsgConnector.java From alipay-sdk-java-all with Apache License 2.0 | 4 votes |
public void onClose(int code, String reason, boolean remote) { AlipayLogger.logBizDebug("conn close"); }
Example 6
Source File: AlipayMsgClient.java From alipay-sdk-java-all with Apache License 2.0 | 4 votes |
private void doConnect() throws Exception { if (isConnected()) { return; } synchronized (this) { if (isConnected()) { return; } RegisterResponse regResp = register(); Map<String, String> httpHeaders = new HashMap<String, String>(1); if (regResp.getZone() != null && regResp.getZone().length() > 0) { httpHeaders.put("cookie", "zone=" + regResp.getZone() + ";"); } if (loadTest) { httpHeaders.put("LoadTest", "true"); } httpHeaders.put("Content-Type", "application/x-www-form-urlencoded;charset=" + charset); Map<String, String> params = new HashMap<String, String>(5); params.put("app_id", appId); params.put("charset", charset); params.put("link_token", regResp.getLinkToken()); params.put("timestamp", String.valueOf(System.currentTimeMillis())); params.put("sign_type", signType); params.put("sdk_version", AlipayConstants.SDK_VERSION); String signContent = AlipaySignature.getSignCheckContentV2(params); String sign = AlipaySignature.rsaSign(signContent, appPrivateKey, charset, signType); params.put("sign", sign); String query = WebUtils.buildQuery(params, charset); String urlStr = "ws" + (isSSL ? "s" : "") + "://" + serverHost + "/websocket?" + query; webSocketConnector = new MsgConnector(new URI(urlStr), httpHeaders, this, charset); if (!webSocketConnector.connectBlocking(10L, TimeUnit.SECONDS)) { throw new RuntimeException("connect timeout(10s)!"); } if (AlipayLogger.isBizDebugEnabled()) { AlipayLogger.logBizDebug("connected"); } } }
Example 7
Source File: AlipayMsgClient.java From alipay-sdk-java-all with Apache License 2.0 | 4 votes |
public ProduceMsgAck sendMessage(AlipayRequest msgReq) throws InterruptedException { if (!isConnected()) { throw new NotYetConnectedException(); } Message message = new Message(); message.setxCmd(MsgConstants.MSG_CMD_PRODUCE); message.setxSignType(signType); message.setxCharset(charset); message.setAppId(appId); message.setMsgApi(msgReq.getApiMethodName()); message.setxTimestamp(System.currentTimeMillis()); message.setBizContent(new JSONWriter().write(msgReq.getBizModel(), true)); Message.addSign(message, appPrivateKey); ProtocolData protocolData = new ProtocolData(); protocolData.setMessage(message); CountDownLatch signal = new CountDownLatch(1); ProtocolDataContext protocolDataContext = new ProtocolDataContext(); protocolDataContext.setSendData(protocolData); protocolDataContext.setSendSignal(signal); if (!sendingQueue.offer(protocolData.getStreamId(), 200, TimeUnit.MILLISECONDS)) { throw new RuntimeException("too many message not receive ack, refuse new send. streamId:" + protocolData.getStreamId()); } sendingContexts.put(protocolData.getStreamId(), protocolDataContext); String protocolDataStr = ProtocolData.toStr(protocolData); if (AlipayLogger.isBizDebugEnabled()) { AlipayLogger.logBizDebug("send msg:" + protocolDataStr.replaceAll("[\r\n]", " ")); } webSocketConnector.send(ProtocolData.toStr(protocolData)); boolean signalNotify = signal.await(10000, TimeUnit.MILLISECONDS); sendingQueue.remove(protocolData.getStreamId()); sendingContexts.remove(protocolData.getStreamId()); if (!signalNotify) { AlipayLogger.logBizError("wait ack timeout(10s). streamId:" + protocolData.getStreamId()); throw new RuntimeException("wait ack timeout(10s). streamId:" + protocolData.getStreamId()); } ProtocolData ackData = protocolDataContext.getAckData(); if (ackData == null) { throw new RuntimeException("ack protocol data null. streamId:" + protocolData.getStreamId()); } Message ackMsg = ackData.getMessage(); if (ackMsg == null) { throw new RuntimeException("ack msg null. streamId:" + protocolData.getStreamId()); } ProduceMsgAck produceMsgAck = new ProduceMsgAck(); produceMsgAck.setxStatus(MsgStatusEnum.fromStr(ackMsg.getxStatus())); produceMsgAck.setxCode(ackMsg.getxCode()); produceMsgAck.setxError(ackMsg.getxError()); produceMsgAck.setxMessageId(ackMsg.getxMessageId()); return produceMsgAck; }