First time here? Check out the FAQ!
Hi i want open an external url passing great number of padameters, however parameter bigger than 256 chars
Normally i use Executions.getCurrent().sendRedirect(url); with parameters in the url.
But in this case i must pass many and big parameters... so the url is not possible, if i try i receive the error " Request header is too large"
i cant use session cause they are two different servers... i've tried a using Apache Common post and it seems to invoke the destination server, but the page stays in the initial zk page, doestn change to the new page.
How can i open a page passing big parameters? im usig zk 6
when using the built-in method sendRedirect(url)
you're limited to HTTP-GET requests and their associated limitations. Usually webservers and java application servers have configurable limits for the maximum URL length, which includes the URL parameters => hence the message (Request header is too large)
Technically it doesn't sound like there's a limit so if your configuration can be savely adapted to what you need, then you might be set with just a few configuration changes.
If changing the server limits is not an option, you already looked into the right direction using HTTP-POST (which allows larger parameters by default - since they are sent in the request body instead of the header). However POSTing the request from the server won't/can't update the client side browser.
Instead you need to create a native html form with (e.g. hidden parameters) and post it via javascript in the browser.
Here a similar question maybe it already points you in the right direction: https://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
Thanks Cor3000 for the detailed response.
At first i thought that the limit was 256 chars in request but it is maybe an old limit for the browsers, not the http get per se.
I've tested and with Tomcat 7 in my local installation i can send almost 8000 chars with GET
For now i'll stick with the get Request,if necessary l'll try as you suggested, creating an hidden post. In reality i've tried with the post, but directly in java:
HttpPost request = new HttpPost(" someurl");
// add request parameter, form parameters
List<BasicNameValuePair> urlParameters = new ArrayList<BasicNameValuePair>();
urlParameters.add(new BasicNameValuePair("PARAM1", "param1"));
urlParameters.add(new BasicNameValuePair("BIG_PARAM", bigString()));
HttpClient client = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(urlParameters, Consts.UTF_8);
request.setEntity(entity);
HttpResponse response;
try {
response = client.execute( request);
//assertTrue(response.getStatusLine().getStatusCode() == 200);
System.out.println(response.getStatusLine().getStatusCode() );
} catch (IOException e) {
e.printStackTrace();
}
It almost works, but the view is not changed!!! I reach the new page ( i know this thanks to log messages), but the previous remains displayed...
Regards
ZB
Asked: 2020-10-09 20:22:10 +0800
Seen: 11 times
Last updated: Oct 12 '20
zk怎么实现动态字段的页面显示,我需要整合一个统计表,而这个统计表的显示字段是动态获取的,这个怎么办
When I used Echarts ,it is report an error
Difference between selenium-support and selenium-java jars
org.zkoss.zk.ui.UiException: You cannot access components belong to other desktop
Upload excel file and then send data in excel file to database oracle using zk framework