If you want to make ajax requests from your own javascript, you can do
the following:

In MyPage.java put the following method (handler):

public StreamResponse onMyMethod() {

   // Construct your xml string
   String xml = ....

   return new TextStreamResponse("text/xml", xml);

}

Then in your javascript you can call this by making an ajax GET request
to:

GET /mypage:mymethod

You can pass in parameters as a context:

GET /mypage:mymethod/100

and change your handler to:

public StreamResponse onMyMethod(int arg) { ... }


You can also POST data as well, or pass args in the url query string in
a GET. You can access these parameters via Tapestry's request obj:

GET /mypage:mymethod?param=arg


@Inject
private Request request;

public StreamResponse onMyMethod() { 

  String arg = request.getParameter("param");

  ....

}

 
Hope that helps,

Richard








On Fri, 2011-04-01 at 21:53 -0700, coriolisguy wrote:
> Hi All,
> 
> I have an ajax request that needs to return a text/xml payload. I need to
> dynamically make the URL string in the browser to send to the server. What
> should the format of that URL be?
> 
> Thanks
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/XHR-request-to-return-a-test-xml-payload-tp4277254p4277254.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



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

Reply via email to