use of org.apache.http.message.BasicNameValuePair in project 12306-hunter by xautlx.
the class HttpClientService method queryTrain.
public List<TrainQueryInfo> queryTrain(TicketData ticketData, UserData userData, String trainDate) {
HttpClient httpClient = buildHttpClient();
try {
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair(QUERY_TRAIN_DATE, trainDate));
parameters.add(new BasicNameValuePair(QUERY_FROM_STATION_TELECODE, ticketData.getTrainFromCode()));
parameters.add(new BasicNameValuePair(QUERY_TO_STATION_TELECODE, ticketData.getTrainToCode()));
parameters.add(new BasicNameValuePair(QUERY_TRAIN_NO, ""));
parameters.add(new BasicNameValuePair(QUERY_TRAINPASSTYPE, "QB"));
parameters.add(new BasicNameValuePair(QUERY_TRAINCLASS, "QB#D#Z#T#K#QT#"));
parameters.add(new BasicNameValuePair(QUERY_INCLUDESTUDENT, "00"));
parameters.add(new BasicNameValuePair(QUERY_SEATTYPEANDNUM, ""));
parameters.add(new BasicNameValuePair(QUERY_START_TIME_STR, "00:00--24:00"));
String response = getHttpRequestAsString(httpClient, GET_URL_QUERYTICKET, parameters, userData.getCookieData());
return TicketUtil.parserQueryInfo(response);
} finally {
httpClient.getConnectionManager().shutdown();
}
}
use of org.apache.http.message.BasicNameValuePair in project api-snippets by TwilioDevEd.
the class TwilioTest method main.
public static void main(String[] args) throws TwilioRestException {
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
// Build the parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("To", "+15558675309"));
params.add(new BasicNameValuePair("From", "+15017250604"));
params.add(new BasicNameValuePair("Body", "This is the ship that made the Kessel Run in fourteen parsecs?"));
MessageFactory messageFactory = client.getAccount().getMessageFactory();
Message message = messageFactory.create(params);
System.out.println(message.getSid());
}
use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.
the class paloconnection method logout.
// Logouts the current palo User
public void logout() throws paloexception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("sid", this.strToken));
try {
HttpEntity entity = sendToServer(qparams, "/server/logout");
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
// CsvReader csv = new CsvReader(sendToServer(qparams, "/server/logout").getContent(),
// Charset.defaultCharset());
csv.setQuoteChar('"');
csv.readNext();
csv.close();
entity.consumeContent();
// paloHttpClient.getConnectionManager().shutdown();
} catch (Exception e) {
throw new paloexception(e.getMessage());
}
}
use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.
the class paloconnection method getRulefunctions.
public String getRulefunctions() throws paloexception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("sid", getPaloToken()));
try {
StringBuilder sb = new StringBuilder();
HttpEntity entity = sendToServer(qparams, "/rule/functions");
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
csv.setQuoteChar('"');
while (csv.readNext()) {
sb.append(csv.get(0));
}
csv.close();
entity.consumeContent();
return sb.toString();
} catch (Exception e) {
throw new paloexception(e.getMessage());
}
}
use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.
the class paloconnection method load.
// Load the Server
public void load() throws paloexception {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("sid", this.strToken));
sendToServerSingleRC(qparams, "/server/load");
}
Aggregations