gpt4 book ai didi

java - 从 HTTP 调用时 URL 返回 504 错误

转载 作者:搜寻专家 更新时间:2023-10-30 21:12:37 25 4
gpt4 key购买 nike

我有这段代码,可以触发一些异步 http 调用:

private CompleteRoutingResponseWrapper sendRoutingRequestString(int numOfTries, String routingRequestUrl) {
routingRequestUrl = urlUtils.getHttpUrl(routingRequestUrl);

CompleteRoutingResponseWrapper answer = new CompleteRoutingResponseWrapper();
CloseableHttpClient client = HttpClientBuilder.create().build();
CloseableHttpResponse response = null;
try {

Stopwatch stopWatch = Stopwatch.createStarted();
response = client.execute(new HttpGet(routingRequestUrl));
stopWatch.stop();

int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
answer = retryOrHandleError(numOfTries, routingRequestUrl, answer, response, statusCode);
} else {
String bodyAsString = EntityUtils.toString(response.getEntity());
answer.completeRoutingResponse = handleSuccess(bodyAsString);
answer.latency = stopWatch.elapsed(TimeUnit.MILLISECONDS);
handleErrorInBody(routingRequestUrl, answer, bodyAsString);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
handleNullResponse(answer);
return answer;
}

    @Override
public E2EResult sendBaselineRoutingRequestsInParallel(E2EResult e2EResult, List<String> routingRequestsList) {
List<Callable<Void>> callables = new ArrayList<>();
for (int i = 0; i < routingRequestsList.size(); i++) {
final int position = i;
callables.add(() -> {

//calls sendRoutingRequestString()

synchronized (e2EResult) {
e2EResult.addResponse(relativePosition, requestPosition, routingResponse);
}
return null;
});
}
ExecutorService executorService = Executors.newFixedThreadPool(10);
try {
executorService.invokeAll(callables);
executorService.shutdown();
executorService.awaitTermination(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return e2EResult;
}

当代码调用这个url时它总是返回 504。

http://myhost.com/routingRequest?returnJSON=true&timeout=60000&to=s%3A-1+d%3Afalse+f%3A-1.0+x%3A-71.25576+y%3A42.393196+r%3A-1.0+cd%3A-1.0+fn%3A-1+tn%3A-1+bd%3Atrue&nPaths=1&returnClientIds=true&hour=12+00&from=s%3A-1+d%3Afalse+f%3A-1.0+x%3A-71.270565+y%3A42.361661+r%3A-1.0+cd%3A-1.0+fn%3A18399181+tn%3A18418746+bd%3Afalse&sameResultType=true&type=HISTORIC_TIME&clientVersion=3.9.4.5&options=AVOID_PRIMARIES%3Afalse%2CIGNORE_REALTIME_INFO%3Afalse%2CAVOID_LONG_TRAILS%3Afalse%2CPREFER_SAME_STREET%3Atrue%2CAVOID_TRAILS%3Atrue%2CAVOID_TOLL_ROADS%3Afalse%2CALLOW_UTURNS%3Atrue%2CAVOID_DANGER_ZONES%3Afalse%2CUSE_EXTENDED_INSTRUCTIONS%3Atrue%2CALLOW_UNKNOWN_DIRECTIONS%3Atrue%2CPREFER_UNKNOWN_DIRECTIONS%3Afalse
2015-04-20 12:00:27,580 [pool-6-thread-37] INFO linqmap.routing.server.RoutingServer - ROUTING RECORDED: http://104.155.3.206:8080/RoutingManager/routingRequest?returnJSON=true&timeout=60000&to=s%3A34790759+d%3Afalse+f%3A-1.0+x%3A-73.993644+y%3A40.725395+r%3A-1.0+cd%3A-1.0+fn%3A-1+tn%3A-1+bd%3Atrue+st%3ABleecker%7ESt&via=s%3A-1+d%3Afalse+f%3A-1.0+x%3A-73.970138+y%3A40.850933+r%3A-1.0+cd%3A-1.0+fn%3A-1+tn%3A-1+bd%3Atrue&nPaths=1&returnClientIds=true&hour=12+00&from=s%3A-1+d%3Afalse+f%3A-1.0+x%3A-74.499669+y%3A40.907095+r%3A-1.0+cd%3A-1.0+fn%3A26380096+tn%3A26369788+bd%3Afalse&sameResultType=true&type=HISTORIC_TIME&clientVersion=3.9.4.0&stickToPath=68748394%2C26380096%2C-74.499669%2C40.90709599999985%2C70124838%2C26369788%2C-74.4879635129%2C40.89700597919985%2C32022797%2C26363639%2C-74.47420799999999%2C40.888397%2C70124821%2C26364659%2C-74.473163%2C40.887729%2C70124763%2C26372113%2C-74.447036%2C40.867209%2C82165445%2C26383674%2C-74.436374%2C40.865995999999996%2C82165444%2C61632550%2C-74.42966579042002%2C40.86547995136578%2C32042389%2C26380593%2C-74.42253199999999%2C40.86481%2C32042368%2C26375759%2C-74.417202953606%2C40.864137081396%2C77279241%2C26375309%2C-74.41294095733805%2C40.863467589631426%2C70095591%2C26384446%2C-74.376045753363%2C40.859071166122%2C70095592%2C55924040%2C-74.37594651163%2C40.859023493747%2C32017573%2C26369682%2C-74.370465%2C40.858565999999996%2C32026992%2C26381802%2C-74.36630671163941%2C40.85963780064551%2C70103895%2C26355007%2C-74.364014%2C40.860688%2C32021149%2C26387421%2C-74.348252%2C40.862038%2C81799536%2C26366817%2C-74.332561746032%2C40.865046796007%2C81799535%2C61394559%2C-74.33080526129919%2C40.867546977540954%2C81594035%2C26462012%2C-74.267987%2C40.894009999999845%2C81594036%2C61275184%2C-74.26644658817527%2C40.894150992075915%2C31826149%2C26209096%2C-74.260271869698%2C40.895000358355%2C31836443%2C26211925%2C-74.243818%2C40.898628999999985%2C62831293%2C50477837%2C-74.236227%2C40.89951499999999%2C31828680%2C26216038%2C-74.223238%2C40.896674%2C66963280%2C26213495%2C-74.217292%2C40.896881%2C66963281%2C54921707%2C-74.201265640258%2C40.896215021313%2C62635498%2C26205873%2C-74.195631802082%2C40.902313879819%2C62634850%2C26205899%2C-74.193551%2C40.903933%2C31827500%2C53429193%2C-74.187740500651%2C40.906083895573%2C31828511%2C26207333%2C-74.175887620314%2C40.908608789887%2C62830630%2C26215611%2C-74.172994%2C40.908136999999996%2C31822835%2C26208588%2C-74.16542299999999%2C40.906765%2C31821799%2C26208587%2C-74.164087176322%2C40.906531725309%2C31827601%2C26203370%2C-74.150353%2C40.901033999999996%2C31822325%2C26210942%2C-74.148544%2C40.900763999999995%2C62828098%2C26216008%2C-74.141492947934%2C40.900902674596%2C62828099%2C26204554%2C-74.1343779705695%2C40.90196699999999%2C31780255%2C26162340%2C-74.133401%2C40.901947%2C31774342%2C26180321%2C-74.132723957298%2C40.901879908805%2C57800509%2C50482578%2C-74.130132943389%2C40.901439983379%2C57800530%2C50482627%2C-74.12250004970679%2C40.9021896397596%2C57798264%2C50476814%2C-74.109068017531%2C40.903956841396%2C57800593%2C50482750%2C-74.101260107091%2C40.903513888913%2C77686519%2C50482775%2C-74.0948363245252%2C40.90314988083412%2C77686520%2C59180515%2C-74.0947520105031%2C40.90312009790261%2C57800610%2C50482827%2C-74.084037681225%2C40.900899572758%2C57800659%2C50482862%2C-74.079242%2C40.894788%2C57800667%2C50482884%2C-74.073051353099%2C40.889947032595%2C57628284%2C50204031%2C-74.070806%2C40.88786499999999%2C80919510%2C50483627%2C-74.065405%2C40.880548000000005%2C80919511%2C60920945%2C-74.06535647780983%2C40.88044267815794%2C57781450%2C50443308%2C-74.061952372194%2C40.874603940104%2C57801359%2C50483695%2C-74.05936865639366%2C40.871635692932124%2C57801387%2C50483771%2C-74.056716700197%2C40.86936505963%2C57801383%2C50483766%2C-74.053224464059%2C40.867730233131%2C57801441%2C50483931%2C-74.0458106541614%2C40.866854252450985%2C57801438%2C50483925%2C-74.03857089857533%2C40.866849932787666%2C57801489%2C50484048%2C-74.03333388547412%2C40.866929039277%2C70111230%2C50204034%2C-74.015414%2C40.864736%2C70111231%2C55929102%2C-74.01534574758949%2C40.864744383293896%2C57801554%2C50484211%2C-74.010145%2C40.864293999999994%2C57801555%2C50484214%2C-74.0057239933%2C40.866047894927%2C31775344%2C50475854%2C-74.003973640142%2C40.867462615956%2C77904107%2C55775406%2C-74.00046072799489%2C40.867327034479956%2C67535147%2C26183541%2C-73.99894732645%2C40.866741567445%2C62813313%2C50534492%2C-73.99537791863%2C40.865405376558%2C77248723%2C26177925%2C-73.9939651232032%2C40.86486225037791%2C31799901%2C26185233%2C-73.992961%2C40.864447999999996%2C31798621%2C26174851%2C-73.99230399999999%2C40.864193%2C31795568%2C26164610%2C-73.991546%2C40.86383%2C31803414%2C26164611%2C-73.99046899999999%2C40.863208%2C31818540%2C26178529%2C-73.99041%2C40.863174%2C67201279%2C26177935%2C-73.989553%2C40.862674%2C67201280%2C54995870%2C-73.989412352115%2C40.862591913944%2C76256218%2C26177934%2C-73.98871%2C40.862182%2C75329485%2C26178537%2C-73.987951%2C40.861739%2C75329486%2C58130509%2C-73.98712145379588%2C40.861250469190374%2C75329474%2C58130505%2C-73.9869842878087%2C40.861169689966246%2C31799910%2C26178554%2C-73.98665199999999%2C40.860974%2C31812452%2C26178555%2C-73.985675%2C40.860397999999996%2C31812451%2C26185240%2C-73.98501999999999%2C40.860071%2C31790726%2C26195967%2C-73.98475700000002%2C40.860006999999996%2C31779452%2C26193617%2C-73.98389399999999%2C40.859863%2C31790723%2C26190049%2C-73.983762%2C40.859840999999996%2C31805237%2C26190051%2C-73.982719%2C40.859637%2C31819138%2C26169419%2C-73.981672%2C40.859044999999995%2C31773857%2C26169420%2C-73.981427%2C40.85881%2C62036986%2C26178548%2C-73.981338%2C40.858725%2C31816656%2C26161652%2C-73.980741146427%2C40.858183753144%2C31816657%2C26165984%2C-73.980238%2C40.85776900000001%2C31810422%2C26165692%2C-73.97998879147944%2C40.857540991908515%2C74600609%2C26165691%2C-73.979383%2C40.856932%2C31815682%2C26175755%2C-73.97734928131%2C40.855339304184%2C31792625%2C26174853%2C-73.976708233356%2C40.854905155558%2C31798884%2C26175766%2C-73.97572199999999%2C40.85427%2C66631511%2C26192606%2C-73.975037%2C40.85383099999999%2C66631510%2C54813651%2C-73.974560011985%2C40.85352644857%2C74600608%2C59100141%2C-73.97417578509189%2C40.85327482413075%2C63804663%2C26176022%2C-73.97232799999999%2C40.852081999999996%2C63804661%2C53781615%2C-73.971738345429%2C40.85169545142%2C31816684%2C26176021%2C-73.971051%2C40.851321%2C77739023%2C26183375%2C-73.970163%2C40.851185%2C77739023%2C26183375%2C-73.970163%2C40.851185%2C77739023%2C26183375%2C-73.970163%2C40.851185%2C76625064%2C58641827%2C-73.97047306871995%2C40.85063137012922%2C63640510%2C53727805%2C-73.970500402135%2C40.850200511658%2C31801169%2C26166007%2C-73.970465533418%2C40.850005738641%2C77226611%2C58940642%2C-73.97035448674053%2C40.84953254404849%2C77226602%2C58940637%2C-73.9704901172258%2C40.84877280674154%2C82857216%2C52894951%2C-73.97069092503267%2C40.848207731172614%2C82857217%2C62025109%2C-73.97098939772309%2C40.84700235053454%2C83096982%2C26165719%2C-73.97102458649302%2C40.8467898564558%2C62038167%2C26165720%2C-73.97114096197254%2C40.846033948618086%2C31802739%2C26176026%2C-73.9715421199809%2C40.845449397422975%2C31800810%2C26163597%2C-73.9720159362858%2C40.84486800580796%2C31795303%2C26163596%2C-73.9724531363555%2C40.844258274716566%2C31791991%2C26176028%2C-73.97282462230335%2C40.84361911630188%2C31802725%2C26182044%2C-73.9731840383119%2C40.84297792261919%2C31789177%2C26163600%2C-73.97364135494907%2C40.842367159577286%2C77280806%2C26163599%2C-73.97417645564737%2C40.84181827968296%2C77280807%2C58968557%2C-73.97479202261584%2C40.84127142439922%2C31798976%2C26166022%2C-73.97516350856507%2C40.84093356906518%2C31798969%2C26166021%2C-73.976036%2C40.840157000000005%2C31802741%2C26183382%2C-73.976615%2C40.839631%2C31802742%2C26166017%2C-73.976975%2C40.839303%2C31792750%2C26166016%2C-73.97720199999999%2C40.839096999999995%2C31780868%2C26176031%2C-73.97774700000001%2C40.838542%2C62832556%2C26195419%2C-73.978069999999%2C40.838165648992%2C31789400%2C26195101%2C-73.978252112865%2C40.8374718459%2C31798977%2C26183388%2C-73.978287%2C40.836658%2C31801174%2C26176044%2C-73.978375%2C40.835117%2C31778949%2C26176048%2C-73.978509%2C40.832657%2C31802743%2C26192705%2C-73.978662%2C40.832332%2C31816709%2C26166026%2C-73.97895199999999%2C40.831683%2C31778945%2C26166025%2C-73.979187%2C40.831100000000006%2C31782808%2C26176010%2C-73.979233%2C40.830985999999996%2C31802137%2C26181385%2C-73.97925599999999%2C40.83093%2C31795997%2C26162446%2C-73.97951800000001%2C40.830373%2C31771610%2C26166695%2C-73.979886%2C40.829705%2C68977567%2C26166692%2C-73.979946%2C40.82959699999999%2C31810388%2C26175714%2C-73.980231%2C40.82904400000001%2C31810387%2C26165657%2C-73.98055989204899%2C40.82842328993616%2C31810386%2C26165656%2C-73.980919%2C40.827777999999995%2C31795306%2C26175706%2C-73.9813065277863%2C40.82713770144806%2C31816396%2C26174077%2C-73.98170751803282%2C40.82648011147272%2C31816398%2C26165655%2C-73.98211189203076%2C40.82583334073236%2C31801105%2C26165654%2C-73.98272048098565%2C40.82532226680017%2C31792604%2C26165662%2C-73.98355184540367%2C40.82491817794042%2C31778903%2C26175708%2C-73.98414841104508%2C40.82447213351656%2C31792605%2C26183180%2C-73.9841981009446%2C40.82441408209391%2C31810385%2C26183179%2C-73.984342940231%2C40.824231411363%2C31795861%2C26175713%2C-73.984683580776%2C40.823836637902%2C31792607%2C26165664%2C-73.984981305977%2C40.823486515512%2C31789684%2C26165663%2C-73.985169060608%2C40.82324802529%2C31806752%2C26195337%2C-73.985387660642%2C40.823008519353%2C31784634%2C26188679%2C-73.98561028399%2C40.822646214237%2C31806762%2C26183186%2C-73.985698%2C40.8225134459592%2C67620351%2C26175716%2C-73.98643303571059%2C40.82202173965591%2C67620350%2C55128309%2C-73.98677286505641%2C40.822022742579406%2C62706668%2C53449529%2C-73.987300075668%2C40.821883337319%2C31787437%2C26165647%2C-73.9878712478504%2C40.821425699457855%2C31806757%2C26183178%2C-73.98805665969788%2C40.819965136381875%2C31815624%2C26182522%2C-73.988573%2C40.818338%2C31804675%2C26182521%2C-73.98876%2C40.817889%2C31804677%2C26188681%2C-73.988856%2C40.817597%2C31801106%2C26188682%2C-73.989188%2C40.816053%2C31810399%2C26192591%2C-73.98952114582%2C40.815308593098%2C31773361%2C26175723%2C-73.989818602802%2C40.814660762294%2C31816432%2C26175722%2C-73.98993393779%2C40.814407015504%2C68057831%2C26188690%2C-73.990028083324%2C40.814186020908%2C63645591%2C26165677%2C-73.99033921957%2C40.813024859346%2C31810416%2C26183211%2C-73.990562%2C40.811828999999996%2C62147815%2C26192603%2C-73.991249859651%2C40.809463832911%2C62147814%2C53283970%2C-73.992199445331%2C40.807327250841%2C31774768%2C26162949%2C-73.992184%2C40.807207%2C65095855%2C53214018%2C-73.992135494947%2C40.807083176004%2C65095861%2C54316573%2C-73.99175533652%2C40.806147863741%2C61247164%2C52739752%2C-73.993044137953%2C40.804476962681%2C31784707%2C26194897%2C-73.993277%2C40.8042%2C78083394%2C26166216%2C-73.993693%2C40.802893%2C77738922%2C26329685%2C-73.993993848562%2C40.800629702128%2C31983566%2C26329684%2C-73.995785564184%2C40.797628703534%2C75300322%2C26330597%2C-73.99686593225445%2C40.79561999690159%2C75300345%2C58120528%2C-73.9971623718514%2C40.79463880108679%2C75300344%2C58120536%2C-73.99756464362603%2C40.79342523478009%2C75300257%2C26329188%2C-73.998843282461%2C40.791252654063%2C67607832%2C55123681%2C-73.99915539615628%2C40.79072716678898%2C61223421%2C26329187%2C-73.99984204166375%2C40.78952091849904%2C70449012%2C52718613%2C-74.00017751496715%2C40.789078387394106%2C57798993%2C50479486%2C-74.00050186508145%2C40.78859794099461%2C71136093%2C50479472%2C-74.00073655837046%2C40.78827910970066%2C61965483%2C52739398%2C-74.00303674977678%2C40.785648356985405%2C31981218%2C53213525%2C-74.00416059535453%2C40.78454762288227%2C61965224%2C52739402%2C-74.005713%2C40.78371982520375%2C61965471%2C53213361%2C-74.006961%2C40.78322299999999%2C65091141%2C53213510%2C-74.008176807671%2C40.782660758767%2C65091140%2C54314892%2C-74.00930333545806%2C40.78141069773531%2C61246903%2C52739415%2C-74.0097861330802%2C40.78078515064632%2C78650194%2C52739418%2C-74.01037219574967%2C40.78002148777136%2C68002347%2C55252373%2C-74.010981495402%2C40.779170319091%2C65091643%2C52739433%2C-74.01189434936609%2C40.77810721445247%2C77264368%2C54315026%2C-74.01217909384205%2C40.77666271719232%2C77264370%2C58960364%2C-74.01208487877524%2C40.77599371191459%2C65091645%2C54315027%2C-74.012574289352%2C40.775124494048%2C63530968%2C53695704%2C-74.013888571769%2C40.773241563799%2C78650240%2C53446899%2C-74.01463710399635%2C40.77198542299794%2C76888728%2C58772673%2C-74.0153130206686%2C40.77066609636355%2C65969583%2C54602784%2C-74.0161766919711%2C40.76943409179636%2C76888794%2C58772707%2C-74.01797645421976%2C40.767705387355704%2C71224495%2C54602789%2C-74.01836289460584%2C40.76725164577135%2C71224497%2C56303590%2C-74.019101242437%2C40.76626582392%2C73123460%2C56303591%2C-74.02041036109651%2C40.76468493796235%2C73123459%2C57174697%2C-74.02144661838506%2C40.763787286314674%2C71437507%2C54107869%2C-74.023181343234%2C40.764524275537%2C71437506%2C56378420%2C-74.02488580841964%2C40.762927206944426%2C70208681%2C53137389%2C-74.02499536680554%2C40.76282736975062%2C61544911%2C52919634%2C-74.025255128766%2C40.763043056957%2C64045086%2C50468096%2C-74.022706%2C40.766034%2C31980986%2C53860545%2C-74.01119897978998%2C40.76307224938859%2C34785909%2C28572409%2C-73.997052%2C40.757120999999984%2C72565265%2C28572411%2C-73.996089%2C40.75678699999999%2C72565266%2C56894152%2C-73.99624562111458%2C40.7557360891028%2C72565299%2C56893945%2C-73.99643110566099%2C40.755446820422115%2C72565300%2C56894168%2C-73.99645881260729%2C40.75513717727398%2C34792111%2C50469875%2C-73.9963936908073%2C40.755113237025%2C34786937%2C28571755%2C-73.995354%2C40.75468799999999%2C34793159%2C28571754%2C-73.995816%2C40.754056999999996%2C34791030%2C28573034%2C-73.99631204662704%2C40.75340322290694%2C34790853%2C28573033%2C-73.99680877546308%2C40.75274331864109%2C63767520%2C28569550%2C-73.9977551018524%2C40.75152360613159%2C63767519%2C53769204%2C-73.99809431314036%2C40.75104408667463%2C34787374%2C28569549%2C-73.9981921201915%2C40.75090439713815%2C34790923%2C28572832%2C-73.99865844251728%2C40.75025253430687%2C75233111%2C28572917%2C-73.99907523313522%2C40.74964206391726%2C34791921%2C28569684%2C-73.999938%2C40.7484%2C34789289%2C28569991%2C-74.000399%2C40.747766999999996%2C62138857%2C28569990%2C-74.00083863991263%2C40.74716233183888%2C34790135%2C28569680%2C-73.99800086277465%2C40.745963420770515%2C34788033%2C28572777%2C-73.99516100000001%2C40.744763%2C34786800%2C28572775%2C-73.995645%2C40.744099%2C34788677%2C28572774%2C-73.996129%2C40.743431%2C34790918%2C28569679%2C-73.99658%2C40.742810999999996%2C34790233%2C28569678%2C-73.997007%2C40.742228%2C34786447%2C28569675%2C-73.997434%2C40.741642%2C34786872%2C28569673%2C-73.997872173852%2C40.741033380692%2C34788730%2C28574644%2C-73.99828699999999%2C40.74047%2C34790914%2C28571556%2C-73.99871300000001%2C40.739881%2C34786868%2C28569671%2C-73.999185%2C40.739242999999995%2C34787420%2C53695324%2C-73.99968655690294%2C40.73855308166271%2C34788729%2C28571555%2C-74.00018299999999%2C40.737865%2C34790911%2C28569670%2C-74.000647%2C40.73723%2C34789952%2C28569669%2C-74.00109499999999%2C40.736564%2C34785789%2C28570052%2C-74.001553%2C40.735797%2C34787564%2C28571838%2C-74.001693%2C40.735534%2C34786972%2C28570048%2C-74.001972%2C40.73507%2C34791072%2C28570047%2C-74.002391%2C40.734339999999996%2C34785785%2C28573075%2C-74.00274464488%2C40.733732427373%2C34788218%2C28571820%2C-74.002809017897%2C40.733615561703%2C74393453%2C28570049%2C-74.00258909325204%2C40.73336343769091%2C74393452%2C57741913%2C-74.00248716930949%2C40.73325368498092%2C34791090%2C28571839%2C-74.00212775330117%2C40.73284109446873%2C34787567%2C28571841%2C-74.001663%2C40.732318%2C34792208%2C28571843%2C-74.00116695741059%2C40.73177398640345%2C34787417%2C28569666%2C-74.001008778809%2C40.731709983956%2C34788107%2C28569664%2C-73.99960399999999%2C40.731043%2C34789082%2C28571546%2C-73.99884200000001%2C40.730669%2C34792898%2C28571030%2C-73.998072%2C40.730288%2C34787389%2C28572873%2C-73.99736%2C40.729941000000004%2C34786361%2C28573567%2C-73.996572%2C40.729552%2C34789083%2C28573568%2C-73.995812%2C40.72918%2C34791576%2C28571086%2C-73.99506099999999%2C40.728809999999996%2C34789137%2C28571089%2C-73.994252%2C40.728412%2C34790730%2C28572652%2C-73.99476486328368%2C40.727804292311454%2C34791648%2C28571183%2C-73.99526999999999%2C40.727211000000004%2C34790735%2C28571182%2C-73.99584399999999%2C40.726526%2C34789507%2C28571181%2C-73.99506%2C40.726137%2C63722987%2C28571186%2C-73.994648%2C40.725930999999996%2C63722986%2C53753358%2C-73.994476277156%2C40.725852627225%2C34790759%2C28574252%2C-73.993758%2C40.725646999999995&options=IGNORE_REALTIME_INFO%3Afalse%2CALLOW_NEAR_BY_TARGET%3Atrue%2CAVOID_TOLL_ROADS%3Afalse%2CALLOW_UNKNOWN_DIRECTIONS%3Atrue%2CPREFER_UNKNOWN_DIRECTIONS%3Afalse%2CALLOW_NEAR_BY_SOURCE%3Atrue%2CAVOID_PRIMARIES%3Afalse%2CAVOID_LONG_TRAILS%3Afalse%2CPREFER_SAME_STREET%3Atrue%2CAVOID_TRAILS%3Atrue%2CALLOW_UTURNS%3Atrue%2CAVOID_DANGER_ZONES%3Afalse%2CUSE_EXTENDED_INSTRUCTIONS%3Atrue

然而,当我通过 chrome 浏览器放置它时,我从来没有得到 504。

我认为这可能是压力问题。但即使我在我的代码中只调用了几个 url,我也只得到这个特定 url 的 504。

它可以是什么? Jersey 中的长 url 错误?

最佳答案

您似乎在期待 JSON 响应。我注意到在某些情况下,JSON 解析可能存在问题,尤其是对于嵌入式 Jersey 容器,例如将其作为 JUnit 测试的一部分运行。

当您直接针对浏览器运行 URL 时,您并没有解析 JSON,因为浏览器只是以 JSON 格式显示结果。浏览器非常适合处理 JSON。

检查并确保负责构建 JSON 对象的代码正确执行。

关于java - 从 HTTP 调用时 URL 返回 504 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30543285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com