Open an url

Hello
I’m developing an app that gets information from an api rest, so I need to request that information, and then, parse it. I don’t know how I can to open url and control the response, because I would like to know when I have a no empty response. I tried using requestbuilder, of GWT, but it doesn’t work because when i am in the IDE that works well, but when I use the app deployed, it doesn’t find the classes, although I have them in the pom and downloaded.
Can someone help me please?

Thanks so much

Hi Juan,

I’m not sure if this helps but it sounds like you’ll probably be interested in using HttpServletRequestListener or PortletRequestListener depending on whether or not you’re using a servlet or portlet architecture. You can capture the appropriate request object and parse the parameters from the onRequestStart handler.

See http://demo.vaadin.com/6.2.0.pre1/docs/api/com/vaadin/terminal/gwt/server/HttpServletRequestListener.html for more information.

Thanks,

Mark

A more up-to-date link to the javadoc would be
https://vaadin.com/api/com/vaadin/terminal/gwt/server/HttpServletRequestListener.html
.

What you are trying to do is not quite clear to me, so a couple of questions:

  • Are you accessing the service from the server side (as you probably should in a Vaadin application) or the client side?
  • Do you provide the REST service or is it somewhere else?
  • Does the service need to be provided by a Vaadin servlet, or can it be a separate servlet (possibly in the same WAR)?

The GWT JARs are probably specified as compile time only in your POM (as they usually should be), so that might be the reason why their classes are not available on the server. You might also want to look at other alternatives than GWT requestbuilder, which I believe is at least primarily intended to be used from the client side.

*from server side
*I have an api Rest deployed in my tomcat, so I want to acces calling to the url, I get the Json and I parse it. About parse it…I know, but the first…I don’t know.

I will try all of your answers guys, and I report the results. Thanks so much

Fixed.
I couldn’t use the resources that gwt provides(e.g. requestbuilder) because there are resources for the client side, and vaadin work in the server side.
I fixed it using an external library, called httpclient, from http components(Apache). I had to play with the responses time…but well, that works for now.

Thanks everyone for your answers