tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: unified doXXX()
Date Thu, 04 Mar 2010 16:29:08 GMT
Hash: SHA1


On 3/2/2010 7:12 PM, Aryeh M. Friedman wrote:
> Christopher Schultz wrote:
>> If that string above is your entire POST request body, then it's not
>> properly formatted. Instead, it should be:
>> call=8347812459870132405987234985023450987
>> or whatever. The parameter has to have a name :)
> Design decision for two reasons:

Just so you know, your design decision means that POST will /never/ work
using request.getParameter.

> 1. If we are already decoding the request from hex to plain text
> mightiest  use getReader()
> 2. Our app needs to support several frontends (not just the web via a
> servlet)

I don't believe either of these issues should present a problem. I would
think you could do the following as a POST request body:


...and then just do request.getParameter("call") whether it's GET or POST.

> Just for reference here is the refactored servlet with any trade secret
> code removed (all the tomcat<-->servlet logic is kept)


>                try {
>                        call=StringUtil.hexToString(
>                            readRequest(request)).substring(5);
>                } catch(IOException e) {
>                        write out error in custom format
>                }

Good luck with that code.

>        private String readRequest(HttpServletRequest request)
>                throws IOException
>        {
>                if(request.getMethod().equals("GET"))
>                        return request.getQueryString();

Oh, so you were using the whole query string and not just the value of
one parameter? Wow, you've really changed-up the whole thing, eh?

>                String out="";
>                Reader reader=request.getReader();
>                // reading all the content in one read causes problems
> sometimes so we read it char by char

This comment is an indication of something wrong. :(

>                for(int i=0;i<request.getContentLength();i++)
>                        out+=(char);


>        private static final long serialVersionUID=0L;

This class isn't serializable. It's odd to set a serialVersionUID for a
class that isn't serializable. Also, it's weird to set its value to
zero. <shrug>

Hey, if what you've got here works, then who am I to interfere?

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message