@@ -0,0 +1,2736 @@
+/**%0A * The contents of this file are subject to the license and copyright%0A * detailed in the LICENSE and NOTICE files at the root of the source%0A * tree and available online at%0A *%0A * http://www.dspace.org/license/%0A */%0Apackage org.dspace.app.xmlui.aspect.general;%0A%0Aimport java.util.Map;%0A%0Aimport org.apache.cocoon.environment.Request;%0Aimport org.apache.cocoon.environment.ObjectModelHelper;%0Aimport org.apache.avalon.framework.parameters.Parameters;%0Aimport org.apache.cocoon.selection.Selector;%0Aimport org.apache.log4j.Logger;%0Aimport org.dspace.app.xmlui.utils.HandleUtil;%0Aimport org.dspace.content.DSpaceObject;%0Aimport org.dspace.content.Item;%0Aimport org.dspace.core.Constants;%0A%0A/**%0A * This simple selector looks for the If-Modified-Since header, and%0A * returns true if the Item in the request has not been modified since that%0A * date.  The expression is ignored since the test is inherent in the request.%0A *%0A * Typical sitemap usage:%0A *%0A *  %3Cmap:match type=%22HandleTypeMatcher%22 pattern=%22item%22%3E%0A *    %3Cmap:select type=%22IfModifiedSinceSelector%22%3E%0A *      %3Cmap:when test=%22true%22%3E%0A *        %3Cmap:act type=%22NotModifiedAction%22/%3E%0A *        %3Cmap:serialize/%3E%0A *      %3C/map:when%3E%0A *      %3Cmap:otherwise%3E%0A *        %3Cmap:transform type=%22ItemViewer%22/%3E%0A *        %3Cmap:serialize type=%22xml%22/%3E%0A *      %3C/map:otherwise%3E%0A *    %3C/map:select%3E%0A *  %3C/map:match%3E%0A *%0A * @author Larry Stone%0A */%0Apublic class IfModifiedSinceSelector implements Selector%0A%7B%0A%0A    private static Logger log = Logger.getLogger(IfModifiedSinceSelector.class);%0A%0A    /**%0A     * Check for If-Modified-Since header on request,%0A     * and returns true if the Item should *not* be sent, i.e.%0A     * if the response status should be 304 (HttpServletResponse.SC_NOT_MODIFIED).%0A     *%0A     * @param expression is ignored%0A     * @param objectModel%0A     *            environment passed through via cocoon%0A     * @return null or map containing value of sitemap parameter 'pattern'%0A     */%0A    public boolean select(String expression, Map objectModel,%0A            Parameters parameters)%0A    %7B%0A        try%0A        %7B%0A            Request request = ObjectModelHelper.getRequest(objectModel);%0A            DSpaceObject dso = HandleUtil.obtainHandle(objectModel);%0A            if (dso.getType() == Constants.ITEM)%0A            %7B%0A                Item item = (Item) dso;%0A                long modSince = request.getDateHeader(%22If-Modified-Since%22);%0A                if (modSince != -1 && item.getLastModified().getTime() %3C modSince)%0A                %7B%0A                    return true;%0A                %7D%0A            %7D%0A            return false;%0A        %7D%0A        catch (Exception e)%0A        %7B%0A            log.error(%22Error selecting based on If-Modified-Since: %22+e.toString());%0A            return false;%0A        %7D%0A    %7D%0A%7D%0A

Copy IfModifiedSinceSelector.java to modules