You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@eng.sun.com on 2000/01/25 21:43:55 UTC

Re: tomcat/core/Request.java

What you are asking for is a change in specification. It would be a very
bad ideea to add this to tomcat - it will create incompatibilities, you
shouldn't use internal objects. 

( as soon as we move to JDK1.2 we will have a security manager that will
prevent servlets from accessing internal tomcat objects, so your methods
will be useless anyway ).

Costin


On Tue, 25 Jan 2000, Dan Janowski wrote:

> The request processing includes collection of cookies,
> get vars, and post vars. Unfortunately it does not maintain
> seperate the separate domains from which the values come.
> 
> This is a problem for POST because Request eats the
> stream thereby making it impossible to find out where
> a variable came from.
> 
> To be able to get a String[] for a paramter is one
> thing, to be able to specifically look for a post
> variable is not possible with the way Request does
> the processing.
> 
> Can I replace this code? Or at minimum, modify it so
> that the post variables can be gotten as a Hashtable
> that is not intermingled with GET data? Then add a
> Hashtable getPostData() method?
> 
> I wrote a class that collects paramters
> in a different way. It results in methods like:
> 
>     public VarSet[] getVarSet(String name) 
>     public int getVarCount(String name) 
>     public String getCookie(String name) 
>     public Cookie getCookieWhole(String name) 
>     public String getVarFirst(String name, String prio)
>     public String[] getVar(String name)  // calls getVar(name, "cgp")
>     public String[] getVar(String name, String prio)
> 
> 
> The last method with the arg 'prio' being a string with
> possible components of 'c', 'g', or 'p'. If you only will
> accept certain values by cookie then prio is 'c' only.
> If only post and get, then 'pg'. Additionally the
> prio allows for a priority or precendence to take place in
> how the possible variable instances come into the Request.
> Say there is a cookie and there needs to
> be a way to override the cookie with a get variable, this
> method allows easy scoping of this type.
> 
> The VarSet is another class used to maintain the origin of
> the paramter.
> 
> Thoughts?
> 
> Dan
> 
> --
> Dan Janowski     danj@3skel.com       Triskelion Systems, Inc.     Bronx, NY
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 


Re: tomcat/core/Request.java

Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
Dan Janowski wrote:

> Which part is in the specifcation? Automatically processing POST
> data or that all Parameters get lumped together?
>
> The importance of the separation between POST and GET data has
> been missed, ignored or under estimated.
>

See section 5.1 of the Servlet API specification for all the details.  The
highlights are like this:

* The data content associated with a of the request WILL be
  processed by the servlet container under the following conditions:

    - The request used the HTTP or HTTPS protocol
    - The request method is POST
    - The content type is "application/x-www-form-urlencoded"
      (the default unless you change it in your <form> element)
    - The servlet calls any of the getParameter() family methods

* When this takes place, the request parameters from the query
  string (if any) and the post data (if any) are merged, such that
  if a parameter value is specified in both places, the one(s) from
  the query string show up first in the array returned by the
  getParameterValues() method.

If you don't want the parameters merged, all you need to do is make sure that
at least one of the conditions listed above fails, and then process things
yourself.  The simplest one to change would probably be the content type --
then, getParameter() and friends will only get parameter values from the
request URI, and the data content of the request will be untouched.

If you do not like this behavior, then you need to lobby for a change in the
servlet API specification.  There is a "feedback" email address on the first
page of the spec, as well as public comment periods on drafts of new specs as
they are produced (the proposal for development of the next version of both
the servlet and JSP specs was just announced; see the Java Community Pages
section of the JavaSoft web site for how to be involved.)

Craig McClanahan



Re: tomcat/core/Request.java

Posted by Dan Janowski <da...@3skel.com>.
Which part is in the specifcation? Automatically processing POST
data or that all Parameters get lumped together?

The importance of the separation between POST and GET data has
been missed, ignored or under estimated.

HttpServletRequest.java should have six additional methods:

public String getGetParameter(String name);
public String[] getGetParameterValues(String name);

public String getPostParameter(String name);
public String[] getPostParameterValues(String name);

public Enumeration getGetParameterNames();
public Enumeration getPostParameterNames();


To whom do I need to plead my case?

Dan

--
Dan Janowski
danj@3skel.com
Triskelion Systems, Inc.
Bronx, NY


On Tue, 25 Jan 2000 costin@eng.sun.com wrote:

> What you are asking for is a change in specification. It would be a very
> bad ideea to add this to tomcat - it will create incompatibilities, you
> shouldn't use internal objects. 
> 
> ( as soon as we move to JDK1.2 we will have a security manager that will
> prevent servlets from accessing internal tomcat objects, so your methods
> will be useless anyway ).
> 
> Costin
> 
> 
> On Tue, 25 Jan 2000, Dan Janowski wrote:
> 
> > The request processing includes collection of cookies,
> > get vars, and post vars. Unfortunately it does not maintain
> > seperate the separate domains from which the values come.
> >