Created
July 12, 2013 19:56
-
-
Save Ikke/5987283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Module fasctgi | |
| class Fastcgi | |
| { | |
| } | |
| class FastcgiRequestFactory implements RequestFactory | |
| { | |
| public method getRequest() | |
| { | |
| //create an http.request object with the correct data | |
| return new http.request() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Module HTTP | |
| class Request | |
| { | |
| //Basic request API | |
| } | |
| class Response | |
| { | |
| //Basic response API | |
| } | |
| public class HTTP | |
| { | |
| public method executeRequest() | |
| { | |
| //Make a request | |
| return new Response() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Module Web | |
| class Web | |
| { | |
| protected property requestFactories = hash[]; | |
| public method ctor() | |
| { | |
| // This is an example, can also be another way to create a request for the correct SAPI | |
| requestFactories.push(fastcgi.FastcgiRequestFactory); | |
| requestFactories.push(cgi.CgiRequestFactory); | |
| requestFactories.push(wsgi.WsgiRequestFactory); | |
| } | |
| public method getRequest() | |
| { | |
| return requestFactories(saffire.sapi()).getRequest() | |
| } | |
| public method sendResponse(response) | |
| { | |
| //Send the response back to the correct sapi | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment