Changeset 158


Ignore:
Timestamp:
May 31, 2011, 4:57:58 PM (6 years ago)
Author:
tjeerd@…
Message:

#44 is resolved by this commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nugoctdwebapp/src/java/ctd/services/internal/GscfService.java

    r138 r158  
    88import java.io.BufferedReader;
    99import java.io.InputStreamReader;
     10import java.io.OutputStreamWriter;
    1011import java.net.HttpURLConnection;
    1112import java.net.URL;
     13import java.net.URLConnection;
    1214import java.util.HashMap;
    1315import java.util.LinkedList;
     
    5860        }
    5961
    60         // Add all the parameters given in the map to the querystring
    61         String strParam = "";
    62         if(!(restParams==null) && !restParams.isEmpty()) {
    63             for (Map.Entry<String, String> entry : restParams.entrySet()) {
    64                 strParam += "&"+entry.getKey()+"="+entry.getValue();
    65             }
    66         }
    67 
    6862        try {
    6963            // Place the REST call
    70             URL urlURL = new URL(this.restURL()+restMethod+"/query?token="+sessionToken+strParam);
     64            URL urlURL = new URL(this.restURL()+restMethod+"/query?token="+sessionToken);
    7165            HttpURLConnection connection = (HttpURLConnection)urlURL.openConnection();
     66
     67            connection.setDoOutput(true);
     68            OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream());
     69            boolean blnFirst = true;
     70            if(!(restParams==null) && !restParams.isEmpty()) {
     71                for (Map.Entry<String, String> entry : restParams.entrySet()) {
     72                    if(!blnFirst) {
     73                        wr.write("&");
     74                    } else {
     75                        blnFirst = false;
     76                    }
     77                    wr.write(entry.getKey()+"="+entry.getValue());
     78                }
     79            }
     80            wr.flush();
     81            wr.close();
     82
    7283            strRet[0] = connection.getResponseCode()+"";
    7384            strRet[1] = "";
     
    8293            }
    8394            connection.disconnect();
     95            //Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, "callGSCF result "+strRet[0]+":<br />"+strRet[1]);
    8496        } catch(Exception e) {
    85             Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, "callGSCF Internal Error: \n"+e.getLocalizedMessage()+"\n"+e.toString()+"\nSessionToken: ["+sessionToken+"]\nrestMethod: ["+restMethod+"]\nparam: ["+strParam+"]");
     97            Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, "callGSCF Internal Error: \n"+e.getLocalizedMessage()+"\n"+e.toString()+"\nSessionToken: ["+sessionToken+"]\nrestMethod: ["+restMethod+"]");
    8698            throw new Exception500InternalServerError(e.getMessage());
    8799        }
Note: See TracChangeset for help on using the changeset viewer.