Hi,
I have developed a Tapestry application. Inside of that application I have a method that process the login. I would to access/call this method from another non-tapestry application. I've tried to access the method via ajax, exactly the way I would access from inside of the tapestry application. The issue is, tapestry does not recognize the request as ajax. Any idea how to solve this? Thanks a lot for your help. |
Hi,
Tapestry recognises AJAX requests on server side by inspecting the "X-Requested-With" header. It must have the "XMLHttpRequest" value. See https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java#L170 The header is automatically added by jQuery or Prototype.js used by Tapestry's client side codes, so if you are not using jQuery, you need to add this header yourself. See: https://github.com/jquery/jquery/blob/master/src/ajax/xhr.js#L53 Best regards, Cezary On Wed, Sep 4, 2019 at 9:28 PM Rbsn Lbk <[hidden email]> wrote: > Hi, > > I have developed a Tapestry application. Inside of that application I have > a method that process the login. I would to access/call this method from > another non-tapestry application. > > I've tried to access the method via ajax, exactly the way I would access > from inside of the tapestry application. The issue is, tapestry does not > recognize the request as ajax. Any idea how to solve this? > > Thanks a lot for your help. > |
In reply to this post by mr nobody
Hi,
is Your method exposed as event? Or You have a CORS exception? What is the error on client side? Regards Eugen Rbsn Lbk <[hidden email]> schrieb am Mi., 4. Sep. 2019, 21:28: > Hi, > > I have developed a Tapestry application. Inside of that application I have > a method that process the login. I would to access/call this method from > another non-tapestry application. > > I've tried to access the method via ajax, exactly the way I would access > from inside of the tapestry application. The issue is, tapestry does not > recognize the request as ajax. Any idea how to solve this? > > Thanks a lot for your help. > |
In reply to this post by Cezary Biernacki
Amazing! That was exactly what I was looking for. Thank you so much!!
On Wed, 4 Sep 2019 at 22:25, Cezary Biernacki <[hidden email]> wrote: > Hi, > Tapestry recognises AJAX requests on server side by inspecting the > "X-Requested-With" header. It must have the "XMLHttpRequest" value. > > See > > https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java#L170 > > The header is automatically added by jQuery or Prototype.js used by > Tapestry's client side codes, so if you are not using jQuery, > you need to add this header yourself. > See: https://github.com/jquery/jquery/blob/master/src/ajax/xhr.js#L53 > > Best regards, > Cezary > > > On Wed, Sep 4, 2019 at 9:28 PM Rbsn Lbk <[hidden email]> wrote: > > > Hi, > > > > I have developed a Tapestry application. Inside of that application I > have > > a method that process the login. I would to access/call this method from > > another non-tapestry application. > > > > I've tried to access the method via ajax, exactly the way I would access > > from inside of the tapestry application. The issue is, tapestry does not > > recognize the request as ajax. Any idea how to solve this? > > > > Thanks a lot for your help. > > > -- Robson Pires M.Sc. Information Technology Web Developer Phone +49 171 5873669 |
In reply to this post by mr nobody
Another approach is to export the logic of the login process to a separate service and have both client applications call it.
John Sent from my iPhone > On 5 Sep 2019, at 02:27, Rbsn Lbk <[hidden email]> wrote: > > Hi, > > I have developed a Tapestry application. Inside of that application I have > a method that process the login. I would to access/call this method from > another non-tapestry application. > > I've tried to access the method via ajax, exactly the way I would access > from inside of the tapestry application. The issue is, tapestry does not > recognize the request as ajax. Any idea how to solve this? > > Thanks a lot for your help. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Free forum by Nabble | Edit this page |