[Bug 682] New: Provide a method for reading the content of an HTTP request for any content type

View: New views
7 Messages — Rating Filter:   Alert me  

[Bug 682] New: Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682

           Summary: Provide a method for reading the content of an HTTP
                    request for any content type
           Product: Helma
           Version: CVS trunk
          Platform: Other
               URL: https://dev.helma.org/trac/helma/browser/helma/helma/t
                    runk/src/helma/servlet/AbstractServletClient.java#L685
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Web Support
        AssignedTo: helma-dev@...
        ReportedBy: interface@...


I just noticed that there is no easy way of reading the content of an HTTP
request from Helma’s req object when the content type is *not*
"application/x-www-form-urlencoded.

This is due to line 685 of AbstractServletClient.java (see URL).

With any other content type obviously the request content is not parsed or
stored in req.data.http_post_remainder.

I am not sure if content should go into http_post_remainder then; it sounds
awkward to me, especially in cases where the content is the only data besides
the headers.

Maybe a simple additional method could be provided, e.g. req.getContent()?

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682


Hannes Wallnoefer <hannes@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hannes@...




--- Comment #1 from Hannes Wallnoefer <hannes@...>  2009-09-24 09:17:06 ---
Yes, this is a missing feature. There should be at least methods or properties
to retrieve the request body as byte array and decoded to a string using the
proper encoding.

As a start, the following code based on Jakarta Commons IO should work:

var IOUtils = org.apache.commons.io.IOUtils;
var inputStream  = req.servletRequest.inputStream;
var encoding = req.servletRequest.characterEncoding || "UTF-8";
var body = IOUtils.toString(inputStream, encoding);

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682





--- Comment #2 from tobi <interface@...>  2009-09-24 09:54:42 ---
Hey, your code looks much slicker than what I use – which essentially is the
same as lines 714—721 in AbstractServlet.java, just using the BufferedReader:

   var reader = req.servletRequest.getReader();
   var line;
   res.push();
   while ((line = reader.readLine()) !== null) {
      res.writeln(line);
   }
   reader.close();
   var body = res.pop();

And as the code is already in AbstractServlet.java I wonder how hard it would
be to refactor it and implement the generic content retrieval...?

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682


tobi <interface@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |1.7.0




--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682


Hannes Wallnoefer <hannes@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #3 from Hannes Wallnoefer <hannes@...>  2009-11-17 11:16:59 ---
Closing as wontfix.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682





--- Comment #4 from tobi <interface@...>  2009-11-18 08:52:01 ---
Hannes, what is the reason for the WONTFIX?

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 682] Provide a method for reading the content of an HTTP request for any content type

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=682





--- Comment #5 from Hannes Wallnoefer <hannes@...>  2009-11-18 09:07:26 ---
(Mit Bezug zu comment #4)
> Hannes, what is the reason for the WONTFIX?

I don't have a lot of time, and there are simple workarounds (listed in the
comments above, with ~ 4 lines of code).

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev