Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6893543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:40:18+00:00 2026-05-27T06:40:18+00:00

Handler Implementation class TestHandler(RequestHandler, Jinja2Mixin): def get(self): channel_id = str(random.randint(1, 10000)) + str(datetime.now()) chat_token

  • 0

Handler Implementation

class TestHandler(RequestHandler, Jinja2Mixin):
 def get(self):
    channel_id = str(random.randint(1, 10000)) + str(datetime.now())
    chat_token = channel.create_channel(channel_id)
    context = {'channel_id': channel_id, 'chat_token': chat_token}
    return self.render_response('test.html', **context)

 def post(self):
    channel_id = str(random.randint(1, 10000)) + str(datetime.now())
    chat_token = channel.create_channel(channel_id)
    context = {'channel_id': channel_id, 'chat_token': chat_token}
    return self.render_response('test.html', **context)

HTML Implementation

<html>
 <head>
 <script type="text/javascript" language="javascript" src="/static/js/jquery-1.6.1.min.js"></script>
 <script type="text/javascript" language="javascript" src="/static/js/backend.js"></script>
 </head>
<body>
    <form method="post" id="testform" name="testform">
        <br><label name="channel_id" id="channel_id">{{channel_id}}</label>
        <br><label name="chat_token" id="channel_id">{{chat_token}}</label>
        <input type="submit" id="btnsubmit" class="btnsubmit" name="btnsubmit" value="submit" />
    </form>
</body>
</html>

jQuery implementation

 $(document).ready(function () {

    var token =$('#channel_id').val()
    alert(token)

    var channel = new goog.appengine.Channel(token);
    var socket = channel.open();
    socket.onopen = onOpened;

    onOpened = function() {
        connected = true;
        var xhr = new XMLHttpRequest();
        xhr.open('POST','/dashboard/', true);
        xhr.send();
    };

    socket.onmessage = onMessage;
    socket.onerror = onError;
    socket.onclose = onClose;
 });

I want to call a Back end handler. I do not know how to do it. This is what i have done . Can anyone give a help ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:40:19+00:00Added an answer on May 27, 2026 at 6:40 am

    You access a back end with a url like http://instance.backend.appid.appspot.com (see the docs). Since you can’t make an XHR to a page like this from an page rendered on http://appid.appspot.com, you have basically two options:

    You can marshal the request to your backend via a servlet on your frontend. So you could do something like:

    class MarshalServlet(RequestHandler):
      """ This class is part of your frontend. """
      def post(self, instance, backend):
        # generate an urlfetch request to http[s]?://instance.backend.appid.appspot.com
        # and return its result.
        # (left as an exercise for the reader)
    
    # add a "dashboard" handler to your frontend application.
    app = webapp.WSGIApplication([('/dashboard/', MarshalServlet),
                                   # other servlets etc.
                                 ], debug=True)
    

    Or you could use JSONP to do a cross-domain request, which is easy with jQuery’s getJSON method:

    $.getJSON("http://instance.backend.appid.appspot.com/dashboard/", function() {
      alert("success");
    });
    

    It’s not clear to me what your /dashboard/ handler does, so I’m not sure if it can/should return JSON or if you care about the headers and so on.

    Also note that using the getJSON method won’t send along cookies, but you could do that with a marshaling servlet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so I have a handler below: class PublishHandler(BaseHandler): def post(self): message = self.get_argument(message) some_function(message)
I have an implementation building a delegate handler collection. public class DelegateHandler { internal
For class specific new_handler implementation, i came across the following example in book effective
I have an implementation of default handler. When it gets to a   in
I have some event handler on a boundary class that manages a persistence mechanism
I'm using a wrapper class to represent a network connection. My implementation contains a
How does the new Microsoft asp.net mvc implementation handle partitioning your application - for
Cancellation Handler works good for Composite activities like CAG, Parallel activity. I need to
How can I Handler 404 errors without the framework throwing an Exception 500 error
I set up 404 handler page in web.config, but it works ONLY when extension

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.