Just tried that - AJAX works for me as well.

Here's what I did:
1. Create app with archetype

2. Add form with <input t:type="TextField" t:id="text" type="text" t:mixins="autocomplete" />

3. In AppModule create a handler class
class AppModule
{
...
private static class ChangeContextPathnHttpServletRequestWrapper extends HttpServletRequestWrapper
    {
        private final String contextPath;

public ChangeContextPathnHttpServletRequestWrapper(HttpServletRequest request, String contextPath)
        {
            super(request);
            this.contextPath = contextPath;
        }

        @Override
        public String getContextPath()
        {
            return contextPath;
        }
    }
}

4. in AppModule contribute my handler:
class AppModule
{
...
public void contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> configuration)
    {
configuration.add("ManipulateContextPath", new HttpServletRequestFilter()
        {
public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler)

                                                        throws IOException
            {
return handler.service(new ChangeContextPathnHttpServletRequestWrapper(request, ""), response);
            }
        });
    }
}

5. Run app with context path (e.g. "/demo")

Request http://localhost:8080/demo/

==> AJAX paths are rewritten:

Tapestry.init({
  "activate" : [
    "text"
  ],
  "autocompleter" : [
    {
      "elementId" : "text",
      "config" : {
        "indicator" : "text:loader",
        "paramName" : "t:input"
      },
      "menuId" : "text:menu",
      "url" : "/index.text:autocomplete"
    }
  ]
});

--
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to