logo       

Re: POST request loosing data with incomplete URL: msg#00116

java.enhydra.general

Subject: Re: POST request loosing data with incomplete URL

Petr,

Not sure I fully understand what you're trying to do, but I use POST
operation in my application just fine. Here's a snippet of PO code I use to
handle getting the parameters when using POST operations:

HashMap parameters = new HashMap();

public void run(HttpPresentationComms comms) throws Exception {

Enumeration myparms = comms.request.getParameterNames();
while (myparms.hasMoreElements()) {
String pname = (String) myparms.nextElement();
String[] pval = comms.request.getParameterValues(pname);
try {
parameters.put(pname,(String[])pval);
} catch (Exception e) {
msg("failed with exception: "+e);
}
}
<snip>

Then I get the individual parameters using either getParm(key) or
getParms(key) (depending on whether I expect more than one value). Here are
these methods:

protected String getParam(String key) {
String[] items = (String[])parameters.get(key);
if(items == null) {
return null;
}
return items[0];
}

protected String[] getParams(String key) {
return (String[])parameters.get(key);
}

With regards to ServerPageRedirectException, I use them fairly extensively.
The only 'tricks' that I've found are (a) you can't change the Request, and
(b) you must usually pass the a modified path (set to, as I recall, the
value of your application root).

HTH,

Terry


----- Original Message -----
From: "Petr Stehlik" <pstehlik@xxxxxxxxxx>
To: <enhydra@xxxxxxxxxxx>
Sent: Tuesday, October 29, 2002 10:36 AM
Subject: Enhydra: POST request loosing data with incomplete URL


> Hi,
>
> after many hours of debugging my application internals I have found out
> that a <FORM METHOD="POST" ACTION="www.domain.com/path/"> does NOT work.
> It simply loses all its data when the real URL is being resolved and the
> complete filepath is constructed (www.domain.com/path/index.po).
>
> I tried Mozilla, Galeon and Opera browsers. Same problem.
>
> <FORM METHOD="GET"> works properly (parameters in the URL are
> preserved).
>
> The problem probably lies in the
> StandardApplication.requestPreprocessor() that does the remaping from
> incomplete "path/" to "path/DefaultUrl.po" by calling
> ClientPageRedirectException(completeUrl).
>
> Questions: 1) am I right? and 2) could this be fixed by using
> ServerPageRedirectException()? It never worked for me...
>
> Petr
>
>
> _______________________________________________
> Enhydra mailing list
> Enhydra@xxxxxxxxxxx
> http://www.enhydra.org/mailman/listinfo.cgi/enhydra
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise