[Java lista] http get

Jozsef Tabanyi joco at kac.duf.hu
2006. Nov. 29., Sze, 13:17:13 CET


Szia,

Biztos hogy erre valo a setRequestProperty ?

Probald meg igy:
http://localhost:9080/smsreceiver/smsreceiver?message=blalba&originator=123456

joco

Jozsef Tabanyi
mailto:jozsef at tabanyi.hu
http://www.tabanyi.hu
On Wed, 29 Nov 2006, Puskás Péter wrote:

> Sziasztok
>
> A szervlet:
>
>  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
>   logger.debug("Receive sms..");
>
>   String message = request.getParameter("message");
>   String phoneNumber = request.getParameter("originator");
>
> A cliens:
>
> URL myURL = new URL(http://localhost:9080/smsreceiver/smsreceiver);
>      // connect to this URL using a http connection
>      HttpURLConnection myHttpCon = null;
>      // get the output stream of the http connection
>      OutputStream out = null;
>      // open the input stream to get the response
>      InputStream in = null;
>
>      try {
>       // connect to this URL using a http connection
>       myHttpCon = (HttpURLConnection)myURL.openConnection();
>       // specify to use the POST method and that we want to send content
>       myHttpCon.setDoInput(true);
>       myHttpCon.setUseCaches(false);
>       myHttpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
>
>       myHttpCon.setRequestMethod("GET");
>       myHttpCon.setRequestProperty("message",smsMessage);
>       myHttpCon.setRequestProperty("originator",phoneNumber);
>
>
> A betett parameterek a szervlet oldalon már nem jelennek meg.
> Mi lehet az ok?
>
> Köszi
> Péter



További információk a(z) Javalist levelezőlistáról