shopizer-developers
Changes
shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties 2(+1 -1)
sm-shop/SALESMANAGER.h2.db 0(+0 -0)
sm-shop/SALESMANAGER.lock.db 4(+2 -2)
sm-shop/src/main/java/com/salesmanager/shop/admin/controller/shipping/CustomShippingMethodsController.java 20(+11 -9)
Details
diff --git a/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties b/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
index 3929968..262b592 100644
--- a/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
+++ b/shopizer-shipping-distance-module/target/classes/META-INF/maven/com.shopizer/shopizer-shipping-distance-processor/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Thu Dec 15 12:41:36 EST 2016
+#Tue Dec 20 08:56:33 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=shopizer-shipping-distance-processor
diff --git a/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties b/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
index bed57b3..c3145e0 100644
--- a/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
+++ b/sm-search/target/classes/META-INF/maven/com.shopizer/sm-search/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Thu Dec 15 12:41:37 EST 2016
+#Tue Dec 20 08:56:34 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=sm-search
sm-shop/SALESMANAGER.h2.db 0(+0 -0)
diff --git a/sm-shop/SALESMANAGER.h2.db b/sm-shop/SALESMANAGER.h2.db
index 3eb5f4d..33caaee 100644
Binary files a/sm-shop/SALESMANAGER.h2.db and b/sm-shop/SALESMANAGER.h2.db differ
sm-shop/SALESMANAGER.lock.db 4(+2 -2)
diff --git a/sm-shop/SALESMANAGER.lock.db b/sm-shop/SALESMANAGER.lock.db
index a011041..518a6d0 100644
--- a/sm-shop/SALESMANAGER.lock.db
+++ b/sm-shop/SALESMANAGER.lock.db
@@ -1,4 +1,4 @@
#FileLock
-#Mon Dec 19 13:18:20 EST 2016
-id=159184e4179e42570e2ca9d83dab667c08ed00a9534
+#Tue Dec 20 13:09:34 EST 2016
+id=1591d6c94dd9c3ba469553b719b771ae8e16778da01
method=file
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/shipping/CustomShippingMethodsController.java b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/shipping/CustomShippingMethodsController.java
index 7e020e7..fca2ba6 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/shipping/CustomShippingMethodsController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/admin/controller/shipping/CustomShippingMethodsController.java
@@ -411,9 +411,9 @@ public class CustomShippingMethodsController {
}
@PreAuthorize("hasRole('SHIPPING')")
- @RequestMapping(value = "/admin/shipping/weightBased/page.html", method = RequestMethod.POST, produces = "application/json")
+ @RequestMapping(value = "/admin/shipping/weightBased/page.html", method = RequestMethod.POST)
public @ResponseBody
- String pageCustomShipping(HttpServletRequest request,
+ ResponseEntity<String> pageCustomShipping(HttpServletRequest request,
HttpServletResponse response) {
AjaxResponse resp = new AjaxResponse();
@@ -449,8 +449,9 @@ public class CustomShippingMethodsController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@@ -493,21 +494,23 @@ public class CustomShippingMethodsController {
@PreAuthorize("hasRole('SHIPPING')")
- @RequestMapping(value = "/admin/shipping/weightBasedDetails/page.html", method = RequestMethod.POST, produces = "application/json")
+ @RequestMapping(value = "/admin/shipping/weightBasedDetails/page.html", method = RequestMethod.POST)
public @ResponseBody
- String pageCustomShippingDetails(HttpServletRequest request,
+ ResponseEntity<String> pageCustomShippingDetails(HttpServletRequest request,
HttpServletResponse response) {
String region = request.getParameter("region");
AjaxResponse resp = new AjaxResponse();
+ final HttpHeaders httpHeaders= new HttpHeaders();
+ httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
if(StringUtils.isBlank(region)){
resp.setStatus(AjaxPageableResponse.RESPONSE_STATUS_FAIURE);
resp.setErrorString("Region is not valid");
String returnString = resp.toJSONString();
- return returnString;
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
@@ -541,8 +544,7 @@ public class CustomShippingMethodsController {
}
String returnString = resp.toJSONString();
-
- return returnString;
+ return new ResponseEntity<String>(returnString,httpHeaders,HttpStatus.OK);
}
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java
index 1053123..196a4f3 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/populator/catalog/ReadableProductPopulator.java
@@ -125,8 +125,14 @@ public class ReadableProductPopulator extends
if(image!=null) {
ReadableImage rimg = new ReadableImage();
rimg.setImageName(image.getProductImage());
- String imagePath = imageUtils.buildProductImageUtils(store, source.getSku(), image.getProductImage());
- rimg.setImageUrl(imagePath);
+
+ String contextPath = imageUtils.getContextPath();
+ StringBuilder imagePath = new StringBuilder();
+ imagePath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), image.getProductImage()));
+
+ rimg.setImageUrl(imagePath.toString());
+
+
rimg.setId(image.getId());
target.setImage(rimg);
@@ -137,8 +143,11 @@ public class ReadableProductPopulator extends
for(ProductImage img : images) {
ReadableImage prdImage = new ReadableImage();
prdImage.setImageName(img.getProductImage());
- String imgPath = imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage());
- prdImage.setImageUrl(imgPath);
+
+ StringBuilder imgPath = new StringBuilder();
+ imgPath.append(contextPath).append(imageUtils.buildProductImageUtils(store, source.getSku(), img.getProductImage()));
+
+ prdImage.setImageUrl(imgPath.toString());
prdImage.setId(img.getId());
prdImage.setImageType(img.getImageType());
if(img.getProductImageUrl()!=null){
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/utils/AbstractimageFilePath.java b/sm-shop/src/main/java/com/salesmanager/shop/utils/AbstractimageFilePath.java
index 88c3e91..65f35b1 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/utils/AbstractimageFilePath.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/utils/AbstractimageFilePath.java
@@ -1,5 +1,9 @@
package com.salesmanager.shop.utils;
+import java.util.Properties;
+
+import javax.annotation.Resource;
+
import org.apache.commons.lang3.StringUtils;
import com.salesmanager.core.model.catalog.product.Product;
@@ -19,6 +23,19 @@ public abstract class AbstractimageFilePath implements ImageFilePath {
public abstract void setBasePath(String basePath);
+ protected static final String CONTEXT_PATH = "CONTEXT_PATH";
+
+ public @Resource(name="shopizer-properties") Properties properties = new Properties();//shopizer-properties
+
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
/**
* Builds a static content image file path that can be used by image servlet
* utility for getting the physical image
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePath.java b/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePath.java
index b6fcea7..37f1743 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePath.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePath.java
@@ -6,6 +6,12 @@ import com.salesmanager.core.model.merchant.MerchantStore;
public interface ImageFilePath {
+ /**
+ * Context path configured in shopizer-properties.xml
+ * @return
+ */
+ public String getContextPath();
+
public String getBasePath();
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePathUtils.java b/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePathUtils.java
index 90e09f0..407112a 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePathUtils.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/utils/ImageFilePathUtils.java
@@ -1,7 +1,18 @@
package com.salesmanager.shop.utils;
+import org.springframework.stereotype.Component;
+
import com.salesmanager.shop.constants.Constants;
+/**
+ * To be used when using an external web server for managing images
+ * <beans:bean id="img" class="com.salesmanager.shop.utils.LocalImageFilePathUtils">
+ <beans:property name="basePath" value="/static" />
+ </beans:bean>
+ * @author c.samson
+ *
+ */
+@Component
public class ImageFilePathUtils extends AbstractimageFilePath{
private String basePath = Constants.STATIC_URI;
@@ -15,7 +26,10 @@ public class ImageFilePathUtils extends AbstractimageFilePath{
public void setBasePath(String basePath) {
this.basePath = basePath;
}
-
+ @Override
+ public String getContextPath() {
+ return super.getProperties().getProperty(CONTEXT_PATH);
+ }
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/utils/LocalImageFilePathUtils.java b/sm-shop/src/main/java/com/salesmanager/shop/utils/LocalImageFilePathUtils.java
index 5d47dc5..6a50587 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/utils/LocalImageFilePathUtils.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/utils/LocalImageFilePathUtils.java
@@ -1,6 +1,7 @@
package com.salesmanager.shop.utils;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
import com.salesmanager.core.model.catalog.product.Product;
import com.salesmanager.core.model.content.FileContentType;
@@ -10,7 +11,15 @@ import com.salesmanager.shop.model.catalog.manufacturer.Manufacturer;
-
+/**
+ * To be used when working with shopizer servlet for managing images
+ * <beans:bean id="img" class="com.salesmanager.shop.utils.LocalImageFilePathUtils">
+ <beans:property name="basePath" value="/static" />
+ </beans:bean>
+ * @author c.samson
+ *
+ */
+@Component
public class LocalImageFilePathUtils extends AbstractimageFilePath{
private String basePath = Constants.STATIC_URI;
@@ -133,6 +142,11 @@ public class LocalImageFilePathUtils extends AbstractimageFilePath{
.append(imageName).toString();
}
+ @Override
+ public String getContextPath() {
+ return super.getProperties().getProperty(CONTEXT_PATH);
+ }
+
diff --git a/sm-shop/src/main/resources/spring/shopizer-servlet-context.xml b/sm-shop/src/main/resources/spring/shopizer-servlet-context.xml
index 2e8c485..0e4590f 100644
--- a/sm-shop/src/main/resources/spring/shopizer-servlet-context.xml
+++ b/sm-shop/src/main/resources/spring/shopizer-servlet-context.xml
@@ -58,7 +58,6 @@
<!-- load images from local web server [com.salesmanager.web.utils.LocalImageFilePathUtils] -->
<beans:bean id="img" class="com.salesmanager.shop.utils.LocalImageFilePathUtils">
<beans:property name="basePath" value="/static" />
- <!-- /static --><!-- /sm-shop/static -->
</beans:bean>
diff --git a/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties b/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
index 0b2e7ae..11a8449 100644
--- a/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
+++ b/sm-shop/target/m2e-wtp/web-resources/META-INF/maven/com.shopizer/sm-shop/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Mon Dec 19 09:06:14 EST 2016
+#Tue Dec 20 08:56:39 EST 2016
version=2.5.0-SNAPSHOT
groupId=com.shopizer
m2e.projectName=sm-shop