/* * */ package xid; import java.io.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import xid.*; /** * */ public class Test extends HttpServlet { static private org.apache.log4j.Logger log; static { log = org.apache.log4j.Logger.getLogger (Test.class.getName()); } /** * */ public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet (req, res); } /** * */ public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { log.info ("Enter"); Presenter xid = new Presenter (getServletContext ().getRealPath ("/"), "testXid.html"); // TagsData datas = new TagsData (); TextTagData text; // Populate attributes of Test 03. text = new TextTagData (); datas.put ("test03", text); text.setText ("mummy"); text.getAttributes ().appendAttribute ("style", "background: blue;"); text.getAttributes ().appendAttribute ("style", "foreground: red;"); text.getAttributes ().setAttribute ("class", "totoClass"); // Populate attributes of Test 04. text = new TextTagData (); text.getAttributes ().setAttribute ("title", "another title"); datas.put ("test04", text); // Populate attributes of Test 05. text = new TextTagData (); datas.put ("test05", text); text.getAttributes ().appendAttribute ("style", "background: blue;"); text.getAttributes ().appendAttribute ("style", "foreground: red;"); text.getAttributes ().setAttribute ("class", "aClass"); // Populate attributes of Test 06. text = new TextTagData (); text.getAttributes ().appendAttribute ("style", "foreground: red;"); text.getAttributes ().setAttribute ("class", "aClass"); datas.put ("test06", text); // Populate attributes of Test 07. text = new TextTagData (); text.getAttributes ().setAttribute ("width", "50%"); datas.put ("test07", text); // Populate attributes of Test 09. text = new TextTagData (); text.getAttributes ().setAttribute ("class", "xid:nodisplay"); datas.put ("test09", text); StringBuffer html; StringBuffer errorMessage; errorMessage = new StringBuffer (); html = xid.doXid (datas, errorMessage); // Display page. response.setContentType ("text/html"); PrintWriter out = response.getWriter(); out.println (""); out.println (""); out.println ("XID TEST"); out.println (""); out.println (""); out.println ("
"); out.println ("XID TEST
"); if (errorMessage.length () != 0) { out.println ("An error occured in Xid treatment.
"); out.println ("
");
	out.println (errorMessage);
	out.println ("
"); out.println ("
"); out.println ("
" + Presenter.restoreEntities (html) + "
"); out.println ("
"); } else { out.println ("
" + Presenter.restoreEntities (html) + "
"); } out.println (""); out.println (""); log.info ("Exit"); } } // ////////////////////////////////////////////////////////////////////////