Author: sshyrkov Date: Tue Oct 9 10:08:05 2007 New Revision: 18787 URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18787&repname= =3Djahia Log: JAHIA-2461: Exception raised when clicking on link after session has expire= d (403) =
http://www.jahia.net/jira/browse/JAHIA-2461 Resolution: handle session expiration and forbidden access exceptions prope= rly Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/actionmenus/G= etMenuItemsAction.java Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/actionm= enus/GetMenuItemsAction.java URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP= -BRANCH/core/src/java/org/jahia/ajax/actionmenus/GetMenuItemsAction.java&re= v=3D18787&repname=3Djahia =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/actionmenus/G= etMenuItemsAction.java (original) +++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/actionmenus/G= etMenuItemsAction.java Tue Oct 9 10:08:05 2007 @@ -28,6 +28,8 @@ import org.jahia.data.fields.JahiaField; import org.jahia.data.fields.LoadFlags; import org.jahia.exceptions.JahiaException; +import org.jahia.exceptions.JahiaForbiddenAccessException; +import org.jahia.exceptions.JahiaSessionExpirationException; import org.jahia.gui.GuiBean; import org.jahia.gui.HTMLToolBox; import org.jahia.params.ProcessingContext; @@ -106,16 +108,13 @@ final ContentObject object =3D getContentObjectFromString(obje= ctType + "_" + objectID); = if (currentUser =3D=3D null || object =3D=3D null || ! object.= checkWriteAccess(currentUser)) { - logger.warn("Unauthorized attempt to use AJAX Struts Actio= n - GetMenuItemsAction..."); - if (currentUser =3D=3D null) logger.warn("...because curre= ntUser is null"); - if (object =3D=3D null) logger.warn("...because object is = null: " + objectType + "_" + objectID); + if (currentUser =3D=3D null) logger.debug("currentUser is = null"); + if (object =3D=3D null) logger.debug("object is null: " + = objectType + "_" + objectID); = if (jParams.getPage().checkWriteAccess(currentUser)) { - logger.warn("...but user has write access on currentPa= ge: -> OK"); + logger.debug("user has write access on currentPage: ->= OK"); } else { - response.sendError(HttpServletResponse.SC_FORBIDDEN, - "Error: Must be logged in and have 'Write' acc= ess"); - return null; + throw new JahiaForbiddenAccessException(); } } = @@ -225,7 +224,17 @@ // Build and send the response message... sendResponse(xmlTagNames, xmlTagValues, response); = - } catch (final Exception e) { + } catch (JahiaSessionExpirationException ex) { + logger.warn("Session already expired. Unable to fulfill the re= quest", ex); + response + .sendError(HttpServletResponse.SC_FORBIDDEN, + "Unable to process the request ! Msg: your ses= sion is expired"); + } catch (JahiaForbiddenAccessException ex) { + logger.warn("Unauthorized attempt to use AJAX Struts Action - = GetMenuItemsAction..."); + response + .sendError(HttpServletResponse.SC_FORBIDDEN, + "Error: Must be logged in and have 'Write' acc= ess"); + } catch (Exception e) { logger.error("Unable to process the request !", e); if (! response.isCommitted()) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_= ERROR, _______________________________________________ cvs_list mailing list [email protected] http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list
