admin管理员组

文章数量:1290938

i have made a dynamic blog engine, where multiple authors can publish articles.

the author goes to a page where he inputs the 'article' 'description' and 'the whole article' in three <textarea> Then i store all the values in 3 variables and store it in the database via an ajax based request.

The Problem: The HttpServerRequest is too large and it gives a 413 FULL Head error, and the request doesnt get through.

The Code:

The HTML:

<div class="container">
        <h4 class="text-left">Title:</h4>
        <textarea id="title" rows="2" cols="" ></textarea>
        <br />
        <h4 class="text-left">Description:</h4>
        <textarea id="description" rows="5" cols="" ></textarea>
        <br />
        <h4 class="text-left">Article:</h4>
        <textarea id="article" rows="40" cols="" onkeyup="replaceWordChars(this.value)"></textarea>
        <br />

        <div class="publish btn">Publish</div>
        <br />
        <br />
    </div>

The Script:

<script>
    $(function(){
        $('.publish').click(function(){
            title = $('#title').val();
            description = $('#description').val();
            article = $('#article').val();

            $.ajax({
                type:       "get",
                url:        "/articles",
                data:       {action:'add', title:title, description:description, article:article},
                success:    function(code)
                {
                            alert("published"); 
                            window.location="dashboard.jsp";
                }

            }).error(function(){ alert("error"); })
            plete(function(){ alert("plete"); });

        });

    });
    </script>

The ERROR:

"NetworkError: 413 FULL head - http:///articles?action=add&title=blah&..........gs.%0A%0A&userId=1"

The Question:

Is there an alternate way to send a big server request?? I also read on google that we can change the size, to match huge requests?

Answers are preferred in java, HTML, javascript (or) jQuery

EDIT I read here that we can set the size limit of post request in header? How can i do it in GAE?

i have made a dynamic blog engine, where multiple authors can publish articles.

the author goes to a page where he inputs the 'article' 'description' and 'the whole article' in three <textarea> Then i store all the values in 3 variables and store it in the database via an ajax based request.

The Problem: The HttpServerRequest is too large and it gives a 413 FULL Head error, and the request doesnt get through.

The Code:

The HTML:

<div class="container">
        <h4 class="text-left">Title:</h4>
        <textarea id="title" rows="2" cols="" ></textarea>
        <br />
        <h4 class="text-left">Description:</h4>
        <textarea id="description" rows="5" cols="" ></textarea>
        <br />
        <h4 class="text-left">Article:</h4>
        <textarea id="article" rows="40" cols="" onkeyup="replaceWordChars(this.value)"></textarea>
        <br />

        <div class="publish btn">Publish</div>
        <br />
        <br />
    </div>

The Script:

<script>
    $(function(){
        $('.publish').click(function(){
            title = $('#title').val();
            description = $('#description').val();
            article = $('#article').val();

            $.ajax({
                type:       "get",
                url:        "/articles",
                data:       {action:'add', title:title, description:description, article:article},
                success:    function(code)
                {
                            alert("published"); 
                            window.location="dashboard.jsp";
                }

            }).error(function(){ alert("error"); })
            .plete(function(){ alert("plete"); });

        });

    });
    </script>

The ERROR:

"NetworkError: 413 FULL head - http:///articles?action=add&title=blah&..........gs.%0A%0A&userId=1"

The Question:

Is there an alternate way to send a big server request?? I also read on google that we can change the size, to match huge requests?

Answers are preferred in java, HTML, javascript (or) jQuery

EDIT I read here that we can set the size limit of post request in header? How can i do it in GAE?

Share Improve this question edited May 23, 2017 at 11:50 CommunityBot 11 silver badge asked Oct 12, 2013 at 12:07 leoleo 1,5653 gold badges14 silver badges23 bronze badges 2
  • @user2511414 No, that's overkill for a single request. GAE doesn't even support websockets, anyway. – nanofarad Commented Oct 12, 2013 at 12:16
  • I haven't seen sending big data with get method! maybe you need to post data as POST method. – user2511414 Commented Oct 12, 2013 at 12:26
Add a ment  | 

2 Answers 2

Reset to default 6

Don't use HEAD or GET for large parameters. Those should only be used for idempotent requests(repeating it doesn't break anything), and requests that only retrieve data(i.e. searching or filtering a product database) anyway.

Use a POST request instead:

<script>
    $(function(){
        $('.publish').click(function(){
            title = $('#title').val();
            description = $('#description').val();
            article = $('#article').val();

            $.ajax({
                type:       "post",
                url:        "/articles",
                data:       {action:'add', title:title, description:description, article:article},
                // .... skipped unchanged lines
    </script>

This is a one-line change.

On the server, make sure you use doPost() instead of doGet() in the servlet. You can get parameters in a similar fashion.

In my case HEADER was full because cookie value was too large for SESSIONID. I deleted all cookie for that site and it worked.

本文标签: java413 Full HEAD errorStack Overflow