Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_wap thread: Re: Maximum WAP URL Length of 128 Characters?


Message #1 by "Jing Cheng" <jing@h...> on Mon, 10 Dec 2001 20:43:04
Hi Andy,

I have a similar problem and hope that you can help me. I'm trying to 
pass the value of a variable "sid" in a java servlet to a postfield in 
wml, and then get this value in another servlet. I do like this: 

String sid = Session.getid();
out.println("name : <input name=\"userid\" type=\"text\"/>");
...
out.println("<do .....>");
out.println("<go href=\"http://...:9000/logout\" method=\"post\">");
out.println("<postfield name=\"id\" value=\"$(sid)\">"); 
********* have also tried with value="<%=sid %>"/>

out.println("<postfield name=\"user" value=\"$(userid)\">"); 
out.println("</go>");
out.println("</do>");
...

When I try to get this id in the logout servlet, 

String sid = request.getParameter("id");
String uid = rquest.getParameter("user);

sid is null :-(, but uid is ok!

I'm very thankful if you can answer my question.

Jing


> Hi Sasha
> 
> I've been fighting with this problem for about a year now and there are 
a 
> few tricks that you can do to keep the URL lengh to a minimum. (Oh, and 
> your right about this problem not being very well documented; on the 
side 
> if device diversity is an issue for you then you might find the info 
> provided by Argo Group helpful - http://devzone.argogroup.com).
> 
> The best way I have found to solve this is to avoid using URL rewriting 
in 
> the first place (but still pass the session id!) - you should be able 
to 
> tweak you app server from doing this automatically. Using the HTTP POST 
> method allows you to pass the session id in a WML <postfield/> tag.
> 
> For example (taken from an iPlanet 6 app server solution)
> 
> <%
>   HttpSession userSession = request.getSession(false);
>   String mainSessionID = userSession.getId(); 
>   // App server session variable (this is iPlanet's)
>   String iPlanetSessonVar = "GXHC_gx_session_id_";
>   String target = "MyServlet";
> %>
> <anchor>Click Me
>   <go href="<%=target %>" method="POST">
>     <postfield name="<%=iPlanetSessonVar %>" value="<%=mainSessionID 
%>"/>
>   </go>
> </anchor>
> 
> So the session id is encoded over HTTP and not in the URL.
> 
> According to the pro WAP book some phones do not support HTTP POST, but 
I 
> have not come accross any yet (in the UK). So you should check if your 
> target devices do suport POST...
> 
> Some app servers can also be configured to encode smaller session ID's.
> 
> Btw, by using HTTP POST as above you can also then pass all request 
> parameters using the WML <postfield/> tag, therefore reducing URL 
lengths 
> even more 
> :-)
> 
> Good luck, let me know how you get on...
> Andy
> 

  Return to Index