0

How open an url/page passing big data parameters

asked 2020-10-09 20:22:10 +0800

ziobleed gravatar image ziobleed
1 1

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

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
0

answered 2020-10-12 13:01:16 +0800

cor3000 gravatar image cor3000
5399 2 7
ZK Team

updated 2020-10-12 14:08:11 +0800

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

link publish delete flag offensive edit
0

answered 2020-10-12 18:27:21 +0800

ziobleed gravatar image ziobleed
1 1

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

link publish delete flag offensive edit

Comments

great to hear! and agreed ... sending a request at server side, won't update the browser ... so the view doesn't change which is expected in this case. It would be bad if server side operations had direct impact on the client side.

cor3000 ( 2020-10-12 18:45:27 +0800 )edit

just in case, did you have another question? or problem you needed help with?

cor3000 ( 2020-10-19 10:16:07 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2020-10-09 20:22:10 +0800

Seen: 8 times

Last updated: Oct 12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More