Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post request with multi parameters not getting fully parsed?

Status
Not open for further replies.

mouse619

Programmer
Nov 9, 2004
6
US
I was using Tomcat 4.1.29 and currently upgraded to Tomcat
5.028. I was sending parameters with a post request as
follows:

page.do?action=A&Var2=B&Var3=C

I have the appropriate sets and gets in the page form bean.
This was working fine in T 4 but in T 5 only the action
parameter gets passed in and the sets for Var2 and Var3 never
get called upon and therefor the values never get set?!?

I found in the Changelog of Tomcat 5 the following note:
"Add a limit to the size of a POST which will be processed
using getParameter (remm) " but not sure what exactly this
means or if it relates.

Any help would be greatly appreciated!
Thanks in Advance
 
By definition

page.do?action=A&Var2=B&Var3=C

is a GET , not a POST.

Sounds like tomcat is randomly picking which one it parses now since by spec it should not parse the QUERY_STRING if the method type is POST.

You can still access this as the request.getQueryString() call
 
I'm sorry, I meant GET not POST (It's been a long day). The method is GET and this was working fine in Tomcat 4 but not in T5. In T5 only the first variable in the QUERY_STRING gets set.

I was hoping this was a setting limiting the number of parameters in the QUERY_STRING but i have had no luck in finding such.

Thanks again.
 
There is no 'parameter' limit but most browsers max out at about 2000 characters or so, it varies version to version.

My bet is that your string has non-urlencoded characters in it like spaces etc. That will stop the parsing process.

Can you show us an exact URL you are using?

 

- I'm testing with IE 6 and my QUERY_STRING is not longer than 100 characters:

/Webpages/SWForm_SWHistory.do?action=ORDERBY&order_by=SWIp&order_col=2&order_dir=DSC

- I'm using the GET method:

<form name="SWForm_SWHistory" method="get" action="/Webpages/SWForm_SWHistory.do">

- In my form bean i have the following sets

public void setAction(String str)
public void setOrder_by(String str)
public void setOrder_col(int i)
public void setOrder_dir(String str)

and once again it was working fine in T4 but no luck in T5
(I ran the same code again with T4 and everything gets set)?

thanks again for all your help.
 
Very strange and I honestly am not sure what is going on. I still run on TC4 so I'll be interested in the answer as well for a planned migration to TC5

Sorry I couldnt help more, hopefully someone jumps in here :(
 

well, I did some further investigating, and found that J2 SDK Version 1.4.2.06 was also installed and upgraded from JDK 1.3.1.01 on the server at the time T5 was upgraded from T4.

So I re-installed JDK 1.3 with T5 and the problem was solved. I tested a few time to make sure (swithching back and forth between the versions) but apparently it seems to be an issue with the 1.4 version.

I'm sorry I didn't mention this before but I did not know it at the time.

But i'm still lost at why 1.4 is causing this issue.
 

Apperantly this was an issue in my form bean because I did not follow the JavaBeans standard...

class Foo {
public String getAlpha() {...}

public String getBeta() {...}
public void setBeta(int betaval) {...}
}

My datatype used to "set" the
property was different from the datatype used to "get" the property.

With logging enabled I found "Skipping Read Only".

This message comes from the BeanUtils object and apperantly older versions were not as strict on the JavaBeans standard.

Changing my datatype to match resolved the issue.

Thanks again for your help, and I hope this was atleast somewhat interesting!

btw, digging into STRUTS I also found that the GET and POST methods are handled in the same way:

ActionServlet.java


public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

process(request, response);

}


public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

process(request, response);

}


protected void process(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {

ModuleUtils.getInstance().selectModule(request, getServletContext());
ModuleConfig config = getModuleConfig(request);

RequestProcessor processor = getProcessorForModule(config);
if (processor == null) {
processor = getRequestProcessor(config);
}
processor.process(request, response);

}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top