|
Author: jleroux
Date: Sat Feb 23 08:47:28 2013 New Revision: 1449282 URL: http://svn.apache.org/r1449282 Log: No functional changes, just formatting and adding a required cast Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java?rev=1449282&r1=1449281&r2=1449282&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java Sat Feb 23 08:47:28 2013 @@ -156,7 +156,7 @@ public class CatalogUrlServlet extends H public static String makeCatalogUrl(HttpServletRequest request, String productId, String currentCategoryId, String previousCategoryId) { StringBuilder urlBuilder = new StringBuilder(); - urlBuilder.append(request.getSession().getServletContext().getContextPath()); + urlBuilder.append(((HttpServletRequest) request.getSession().getServletContext()).getContextPath()); if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') { urlBuilder.append("/"); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java?rev=1449282&r1=1449281&r2=1449282&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogUrlTransform.java Sat Feb 23 08:47:28 2013 @@ -47,34 +47,33 @@ public class OfbizCatalogUrlTransform im @Override @SuppressWarnings("unchecked") - public Writer getWriter(final Writer out, final Map args) - throws TemplateModelException, IOException { + public Writer getWriter(final Writer out, final Map args) throws TemplateModelException, IOException { final StringBuilder buf = new StringBuilder(); return new Writer(out) { - + @Override public void write(char[] cbuf, int off, int len) throws IOException { buf.append(cbuf, off, len); } - + @Override public void flush() throws IOException { out.flush(); } - + @Override public void close() throws IOException { try { - Environment env = Environment.getCurrentEnvironment(); - BeanModel req = (BeanModel) env.getVariable("request"); - if (req != null) { - String productId = getStringArg(args, "productId"); - String currentCategoryId = getStringArg(args, "currentCategoryId"); - String previousCategoryId = getStringArg(args, "previousCategoryId"); - HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); - String catalogUrl = CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId); - out.write(catalogUrl); - } + Environment env = Environment.getCurrentEnvironment(); + BeanModel req = (BeanModel) env.getVariable("request"); + if (req != null) { + String productId = getStringArg(args, "productId"); + String currentCategoryId = getStringArg(args, "currentCategoryId"); + String previousCategoryId = getStringArg(args, "previousCategoryId"); + HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); + String catalogUrl = CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId); + out.write(catalogUrl); + } } catch (TemplateModelException e) { throw new IOException(e.getMessage()); } |
| Free forum by Nabble | Edit this page |
