ここでは、eBayへのAPI呼び出しをアセンブルするこの関数があります。以前はEbayKeys.appidで作業していましたが、今度は2つ目のEbayKeys.appidを含める必要があります。Java EE if/else文が動作しない
パラメータappidGetは、request.getParameter( "token")を使用する別の関数から渡されます。私はcatalina.outに値を出力し、値は渡されますが、if/else文は実行されず、値を文字列に追加しません。
私はいくつかの異なる値で試してみましたが、いずれも機能しませんでした。私はJavaに全く触れられておらず、私がここで間違っていることを全く知らない。
public String getSearchUrl(String qurl, List<String> excludes, String appidGet) throws UnsupportedEncodingException {
String query = buildQuery(qurl, excludes);
String safequery;
try {
safequery = URLEncoder.encode(getQuery(),charset);
StringBuffer apicall = new StringBuffer();
apicall.append(EbayKeys.endpoint).append("?").append("OPERATION-NAME=findItemsByKeywords")
.append("&SERVICE-VERSION=").append(EbayKeys.version);
//Does not execute
if (appidGet == "one") {
apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid1);
}
else if (appidGet == "two") {
apicall.append("&SECURITY-APPNAME=").append(EbayKeys.appid2);
}
System.out.println(getClass().getName() + " "
+ Utils.getTime()
+ " APP ID = " + appidGet);
apicall.append("&GLOBAL-ID=").append(EbayKeys.globalid)
.append("&keywords=").append(safequery)
.append("&sortOrder=StartTimeNewest&paginationInput.entriesPerPage=2")
.append(query);
return apicall.toString();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";
}
事前に任意の助けてくれてありがとう。