2
public IRequest buildGETRequest(INetListener listener,String collection,int topFilter,String filter) {      String query = "";
        if (topFilter>0) query = ODATA_TOP_FILTER + topFilter;
        if (!TextUtils.isEmpty(filter)){
            if (!TextUtils.isEmpty(query)) query += "&";
            query += ODATA_FILTER + filter; }
        IRequest request = new BaseRequest();
        request.setListener(listener);
        request.setPriority(IRequest.PRIORITY_HIGH);
        request.setRequestMethod(IRequest.REQUEST_METHOD_GET);
        String endPointURL = mEndPoint + collection;
        //Adding the JSON format
        if (mIsJSONFormat)      {
            endPointURL = endPointURL + "?" + ODATA_JSON_FORMAT;}
        if (!TextUtils.isEmpty(query))  {
            if(endPointURL.contains("?"))
                endPointURL = endPointURL + "&" + query;
            else
                endPointURL = endPointURL + "?" + query;}
        request.setRequestUrl(endPointURL);
        if (mIsMAFLogon) {
            Map<String,String> headers = new HashMap<String,String>();      
            headers.put(APP_CONNECTION_ID_HEADER, mSMPAppConnectionID);
            request.setHeaders(headers);}
        return request; }
4

0 回答 0