Skip to content

Instantly share code, notes, and snippets.

@Ikke
Created July 12, 2013 19:56
Show Gist options
  • Save Ikke/5987283 to your computer and use it in GitHub Desktop.
Save Ikke/5987283 to your computer and use it in GitHub Desktop.
//Module fasctgi
class Fastcgi
{
}
class FastcgiRequestFactory implements RequestFactory
{
public method getRequest()
{
//create an http.request object with the correct data
return new http.request()
}
}
//Module HTTP
class Request
{
//Basic request API
}
class Response
{
//Basic response API
}
public class HTTP
{
public method executeRequest()
{
//Make a request
return new Response()
}
}
//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