GithubHelp home page GithubHelp logo

Comments (6)

per-samuelsson avatar per-samuelsson commented on August 15, 2024

From Chrome:

GET /foo

Request comes with no headers and text/html as PreferredMimeType, arriving at AppsBootstrapper.ProcessExternalRequest (invoked from gateway).

from misc.

per-samuelsson avatar per-samuelsson commented on August 15, 2024

First, any request filters are given a chance on the request. No such filters installed.

from misc.

per-samuelsson avatar per-samuelsson commented on August 15, 2024

With no request filters taking action, the server now give control to the handler, with a call to AppRestServer.RunDelegateAndProcessResponse, that in turn invoke UserHandlerInfo.RunUserDelegate.

In that method, with our setup, we don't have proxy delegate and neither any substitute handler, so finally the call enters our custom, user defined handler that return our Json. When doing so, the implicit cast from Json to Response take place, and by that, the Response produced is referencing our Json as an IResource.

Since StarcounterEnvironment.MergeJsonSiblings is set, the installed Response.ResponsesMergerRoutine_ is now invoked, in our case referencing UriMapping.DefaultJsonMerger. That method doesn't perform any merge, since in our case, we have a single JSON response. It assign the object the app name and sets internal _wrapInAppName to true (not sure what that does).

from misc.

per-samuelsson avatar per-samuelsson commented on August 15, 2024

Control is now back in AppRestServer.RunDelegateAndProcessResponse after the above detour. We have a Response instance that reference our Json instance, and the server now issue SendResponse on our request object.

from misc.

per-samuelsson avatar per-samuelsson commented on August 15, 2024

The server now runs any response filters, but in our case, none is registered.

After some global state is transferred to the response object, Response.ConstructFromFields is invoked.

from misc.

per-samuelsson avatar per-samuelsson commented on August 15, 2024

Response.ConstructFromFields

Builds up the byte[] that are to be sent back to the agent. The array is composed by inspecting the heap data (instance variables) of the current response object.

In our case, the response object reference an IResource instance (our JSON). The response is hence created by asking that instance to return itself as a representation that match the agents preferred MIME type (text/html).

from misc.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.