shopizer-developers

Fixed cannot find acceptable representation by removing html

11/23/2016 4:15:45 PM

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 080fcf2..500eb55 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
-#Tue Nov 22 08:49:17 EST 2016
+#Tue Nov 22 12:01:26 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 da054ab..6273004 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
-#Tue Nov 22 08:49:18 EST 2016
+#Tue Nov 22 12:01:26 EST 2016
 version=2.5.0-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=sm-search
diff --git a/sm-shop/SALESMANAGER.h2.db b/sm-shop/SALESMANAGER.h2.db
index 9ef5d74..29ba484 100644
Binary files a/sm-shop/SALESMANAGER.h2.db and b/sm-shop/SALESMANAGER.h2.db differ
diff --git a/sm-shop/SALESMANAGER.lock.db b/sm-shop/SALESMANAGER.lock.db
index b979148..8178bd2 100644
--- a/sm-shop/SALESMANAGER.lock.db
+++ b/sm-shop/SALESMANAGER.lock.db
@@ -1,4 +1,4 @@
 #FileLock
-#Tue Nov 22 09:03:38 EST 2016
-id=1588c595d4388cd2492f2a9e2c9b3a612bdd4ee7fb5
+#Wed Nov 23 13:11:35 EST 2016
+id=1589262bb772b3ef57a9a8a3af0854e6f5f58ec3004
 method=file
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/application/ShopApplicationConfiguration.java b/sm-shop/src/main/java/com/salesmanager/shop/application/ShopApplicationConfiguration.java
index 133d3a9..b2a1d67 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/application/ShopApplicationConfiguration.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/application/ShopApplicationConfiguration.java
@@ -1,6 +1,7 @@
 package com.salesmanager.shop.application;
 
 import java.nio.charset.Charset;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -15,7 +16,11 @@ import org.springframework.http.converter.HttpMessageConverter;
 import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.web.accept.ContentNegotiationManager;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.ContentNegotiatingViewResolver;
 import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
 import org.springframework.web.servlet.view.tiles3.TilesView;
 import org.springframework.web.servlet.view.tiles3.TilesViewResolver;
@@ -56,14 +61,55 @@ public class ShopApplicationConfiguration extends WebMvcConfigurerAdapter{
         return resolver;
     }
     
+    //https://spring.io/blog/2013/05/11/content-negotiation-using-spring-mvc/
+    //https://spring.io/blog/2013/06/03/content-negotiation-using-views
+    
+/*    
+     * Configure ContentNegotiationManager
+     
     @Override
+    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+        configurer.ignoreAcceptHeader(true).defaultContentType(
+                MediaType.TEXT_HTML);
+    }*/
+    
+/*    
+     * Configure ContentNegotiatingViewResolver
+     
+    @Bean
+    public ViewResolver contentNegotiatingViewResolver(ContentNegotiationManager manager) {
+        ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
+        resolver.setContentNegotiationManager(manager);
+ 
+        // Define all possible view resolvers
+        List<ViewResolver> resolvers = new ArrayList<ViewResolver>();
+ 
+
+        resolvers.add(jsonViewResolver());
+        resolvers.add(jspViewResolver());
+
+         
+        resolver.setViewResolvers(resolvers);
+        return resolver;
+    }*/
+    
+/*    
+     * Configure View resolver to provide JSON output using JACKSON library to
+     * convert object in JSON format.
+     
+    @Bean
+    public ViewResolver jsonViewResolver() {
+        return new JsonViewResolver();
+    }*/
+    
+/*    @Override
     public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
       StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
       stringConverter.setSupportedMediaTypes(Arrays.asList(new MediaType("application", "json", UTF8)));
       converters.add(stringConverter);
 
       // Add other converters ...
-    }
+    }*/
     
 /*    *//**
      * Spring 4 JSON converter
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java
index 631f91e..9b2e89a 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java
@@ -452,7 +452,7 @@ public class ShoppingCategoryController {
 	@ResponseBody
 	public ProductList getProducts(@PathVariable final String store, @PathVariable final String language, @PathVariable final String category, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		
-		//http://localhost:8080/sm-shop/services/public/products/DEFAULT/en/book.html
+		//http://localhost:8080/sm-shop/services/public/products/DEFAULT/en/book
 
 		try {
 
@@ -545,7 +545,7 @@ public class ShoppingCategoryController {
 	 * @return
 	 * @throws Exception
 	 */
-	@RequestMapping("/services/public/products/page/{start}/{max}/{store}/{language}/{category}.html")
+	@RequestMapping("/services/public/products/page/{start}/{max}/{store}/{language}/{category}")
 	@ResponseBody
 	public ProductList getProducts(@PathVariable int start, @PathVariable int max, @PathVariable String store, @PathVariable final String language, @PathVariable final String category, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		
@@ -570,7 +570,7 @@ public class ShoppingCategoryController {
 	 * @return
 	 * @throws Exception
 	 */
-	@RequestMapping("/services/public/products/page/{start}/{max}/{store}/{language}/{category}.html/filter={filterType}/filter-value={filterValue}")
+	@RequestMapping("/services/public/products/page/{start}/{max}/{store}/{language}/{category}/filter={filterType}/filter-value={filterValue}")
 	@ResponseBody
 	public ProductList getProductsFilteredByType(@PathVariable int start, @PathVariable int max, @PathVariable String store, @PathVariable final String language, @PathVariable final String category, @PathVariable final String filterType, @PathVariable final String filterValue, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/MiniCartController.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/MiniCartController.java
index ce4d531..977ca64 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/MiniCartController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/MiniCartController.java
@@ -38,7 +38,7 @@ public class MiniCartController extends AbstractController{
 	
 
 	
-	@RequestMapping(value={"/displayMiniCartByCode.html"},  method = { RequestMethod.GET, RequestMethod.POST })
+	@RequestMapping(value={"/displayMiniCartByCode"},  method = { RequestMethod.GET, RequestMethod.POST })
 	public @ResponseBody ShoppingCartData displayMiniCart(final String shoppingCartCode, HttpServletRequest request, Model model){
 		
 		try {
@@ -64,7 +64,7 @@ public class MiniCartController extends AbstractController{
 	}
 
 	
-	@RequestMapping(value={"/removeMiniShoppingCartItem.html"},   method = { RequestMethod.GET, RequestMethod.POST })
+	@RequestMapping(value={"/removeMiniShoppingCartItem"},   method = { RequestMethod.GET, RequestMethod.POST })
 	public @ResponseBody ShoppingCartData removeShoppingCartItem(Long lineItemId, final String shoppingCartCode, HttpServletRequest request, Model model) throws Exception {
 		Language language = (Language)request.getAttribute(Constants.LANGUAGE);
 		MerchantStore merchantStore = (MerchantStore)request.getAttribute(Constants.MERCHANT_STORE);
diff --git a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/ShoppingCartController.java b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/ShoppingCartController.java
index 5d2379e..0fa84ad 100644
--- a/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/ShoppingCartController.java
+++ b/sm-shop/src/main/java/com/salesmanager/shop/store/controller/shoppingCart/ShoppingCartController.java
@@ -282,7 +282,7 @@ public class ShoppingCartController extends AbstractController {
     }
     
     
-	@RequestMapping(value={"/shoppingCartByCode.html"},  method = { RequestMethod.GET })
+	@RequestMapping(value={"/shoppingCartByCode"},  method = { RequestMethod.GET })
 	public String displayShoppingCart(@ModelAttribute String shoppingCartCode, final Model model, HttpServletRequest request, HttpServletResponse response, final Locale locale) throws Exception{
 
 			MerchantStore merchantStore = (MerchantStore)request.getAttribute(Constants.MERCHANT_STORE);
diff --git a/sm-shop/src/main/resources/spring/shopizer-controllers.xml b/sm-shop/src/main/resources/spring/shopizer-controllers.xml
index c2af565..fdf611b 100644
--- a/sm-shop/src/main/resources/spring/shopizer-controllers.xml
+++ b/sm-shop/src/main/resources/spring/shopizer-controllers.xml
@@ -33,6 +33,10 @@
     	</mvc:argument-resolvers>
 		
 		<mvc:message-converters >
+		
+		    <bean
+             class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
+		
 	        <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter">
 	            <property name="supportedMediaTypes">
 	                <list>
diff --git a/sm-shop/src/main/resources/spring/shopizer-security.xml b/sm-shop/src/main/resources/spring/shopizer-security.xml
index 1a6cf7d..ea62e33 100644
--- a/sm-shop/src/main/resources/spring/shopizer-security.xml
+++ b/sm-shop/src/main/resources/spring/shopizer-security.xml
@@ -122,10 +122,11 @@
 	
 	<!-- REST services -->
 	<http pattern="/services/**" create-session="stateless" use-expressions="true" authentication-manager-ref="adminAuthenticationManager" entry-point-ref="servicesAuthenticationEntryPoint">
-      <intercept-url pattern="/services/private/**" access="hasRole('AUTH')"/>
-      <intercept-url pattern="/services/public/**" access="permitAll"/>
-      <form-login authentication-success-handler-ref="servicesAuthenticationSuccessHandler" />
-      <http-basic />
+	      <intercept-url pattern="/services/private/**" access="hasRole('AUTH')"/>
+	      <intercept-url pattern="/services/public/**" access="permitAll"/>
+	      <form-login authentication-success-handler-ref="servicesAuthenticationSuccessHandler" />
+	      <http-basic />
+	      <csrf disabled="true"/><!-- Spring security 4 -->
     </http>
    
 	
diff --git a/sm-shop/src/main/webapp/pages/shop/common/cart/cart.jsp b/sm-shop/src/main/webapp/pages/shop/common/cart/cart.jsp
index 50df24f..f8f62dd 100644
--- a/sm-shop/src/main/webapp/pages/shop/common/cart/cart.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/common/cart/cart.jsp
@@ -202,7 +202,7 @@
 		var cartCode=getCartCode();
 		if(cartCode!=null) {
 			console.log('cart code ' + cartCode);
-			location.href='<c:url value="/shop/cart/shoppingCartByCode.html" />?shoppingCartCode=' + cartCode;
+			location.href='<c:url value="/shop/cart/shoppingCartByCode" />?shoppingCartCode=' + cartCode;
 		}
 
    });
diff --git a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/pages/category.jsp b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/pages/category.jsp
index 2ea1435..2a71358 100644
--- a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/pages/category.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap/pages/category.jsp
@@ -76,7 +76,7 @@ response.setDateHeader ("Expires", -1);
 	}
  
  	function loadCategoryProducts() {
- 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>.html';
+ 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>';
 	 	
  		if(filter!=null) {
  			url = url + '/filter=' + filter + '/filter-value=' + filterValue +'';
diff --git a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap3/pages/category.jsp b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap3/pages/category.jsp
index a59809b..3801e9f 100644
--- a/sm-shop/src/main/webapp/pages/shop/templates/bootstrap3/pages/category.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/templates/bootstrap3/pages/category.jsp
@@ -76,7 +76,7 @@ response.setDateHeader ("Expires", -1);
 	}
  
  	function loadCategoryProducts() {
- 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>.html';
+ 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>';
 	 	
  		if(filter!=null) {
  			url = url + '/filter=' + filter + '/filter-value=' + filterValue +'';
diff --git a/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/category.jsp b/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/category.jsp
index 6487000..28f966f 100644
--- a/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/category.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/category.jsp
@@ -197,7 +197,7 @@ response.setDateHeader ("Expires", -1);
 	}
  
  	function loadCategoryProducts() {
- 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>.html';
+ 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/<c:out value="${category.description.friendlyUrl}"/>';
 	 	
  		if(filter!=null) {
  			url = url + '/filter=' + filter + '/filter-value=' + filterValue +'';
diff --git a/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/items.jsp b/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/items.jsp
index 4b0bf4a..180013e 100644
--- a/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/items.jsp
+++ b/sm-shop/src/main/webapp/pages/shop/templates/exoticamobilia/pages/items.jsp
@@ -199,7 +199,7 @@ response.setDateHeader ("Expires", -1);
  	function loadItemsProducts() {
  		
  		///products/public/page/{start}/{max}/{store}/{language}/manufacturer/{id}
- 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/manufacturer/<c:out value="${manufacturer.id}"/>.html';
+ 		var url = '<%=request.getContextPath()%>/services/public/products/page/' + START_COUNT_PRODUCTS + '/' + MAX_PRODUCTS + '/<c:out value="${requestScope.MERCHANT_STORE.code}"/>/<c:out value="${requestScope.LANGUAGE.code}"/>/manufacturer/<c:out value="${manufacturer.id}"/>';
 	 	
  		if(filter!=null) {
  			url = url + '/filter=' + filter + '/filter-value=' + filterValue +'';
diff --git a/sm-shop/src/main/webapp/resources/js/shop-minicart.js b/sm-shop/src/main/webapp/resources/js/shop-minicart.js
index 85fbd96..8062b6a 100644
--- a/sm-shop/src/main/webapp/resources/js/shop-minicart.js
+++ b/sm-shop/src/main/webapp/resources/js/shop-minicart.js
@@ -235,7 +235,7 @@ function miniCart(cartCode){
 
 	$.ajax({  
 		 type: 'GET',  
-		 url: getContextPath() + '/shop/cart/displayMiniCartByCode.html?shoppingCartCode='+cartCode,  
+		 url: getContextPath() + '/shop/cart/displayMiniCartByCode?shoppingCartCode='+cartCode,  
 		 cache:false,
 		 error: function(e) { 
 			 console.log('error ' + e);
@@ -271,7 +271,7 @@ function removeItemFromMinicart(lineItemId){
 	$.ajax({  
 		 type: 'GET',
 		 cache:false,
-		 url: getContextPath() + '/shop/cart/removeMiniShoppingCartItem.html?lineItemId='+lineItemId + '&shoppingCartCode=' + shoppingCartCode,  
+		 url: getContextPath() + '/shop/cart/removeMiniShoppingCartItem?lineItemId='+lineItemId + '&shoppingCartCode=' + shoppingCartCode,  
 		 error: function(e) { 
 			 console.log('error ' + e);
 			 
@@ -288,7 +288,7 @@ function removeItemFromMinicart(lineItemId){
 function displayMiniCartSummary(code){
 	$.ajax({  
 		 type: 'GET',  
-		 url: getContextPath() + '/shop/cart/displayMiniCartByCode.html?shoppingCartCode='+code,  
+		 url: getContextPath() + '/shop/cart/displayMiniCartByCode?shoppingCartCode='+code,  
 		 error: function(e) { 
 			// do nothing
 			console('error while getting cart');
diff --git a/sm-shop/src/main/webapp/resources/js/shopping-cart.js b/sm-shop/src/main/webapp/resources/js/shopping-cart.js
index e69294a..03d01c2 100644
--- a/sm-shop/src/main/webapp/resources/js/shopping-cart.js
+++ b/sm-shop/src/main/webapp/resources/js/shopping-cart.js
@@ -237,7 +237,7 @@ function displayMiniCart(){
 
 	$.ajax({  
 		 type: 'GET',  
-		 url: getContextPath() + '/shop/cart/displayMiniCartByCode.html?shoppingCartCode='+cartCode,  
+		 url: getContextPath() + '/shop/cart/displayMiniCartByCode?shoppingCartCode='+cartCode,  
 		 cache:false,
 		 error: function(e) { 
 			 $('#cart-box').removeClass('loading-indicator-overlay');/** manage manually cart loading**/
@@ -278,7 +278,7 @@ function removeItemFromMinicart(lineItemId){
 	$.ajax({  
 		 type: 'GET',
 		 cache:false,
-		 url: getContextPath() + '/shop/cart/removeMiniShoppingCartItem.html?lineItemId='+lineItemId + '&shoppingCartCode=' + shoppingCartCode,  
+		 url: getContextPath() + '/shop/cart/removeMiniShoppingCartItem?lineItemId='+lineItemId + '&shoppingCartCode=' + shoppingCartCode,  
 		 error: function(e) { 
 			 console.log('error ' + e);
 			 
@@ -301,7 +301,7 @@ function removeItemFromMinicart(lineItemId){
 function displayMiniCartSummary(code){
 	$.ajax({  
 		 type: 'GET',  
-		 url: getContextPath() + '/shop/cart/displayMiniCartByCode.html?shoppingCartCode='+code,  
+		 url: getContextPath() + '/shop/cart/displayMiniCartByCode?shoppingCartCode='+code,  
 		 error: function(e) { 
 			// do nothing
 			console('error while getting cart');
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 c2c85d6..8facc58 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
-#Tue Nov 22 08:49:21 EST 2016
+#Wed Nov 23 08:48:04 EST 2016
 version=2.5.0-SNAPSHOT
 groupId=com.shopizer
 m2e.projectName=sm-shop