2006/unicorn/src/org/w3c/unicorn/action ObserveAction.java,1.23,1.24

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv25322/src/org/w3c/unicorn/action

Modified Files:
	ObserveAction.java 
Log Message:
added some comments

Index: ObserveAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ObserveAction.java	8 Sep 2009 15:46:44 -0000	1.23
+++ ObserveAction.java	9 Sep 2009 10:16:11 -0000	1.24
@@ -72,8 +72,10 @@
 	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 			throws ServletException, IOException {
 		
+		// Protects the action in case that Framework is not initialized
 		super.doGet(req, resp);
 		
+		// Objects initialization
 		FileItem aFileItemUploaded = null;
 		Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
 		Map<String, String> mapOfSpecificParameter = new Hashtable<String, String>();
@@ -81,18 +83,23 @@
 		ArrayList<Message> messages = new ArrayList<Message>();
 		UnicornCall aUnicornCall = new UnicornCall();
 		
+		// Default output parameters
 		mapOfOutputParameter.put("output", "simple");
 		mapOfOutputParameter.put("format", "xhtml10");
 		mapOfOutputParameter.put("charset", "UTF-8");
 		mapOfOutputParameter.put("mimetype", "text/html");
 		
+		// Retrieve parameter prefixes from unicorn.properties
 		String paramPrefix = Property.get("UNICORN_PARAMETER_PREFIX");
 		String outParamPrefix = Property.get("UNICORN_PARAMETER_OUTPUT_PREFIX");
-		String queryString = getQueryStringWithout(paramPrefix + "lang", req);
 		
+		// queryString is the requested queryString without the ucn_lang parameter (used for language links)
+		String queryString = getQueryStringWithout(paramPrefix + "lang", req);
 		mapOfStringObject.put("queryString", queryString);
+		// messages is the ArrayList containing the messages to display
 		mapOfStringObject.put("messages", messages);
 		
+		// Retrieve the parameters from the request
 		Map<String, Object> reqParams;
 		try {
 			reqParams = getRequestParameters(req);
@@ -101,6 +108,7 @@
 			return;
 		}
 		
+		// Process the parameters
 		for (String key : reqParams.keySet()) {
 			if (!key.startsWith(paramPrefix) && !key.startsWith(outParamPrefix)) {
 				logger.debug("UnicornCall parameter: " + key + " - " + (String) reqParams.get(key));
@@ -181,6 +189,7 @@
 			}
 		}
 		
+		// Check that all mandatory parameters are set
 		if (!reqParams.containsKey(paramPrefix + "lang")) {
 			String lang = getLanguage(null, req, null);
 			reqParams.put(paramPrefix + "lang", getLanguage(null, req, null));
@@ -192,7 +201,6 @@
 			else
 				aUnicornCall.setLang(lang + "," + aLocale);
 		}
-		
 		if (!reqParams.containsKey(paramPrefix + "task")) {
 			String task = getTask(null, messages);
 			reqParams.put(paramPrefix + "task", task);
@@ -200,7 +208,6 @@
 			mapOfStringObject.put("default_task", Framework.mapOfTask.get(Framework.mapOfTask.getDefaultTaskId()));
 			aUnicornCall.setTask(task);
 		}
-		
 		if (reqParams.containsKey(paramPrefix + "uri")) {
 			if (reqParams.get(paramPrefix + "uri").equals("")) {
 				Message mess = new Message(Message.Level.ERROR, "$message_empty_uri", null);
@@ -229,6 +236,7 @@
 			return;
 		}
 		
+		// Launch the observation
 		try {
 			aUnicornCall.doTask();
 			createOutput(req, resp, mapOfStringObject, aUnicornCall, mapOfSpecificParameter, mapOfOutputParameter);
@@ -251,7 +259,7 @@
 			throws ServletException, IOException {
 		doGet(req, resp);
 	}
-
+	
 	private Map<String, Object> getRequestParameters(HttpServletRequest req) throws FileUploadException {
 		
 		Hashtable<String, Object> params = new Hashtable<String, Object>();

Received on Wednesday, 9 September 2009 10:16:28 UTC