GIGJ.COM
welcome to my space
X
Welcome to:gigj.com
Search:  
Personal Injury | Languages | Soups | Photography | Email | Prepress | Exotic Locations | Computer Games | Related articles
 HOME   [Solved][2.0]Not able to get ScriptTagProxy to work...
[Solved][2.0]Not able to get ScriptTagProxy to work...
Published by: smith 2009-01-07

  • Maybe I'm doing something a little crazy here, but I'm trying to write a winform .NET app with a simple HTTP listener to handle Ext data requests. When my app serves the page and the data and I'm using an HttpProxy like so:
    proxy: new Ext.data.HttpProxy({
    url: 'getFeed?category=0'
    }),
    The data comes back and is displayed in the grid, no problems. But I'd rather have the page content be served as local files to the browser and only process the data requests with my HTTP listener, but when I use:
    proxy: new Ext.data.ScriptTagProxy({
    url: 'http://localhost:1966/getFeed?category=0'
    }),
    It seems to just timeout without displaying any data or errors. FireBug does show the data coming back to the browser. Here is my C# listener code (note I am checking for the callback to properly set the context and include the parens):
    protected override void ProcessRequest(System.Net.HttpListenerContext Context)
    {
    HttpListenerRequest Request = Context.Request;
    HttpListenerResponse Response = Context.Response;

    try {
    byte msg;

    if (Request.RawUrl.StartsWith("/getFeed")) {
    bool scriptTag = (Request.QueryString.GetValues("callback") != null);
    Response.ContentType = (scriptTag) ? "text/javascript" : "application/x-json";
    string s;
    if (scriptTag)
    s = "({"itemCount":4,"items":[{"itemId":"1","title":"Top 10 Startups Worth Watching in 2008","author":"","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455458/YE_10_startups","description":"Which startups are worth paying attention to in the coming year? We pick 10 companies that should be making significant strides in 2008.","date":"12/24 5:00"},{"itemId":"2","title":"Live Music Webcasting Starts Making Sense in 2008","author":"Eliot Van Buskirk","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455459/listeningpost_1224","description":"After a disappointing start, live online music is poised for success. With new technology and Web 2.0 networks in place to fuel the boom, record labels become the last remaining sticking point between you and some rockin' web shows. Commentary by Eliot Van Buskirk.","date":"12/24 5:00"},{"itemId":"3","title":"Home Sweet Gadget: How Our Technolust Helped Bring Down the Housing Market","author":"","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455460/st_essay","description":"Builders responded to new demands for houses built to accommodate their owner's technolust. They built lots of homes and packed them with every new gewgaw a potential buyer might dream of. And then they built some more. Now, thanks to the housing bust, virgin homes and condos sit unoccupied in cities like Las Vegas, Phoenix, Miami, and, yes, Orlando.","date":"12/24 5:00"},{"itemId":"4","title":"
    extsharp - Google Code::
    Added DataView sample (incomplete - plugins have not been implemented) add a bit a script into the ScriptSharpAdapter.init() method to get this to work
    http://code.google.com/p/extsharp/source/browse/trunk/CHANGELOG.txt
    HOME
    Be Kind Rewind
    Director Michel Gondry Forgoes Dreamy Plots for Straight-Up Comedy","author":"Michel Gondry","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455461/ff_gondry","description":"Michel Gondry is famous for making films with backward plots and gauzy sequences. His new work, about two video-store clerks who remake famous movies, is a straight-up narrative with crowd-pleasing Jack Black pratfalls. But don't worry — Gondry's still messing with Hollywood.","date":"12/24 5:00"}]})";
    else
    Minimum code needed for Ext.data.ScriptTagProxy - Ext JS Forums::
    4 posts - Last post: Jan 12, 2008ScriptTagProxy class in my API? Some clients might not wish to ScriptTagProxy is designed to work with a Reader and a Store to read a
    http://yui-ext.com/forum/showthread.php?t=22880
    HOME
    [Solved] NS_ERROR_ILLEGAL_VALUE exception when using ::
    7 posts - Last post: Jan 23, 2008I was able to find a working solution however, albeit hackey. Store with a ScriptTagProxy and a JsonReader. It will work.
    http://extjs.com/forum/showthread.php?t=23074
    HOME
    s = "{"itemCount":4,"items":[{"itemId":"1","title":"Top 10 Startups Worth Watching in 2008","author":"","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455458/YE_10_startups","description":"Which startups are worth paying attention to in the coming year? We pick 10 companies that should be making significant strides in 2008.","date":"12/24 5:00"},{"itemId":"2","title":"Live Music Webcasting Starts Making Sense in 2008","author":"Eliot Van Buskirk","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455459/listeningpost_1224","description":"After a disappointing start, live online music is poised for success. With new technology and Web 2.0 networks in place to fuel the boom, record labels become the last remaining sticking point between you and some rockin' web shows. Commentary by Eliot Van Buskirk.","date":"12/24 5:00"},{"itemId":"3","title":"Home Sweet Gadget: How Our Technolust Helped Bring Down the Housing Market","author":"","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455460/st_essay","description":"Builders responded to new demands for houses built to accommodate their owner's technolust. They built lots of homes and packed them with every new gewgaw a potential buyer might dream of. And then they built some more. Now, thanks to the housing bust, virgin homes and condos sit unoccupied in cities like Las Vegas, Phoenix, Miami, and, yes, Orlando.","date":"12/24 5:00"},{"itemId":"4","title":"
    Autoload and Contentbody - Page 2 - Ext JS Forums::
    ScriptTagProxy({ url: 'form.jsp' }); /* var myReader = Ext.data. Get up to speed quickly with on-site training provided by Ext
    http://www.yui-ext.net/forum/showthread.php?p=224504
    HOME
    Be Kind Rewind
    Director Michel Gondry Forgoes Dreamy Plots for Straight-Up Comedy","author":"Michel Gondry","link":"http://feeds.wired.com/~r/wired/topheadlines/~3/205455461/ff_gondry","description":"Michel Gondry is famous for making films with backward plots and gauzy sequences. His new work, about two video-store clerks who remake famous movies, is a straight-up narrative with crowd-pleasing Jack Black pratfalls. But don't worry — Gondry's still messing with Hollywood.","date":"12/24 5:00"}]}";
    msg = Encoding.UTF8.GetBytes (s);
    } else {
    string path = _baseFolder + Request.RawUrl;
    //string path = Path.Combine (_baseFolder, filename);
    if (!File.Exists (path)) {
    Response.ContentType = "text/html";
    Response.StatusCode = (int) HttpStatusCode.NotFound;
    msg = Encoding.UTF8.GetBytes ("Sorry, that page does not exist");
    } else {
    Response.StatusCode = (int) HttpStatusCode.OK;
    msg = File.ReadAllBytes (path);
    }
    }
    Response.ContentLength64 = msg.Length;

    using (Stream stream = Response.OutputStream)
    stream.Write (msg, 0, msg.Length);

    Response.Close();
    } catch (Exception ex) { Console.WriteLine ("Request error: " + ex); }
    }
    }


  • When I was looking at the docs and modeled my code, I didn't faithfully translate the Java code and specifically I overlooked the "cb" highlighted below...

    boolean scriptTag = false;
    String cb = request.getParameter("callback");
    if (cb != null) {
    scriptTag = true;
    response.setContentType("text/javascript");
    } else {
    response.setContentType("application/x-json");
    }
    Writer out = response.getWriter();
    if (scriptTag) {
    out.write(cb + "(");
    }
    out.print(dataBlock.toJsonString());
    if (scriptTag) {
    out.write(");");
    }
    When I searched the forum based on your response I found another post (http://75.126.167.146/forum/showthread.php?p=25641#post25641) by Animal where it's more obvious:
    String callbackFn = request.getParameter("callback");
    if (callbackFn != null) {
    out.write(callbackFn + "(");
    }
    out.write(myJsonData); // or call a method to output the Json data...
    if (callbackFn != null) {
    out.write(");");
    }
    I'm sure that's what my problem is and I'll confirm as soon as I get home. Thanks!


  • Thanks for your reply Jeff. I did not see any errors (none are shown by FireBug). I didn't tried using the loadexception handler yet. I'm new to JSON and Ext. Can you explain what you mean by: "When using a scripttagproxy, is it returned with the JSON data wrapped with the callback function?"? I see the response and it looks just like what is hard coded (for now) in my HttpListener code above. When I call the listener using the ScriptTagProxy, the JSON data is wrapped with parens. Should I see a function reference in the repsonse data too?


  • What does your response look like? When using a scripttagproxy, is it returned with the JSON data wrapped with the callback function? Are you getting any errors?





  • Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks

  • found problem in house after purchase
  • residential christmas decorating
  • housesitter or caretaker in pasadena
  • installation of boat washing stations to combat invasive aquatic plants
  • {furniture } computer desk adjacent to couch yet will swivel for keyboard monitr
  • cmyk to wall paint and pantone codes
  • flatware made by couture
  • pdf reference xobject
  • university of michigan biotechnology workers
  • faux persian lamb
  • bathroom shower tile painting
  • bay area microclimates
  • shopping cart for grocery shopping
  • quote about all discoveries being made by outsiders and radicals
  •  
  • clicking radiator driving us bonkers
  • synergistic aerial spray herbicide effects
  • reupholstery school
  • internet access in cancun mexico
  • putting furniture together
  • local telephone charges
  • finding discontinued tile from the company florida tile
  • running track gym rubber spray on floor in residential construction
  • silver dvd
  • window spring balances
  • plastering courses
  • plumbing supplies
  • wholesale resource for st james factory made cabinets
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about [Solved][2.0]Not able to get ScriptTagProxy to work... , Please add it free.

    About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 gigj.com All Rights Reserved
    Site made&Support support@gigj.com    E-mail: web@gigj.com