You need to replace your HttpURLConnection(s) with RequestBuilder, GWT-RPC, 
or similar http request. Depending on your selection of http connection, 
and assuming you're connecting to the same server where the application is 
hosted, your URL will become a Path to your RPC Servlet, REST endpoint, etc 
or be a String that you provide to said http request.

Here's the section of the docs where client-server communication is 
discussed:
http://www.gwtproject.org/doc/latest/tutorial/clientserver.html


On Monday, January 23, 2017 at 9:13:28 AM UTC-7, Dhinakar Reddy Pothireddi 
wrote:
>
> I am trying to use the code in my client code
>
> public PingObj pingUrl(final String address) {
> PingObj po = new PingObj();
> try {
> final URL url = new URL("http://"; + address);
> po.setAddress(url.toString());
> final HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
> urlConn.setConnectTimeout(1000 * 10); // mTimeout is in seconds
> final long startTime = System.currentTimeMillis();
> po.setStartTime(startTime);
> urlConn.connect();
> final long endTime = System.currentTimeMillis();
> po.setEndTime(endTime);
> if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
> System.out.println("Time (ms) : " + (endTime - startTime));
> System.out.println("Ping to " + address + " was success");
> po.setSuccess(true);
> po.setTimeTaken(endTime - startTime);
> return po;
> }
> } catch (final Exception e1) {
> e1.printStackTrace();
> po.setSuccess(false);
> }
> return po;
> }
>
> which uses java.net.HttpURLConnection, java.net.URL which cannot be used 
> on the GWT Client side. I am new to this. How to handle these on client 
> side?
>
> Thanks in advance. 
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to