Author: bpoussin Date: 2011-05-04 20:32:54 +0200 (Wed, 04 May 2011) New Revision: 277 Url: http://chorem.org/repositories/revision/bow/277 Log: correction dans le a: qui ne fonctionnait plus depuis le passage au alias prive si l'alias public n'existe pas on affiche juste une page l'indiquant Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java trunk/bow-ui/src/main/webapp/jsp/error.jsp trunk/bow-ui/src/main/webapp/jsp/inc/errorFrame.jsp Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-04-29 21:02:55 UTC (rev 276) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-05-04 18:32:54 UTC (rev 277) @@ -137,8 +137,26 @@ redirectTo = BowUtils.redirectTo(searchLine, null); } else if (searchLine != null && searchLine.startsWith("a:")) { //Redirects to the requested alias - searchLine = searchLine.substring(2); - redirectTo = BowConfig.getInstance().getAliasUrl() + searchLine; + String privateAlias = searchLine.substring(2); + WikittyProxy proxy = getBowProxy(); + Criteria criteria = Search.query() + .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_BOWUSER, user.getWikittyId()) + .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAlias) + .criteria(); + String bookmarkId = proxy.findIdByCriteria(criteria); + // si on retrouve l'alias prive on l'utilise, + // sinon on espere qu'il existe un alias public portant ce nom + if (bookmarkId != null) { + redirectTo = BowConfig.getInstance().getAliasUrl() + bookmarkId; + if (log.isDebugEnabled()) { + log.debug("Private alias found, redirect to: " + redirectTo); + } + } else { + redirectTo = BowConfig.getInstance().getAliasUrl() + privateAlias; + if (log.isDebugEnabled()) { + log.debug("Private alias not found, redirect to: " + redirectTo); + } + } } else { //Search on the chosen search engine BowPreference pref = getBowSession().getPreference(); Modified: trunk/bow-ui/src/main/webapp/jsp/error.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/error.jsp 2011-04-29 21:02:55 UTC (rev 276) +++ trunk/bow-ui/src/main/webapp/jsp/error.jsp 2011-05-04 18:32:54 UTC (rev 277) @@ -23,22 +23,19 @@ --> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> -<%-- - String techError = (String) request.getAttribute("errorMsgTech"); ---%> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <head> - <s:url var="css" value="/css/connexion.css" /> - <link href="${css}" rel="stylesheet" type="text/css" /> - <s:head /> - </head> - <body> - <div id="main"> - <jsp:include page="errorFrame.jsp" flush="true" /> - </div> - </body> + <head> + <s:url var="css" value="/css/connexion.css" /> + <link href="${css}" rel="stylesheet" type="text/css" /> + <s:head /> + </head> + <body> + <div id="main"> + <jsp:include page="inc/errorFrame.jsp" flush="true" /> + </div> + </body> </html> - Modified: trunk/bow-ui/src/main/webapp/jsp/inc/errorFrame.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/errorFrame.jsp 2011-04-29 21:02:55 UTC (rev 276) +++ trunk/bow-ui/src/main/webapp/jsp/inc/errorFrame.jsp 2011-05-04 18:32:54 UTC (rev 277) @@ -22,14 +22,15 @@ #L% --> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> -<% -String userError = (String)request.getAttribute("errorMsgUser"); -String techError = (String)request.getAttribute("errorMsgTech"); -if (userError != null) { -%> - <div class="menu clearfix"> - <h2>Error</h2> - </div> - <pre class="error"><%=userError%><% if (techError != null) { %><br /><br />Detailed error :<br /><%=techError%><% } %></pre> -<% } %> + <% + String userError = (String)request.getAttribute("errorMsgUser"); + String techError = (String)request.getAttribute("errorMsgTech"); + + if (userError != null) { + %> + <div class="menu clearfix"> + <h2>Error</h2> + </div> + <pre class="error"><%=userError%><% if (techError != null) { %><br /><br />Detailed error :<br /><%=techError%><% } %></pre> + <% } %>