olá…
estou usando o HttpConnection para enviar um string para o servidor da seguinte forma
public void sendPostRequest(String nmea) {
HttpConnection hc = null;
DataOutputStream dos = null;
try {
hc = (HttpConnection)
Connector.open(defaultURL, Connector.READ_WRITE);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0");
hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// Send the string entered by user byte by byte
dos = hc.openDataOutputStream();
byte[] request_body = nmea.getBytes();
for (int i = 0; i < request_body.length; i++) {
dos.writeByte(request_body[i]);
}
dos.flush();
dos.close();
} catch (IOException ioe) {
} finally {
// Free up i/o streams and http connection
try {
if (hc != null) hc.close();
} catch (IOException ignored) {}
try {
if (dos != null) dos.close();
} catch (IOException ignored) {}
}
}
como recuperar este string numa Action do Struts 2?