On 22 août, 15:11, walsi <
stefan.walk...@gmail.com> wrote:
> Hi all,
>
> I try to open a URL with
>
> Window.open(url, "_blank", "");
>
> where GET-Data is in the url-variable. As the url-String is too long
> (and because I want to hide the information) I want to send my data
> via POST.
(are we still in the 20th century?! I thought people here in the 21st
c. knew about REST principles and how they apply to HTTP: GET is
idempotent while POST isn't; it's not about "I want to use POST vs.
GET" but "I *need* to use POST vs. GET")
> Is this possible?
Yes and no...
Give a name to your window and use that name in the target of your
form (this means you have to use a form).
...or if you don't want to play with the window "features" (size,
resizeability, position, scrolling, toolbars and menubar, etc.), just
use _blank or another target for your form (and you'll have to use a
form).
> If not, what other possibilities do I have?
You can send a POST in response to which the server generates a
temporary file and sends back the URL to that file, and then use
Window.open with that URL to open the generated file in a new window.
This has the advantage to work with a RequestBuilder to send the
initial POST.
> I need to open a new window with a given url where I sent POST-data to
> that url. (i.e., it's a php-file generating a PDF out of the data I
> sent to it).
Do several requests with the same sent "data" should result in the
same PDF being generated? If so, then you need GET (eventually, you
could use the POST+tempfile+GET approach, where the server optimizes
the POST handling using memoization [1]).
If the same input data results in different files over time, you might
have caching issues however, so using POST might proves useful, and
memoization would then help optimizing (adding to the equation the
time when the data last changed).
...but this is unrelated to GWT...
[1] e.g. generate a hash of the input data, if the corresponding
tempfile exists, you don't need to regenerate it, otherwise, generate
it with the hash as the filename.