tags:

views:

280

answers:

1

Hi !

I'm using GWT to dynamically load html snippets from php script. I define the snippet i want the php script to return in the url (test.php?snippet=1). Now in GWT i have a function "getSnippet(int snippet id)" that uses a RequestBuilder to retrieve the snippet. It works perfectly fine, but it bothers me that i have to create a new RequestBuilder everytime getSnippet gets called. I'd rather have one ReqestBuilder and just change the url when getSnippet is called...

Is there a way to do this ?

Thank you !

A: 

In looking at the source code, I can't see a good reason why they are doing this. I would like to think that the GWT developers decided to leave out the setUrl method for a reason and included it in the constructor instead.

If you really want to do it, one way around this would be to extend the class and add a setUrl(String url) method. Modify all your current uses of RequestBuilder to use your newly extended class and see if anything breaks.

Nick