Commits

Juan Carlos Picado Herrera committed 8ca7f45

Improving error handler, in progress

Comments (0)

Files changed (3)

enme-mvc/src/main/java/org/encuestame/mvc/controller/ErrorController.java

     }
 
     /**
-     *
+     * Display a user denied view, used by spring security, see the main configuration.
      * @param model
      * @return
      */
     @RequestMapping("/user/denied")
-    @Deprecated
-    //FIXME it's used?
     public String errorDeniedController(final ModelMap model) {
         return "error/denied";
     }

enme-mvc/src/main/java/org/encuestame/mvc/controller/HashTagController.java

     public String tagController(ModelMap model, HttpServletRequest request,
             HttpServletResponse response, @PathVariable String name) {
         name = filterValue(name);
-        
+
         final HashTag tag;
         try {
-        
+
             tag = getFrontService().getHashTagItem(name);
             if (tag == null) {
-                return "pageNotFound";
+                return "404";
             } else {
-            	try {
-            		 log.debug("tagController tag =>"+tag);
-                 	final String IP = getIpClient(request);
+                try {
+                     log.debug("tagController tag =>"+tag);
+                     final String IP = getIpClient(request);
                      boolean hashTagVisite = getFrontService().checkPreviousHit(IP, tag.getHashTagId(), TypeSearchResult.HASHTAG);
                      // TODO: Check that previous hash Tag hit has been visited the same day.
                      log.debug("hashTagVisite =>"+hashTagVisite);
                      if (!hashTagVisite) {
                          getFrontService().registerHit(null, null, null, tag, IP, HitCategory.VISIT);
                      }
-				} catch (Exception e) {
-					log.warn("Imposible register vote " + "tag id: " + tag.getHashTagId());
-				} 
+                } catch (Exception e) {
+                    log.warn("Imposible register vote " + "tag id: " + tag.getHashTagId());
+                }
                 final List<HomeBean> lastPublications = getFrontService()
                         .searchLastPublicationsbyHashTag(tag, null, this.INIT_RESULTS,
                                 LIMIT_HASHTAG, "hashtag", request);
         } catch (Exception e) {
             e.printStackTrace();
             log.error(e);
-            return "pageNotFound";
+            return "404";
         }
         return "tag/detail";
     }

enme-war/enme-views/src/main/webapp/WEB-INF/views/error/tiles.xml

 
 <tiles-definitions>
 
+    <!--
+        //FIXME: connectionError it's used?
+     -->
     <definition name="connectionError" extends="errorPage">
         <put-attribute name="title" value="Error" />
         <put-attribute name="menu" expression="/WEB-INF/jsp/includes/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
         <put-attribute name="content" expression="/WEB-INF/views/error/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
     </definition>
 
+    <!--
+        //FIXME: htmlerror it's used?
+     -->
     <definition name="htmlerror" extends="errorPage">
         <put-attribute name="title" value="Error" />
         <put-attribute name="content" expression="/WEB-INF/views/error/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
     </definition>
 
+    <!--
+        //FIXME: jsonerror it's used?
+     -->
      <definition name="jsonerror" extends="errorPage">
         <put-attribute name="title" value="Error" />
         <put-attribute name="menu" expression="/WEB-INF/jsp/includes/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
         <put-attribute name="content" expression="/WEB-INF/views/error/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
     </definition>
 
+    <!--
+        //FIXME: xmlerror it's used?
+     -->
      <definition name="xmlerror" extends="errorPage">
         <put-attribute name="title" value="Error" />
         <put-attribute name="menu" expression="/WEB-INF/jsp/includes/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
         <put-attribute name="content" expression="/WEB-INF/views/error/${detectedDevice ? 'mobile/' : 'web/'}connectionError.jsp" />
     </definition>
 
+    <!--
+        //FIXME: Deprecated by 404, please remove.
+     -->
     <definition name="pageNotFound" extends="errorPage">
         <put-attribute name="title" value="Page Not Found" />
         <put-attribute name="content" expression="/WEB-INF/views/error/${detectedDevice ? 'mobile/' : 'web/'}404.jsp" />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.