Permalink
Browse files

No functional changes, just formatting and adding a required cast

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1449282 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
JacquesLeRoux committed Feb 23, 2013
1 parent fec3f12 commit f19b75947680262b4eb5a2eacc87de55500effcc
@@ -156,7 +156,7 @@ public void destroy() {
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("/");
}
@@ -47,34 +47,33 @@ public String getStringArg(Map args, String key) {
@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());
}

0 comments on commit f19b759

Please sign in to comment.