I just committed the fix. Box[String => String] is calling URLRewriter which holds the function that does URL manipulation. This is set in HTTP Provider. It does 2 things:
- calls encodeURL - calls URLDecorator URLDecorator is important in case one wants to add something to all URL's. For instance in case of sticky sessions, load balancers need to know where to balance a request and this is done by various policies: - JSESSIONID affinity - URI based balancing (here URLDecorator makes a lot of sense as load balancers can determine where to balance requests based on a query string parameter) Other notes about your comments" "When a client (browser) connects, the servlet container doesn't know if cookies are enabled. It sets a session cookie on the response, and also rewrites path URLs to include ;jsessionid=yourSessionId. " - Server does not rewrite URLs if container's cookies are turned ON. This decision is done by the container and not Lift. So you either have JSESSIONID as a cookie or as part of the URL aka URL rewriting. Br's, Marius On Sep 19, 12:09 am, Grant Wood <smackt...@gmail.com> wrote: > Atsuhiko's experience makes sense if you look in Req. > > _fixHref is where the rewriting is actually happening: > --------------- Req ... > private def _fixHref(contextPath: String, v : Seq[Node], fixURL: > Boolean, rewrite: Box[String => String]): Text = { > val hv = v.text > val updated = if (hv.startsWith("/")) contextPath + hv else hv > > Text(if (fixURL && rewrite.isDefined && > !updated.startsWith("mailto:") && > !updated.startsWith("javascript:") && > !updated.startsWith("http://") && > !updated.startsWith("https://")) > rewrite.open_!.apply(updated) else updated) > } > ... Req --------------- > > Lift is skipping the rewrite if the attribute startsWith > ("javascript:") but if it starts with # it will be rewritten. > This would be an easy fix: !updated.startsWith("#") && > I suspect this change would meet most developers behavior > expectations. > > If a client is not using cookies and requires :jsessionid=theSessionId > to be appended, this test will also fail to properly rewrite fully > qualified URLs with the http or https protocol that have the same > hostname (S.hostName) as the authority section. Someone with a better > handle on the Servlet and Servlet Container spec will have to chime in > and determine whether there are rules governing this situation. > > Does anybody know if rewrite: Box[String => String] being used by > anything other than the jsessionid rewrite? > > - Grant > > On Sep 18, 9:46 pm, "marius d." <marius.dan...@gmail.com> wrote: > > > LIft doesn't explicitly add jsessionid to the URL but it calls > > encodeUrl on the HttpServletResponse. If in the container you have the > > cookies turned off URL rewrite comes into picture. This is because we > > need lift apps to still work when cookies are turned off from > > container. This is the correct behavior. > > > Your specific example sounds like a bug and I'll try to fix it > > tomorrow. > > > Br's, > > Marius > > > On Sep 18, 7:04 pm, Atsuhiko Yamanaka <atsuhiko.yaman...@gmail.com> > > wrote: > > > > Hi, > > > > On Sat, Sep 19, 2009 at 4:43 AM, David Pollak > > > > <feeder.of.the.be...@gmail.com> wrote: > > > > > Is this causing a problem? If it is, you can disable it... I forgot > > > > how, > > > > but I can dig through the code to find out the appropriate LiftRules to > > > > change. > > > > I had troubles. > > > For example, > > > <a href="#" onlick="...">click</a> > > > was suddenly transformed to > > > <a href=";jsessionid=knq01t90ajh7#" onlick="...">click</a> > > > and the page reload was happened unexpectedly. > > > > Now, I have rewritten those anchor tags as > > > <a href="javascript:void(0)" onclick="...">click</a> > > > and such troubles have disappeared. So, it is not a problem for me > > > anymore. > > > This is just FYI. > > > > Sincerely, > > > -- > > > Atsuhiko Yamanaka > > > JCraft,Inc. > > > 1-14-20 HONCHO AOBA-KU, > > > SENDAI, MIYAGI 980-0014 Japan. > > > Tel +81-22-723-2150 > > > +1-415-578-3454 > > > Skype callto://jcraft/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---