|
using System;
using ResponseFactory;
namespace HelloWorld
{
[UserAgent("Mozilla", false)]
public class HTMLResponseFormatter : ResponseFormatter
{
public HTMLResponseFormatter() {}
public override string FormatResponse(string Text)
{
System.Text.StringBuilder Response = new System.Text.StringBuilder();
Response.Append("<html><body>");
Response.Append(Text);
Response.Append("</body></html>");
return Response.ToString();
}
}
[UserAgent("XML", false)]
public class XMLResponseFormatter : ResponseFormatter
{
public XMLResponseFormatter() {}
public override string FormatResponse(string Text)
{
System.Text.StringBuilder Response = new System.Text.StringBuilder();
Response.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
Response.Append("<response>");
Response.Append(Text);
Response.Append("</response>");
return Response.ToString();
}
}
[UserAgent("", true)]
public class TextResponseFormatter : ResponseFormatter
{
public TextResponseFormatter() {}
public override string FormatResponse(string Text)
{
return Text;
}
}
[UserAgent("Nokia", false)]
[UserAgent("Ericsson", false)]
[UserAgent("WML", false)]
public class WMLResponseFormatter : ResponseFormatter
{
public override string FormatResponse(string Text)
{
System.Text.StringBuilder Response = new System.Text.StringBuilder();
Response.Append("<?xml version=\"1.0\"?>");
Response.Append("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">");
Response.Append("<wml>");
Response.Append("<card id=\"response\" title=\"response\">");
Response.Append(Text);
Response.Append("</card>");
Response.Append("</wml>");
return Response.ToString();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.