第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將 ruby?? 中的 HTTP post 轉(zhuǎn)換為 java 或 groovy

將 ruby?? 中的 HTTP post 轉(zhuǎn)換為 java 或 groovy

千萬里不及你 2021-08-19 17:45:30
我有一些用于訪問 API 的 ruby http post 代碼,但現(xiàn)在我需要將其轉(zhuǎn)換為 java 或 groovy這是我在 ruby 上的代碼def loginWithEmailPassword(str_email, str_password)  uri = URI(url)  req = Net::HTTP::Post.new(uri)  req['Content-Type'] = 'application/json'  req['x-request-id'] = "xyz-#{SecureRandom.hex}"  req['user-agent'] = 'xyz'  req.body = {   email: str_email,   password: str_password  }.to_json  Net::HTTP.start(uri.host, uri.port,    :use_ssl => uri.scheme == 'https',    :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|    response = http.request(req) # Net::HTTPResponse object    if(response.code != '200')      puts response.body # Show response body      raise ("ERROR: login error... error code #{response.code}")    end    return response.body  endend這是我在java上的代碼    def loginApiWithEmailPassword(String sEmail, String sPassword){            URL url = new URL(m_url + "/login/password");            JSONObject json = new JSONObject();            json.put("email", sEmail);            json.put("password", sPassword);            HttpURLConnection conn = (HttpURLConnection)url.openConnection();// set header            conn.setRequestMethod("POST")            conn.setRequestProperty("Content-Type", "application/json");            conn.setRequestProperty("user-agent", aaa);            conn.setRequestProperty("x-request-id", getSecureRandom(s))            conn.setDoOutput(true);            conn.setDoInput(true);            OutputStream os = conn.getOutputStream();            os.write(json.toJSONString().getBytes());            os.close();我試圖將其轉(zhuǎn)換為 java 但失敗了,卡在錯誤上 "javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"并且無法繼續(xù)檢查下一個功能,誰能幫我完成java或groovy的http post
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號