First time here? Check out the FAQ!
![]() | 1 | initial version | |
It's sad you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect happens via GET without re-sending the original POST parameters. Described in (I never understood why they make it difficult to actually find those specs):
https://download.oracle.com/otndocs/jcp/servlet-3_1-fr-eval-spec/index.html
In secion 10.10:
A request URI of "/foo/" will be returned as "/foo/index.html"
(or index.zul
as configured in your web.xml)
You can also observe this directly in the browsers developer tools.
The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.
![]() | 2 | No.2 Revision |
It's sad you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect happens via GET without re-sending the original POST parameters. Described in (I never understood why they make it difficult to actually find those specs):
https://download.oracle.com/otndocs/jcp/servlet-3_1-fr-eval-spec/index.html
In secion 10.10:
index.zul
as configured in your web.xml)You can also observe this directly in the browsers developer tools.
The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.
![]() | 3 | No.3 Revision |
It's sad to hear you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect happens via GET without re-sending the original POST parameters.
parameters.
https://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get Described in (I never understood why they make it difficult to actually find those specs):
https://download.oracle.com/otndocs/jcp/servlet-3_1-fr-eval-spec/index.html
In secion 10.10:
index.zul
as configured in your web.xml)You can also observe this directly in the browsers developer tools.
The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.
![]() | 4 | No.4 Revision |
It's sad to hear you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect happens via GET without re-sending the original POST parameters.
https://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get Described in (I never understood why they make it difficult to actually find those specs):
https://download.oracle.com/otndocs/jcp/servlet-3_1-fr-eval-spec/index.htmlServlet Spec 3.1
In secion section 10.10:
index.zul
as configured in your web.xml)You can also observe this directly in the browsers developer tools.
The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.
![]() | 5 | No.5 Revision |
It's sad to hear you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect (302) happens via GET without re-sending the original POST parameters.
parameters (https://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-getcommon surprise
).
Described in (I never understood why they make it difficult to actually find those specs):
Servlet Spec 3.1 section 10.10:
index.zul
as configured in your web.xml)You can also observe this th redirect directly in the browsers developer tools.
The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
https://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.