1 package org.openecomp.portalapp.widget.controller;
 
   3 import java.io.UnsupportedEncodingException;
 
   5 import javax.servlet.http.HttpServletRequest;
 
   6 import javax.servlet.http.HttpServletResponse;
 
   8 import org.openecomp.portalapp.widget.domain.ValidationRespond;
 
   9 import org.openecomp.portalapp.widget.service.StorageService;
 
  10 import org.slf4j.Logger;
 
  11 import org.slf4j.LoggerFactory;
 
  12 import org.springframework.beans.factory.annotation.Autowired;
 
  13 import org.springframework.stereotype.Controller;
 
  14 import org.springframework.web.bind.annotation.PathVariable;
 
  15 import org.springframework.web.bind.annotation.RequestMapping;
 
  16 import org.springframework.web.bind.annotation.RequestMethod;
 
  17 import org.springframework.web.bind.annotation.RequestParam;
 
  18 import org.springframework.web.bind.annotation.ResponseBody;
 
  19 import org.springframework.web.multipart.MultipartFile;
 
  22 public class DatabaseFileUploadController {
 
  25         private StorageService storageService;
 
  27         private static final Logger logger = LoggerFactory.getLogger(DatabaseFileUploadController.class); 
 
  30         @RequestMapping(value = "/microservices/markup/{widgetId}", method = RequestMethod.GET)
 
  31         public String getWidgetMarkup(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId){
 
  34                         logger.debug("DatabaseFileUploadController.getWidgetMarkup: getting markup.html for widget with widgetId = {}" , widgetId);
 
  35                         markup = storageService.getWidgetMarkup(widgetId);
 
  37                         logger.error("Exception occurred while performing DatabaseFileUploadController.getWidgetMarkup in widget microservices. Details:" + e.getMessage());
 
  43         @RequestMapping(value = "/microservices/{widgetId}/controller.js", method = RequestMethod.GET)
 
  44         public String getWidgetController(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId){
 
  45                 String controller = null;
 
  47                         logger.debug("DatabaseFileUploadController.getWidgetController: getting controller.js for widget with widgetId = {}" , widgetId);
 
  48                         controller = storageService.getWidgetController(widgetId); 
 
  50                         logger.error("Exception occurred while performing DatabaseFileUploadController.getWidgetController in widget microservices. Details:" + e.getMessage());
 
  56         @RequestMapping(value = "/microservices/{widgetId}/framework.js", method = RequestMethod.GET)
 
  57         public String getWidgetFramework(HttpServletRequest request, HttpServletResponse response,
 
  58                         @PathVariable("widgetId") long widgetId){
 
  59                 String framework = null;
 
  61                         logger.debug("DatabaseFileUploadController.getWidgetFramework: getting framework.js for widget with widgetId = {}" , widgetId);
 
  62                         framework = storageService.getWidgetFramework(widgetId);
 
  64                         logger.error("Exception occurred while performing DatabaseFileUploadController.getWidgetFramework in widget microservices. Details:" + e.getMessage());
 
  70         @RequestMapping(value = "/microservices/{widgetId}/styles.css", method = RequestMethod.GET)
 
  71         public String getWidgetCSS(HttpServletRequest request, HttpServletResponse response,
 
  72                         @PathVariable("widgetId") long widgetId){
 
  75                         logger.debug("DatabaseFileUploadController.getWidgetCSS: getting styles.css for widget with widgetId = {}" , widgetId);
 
  76                         css = storageService.getWidgetCSS(widgetId);
 
  77                 } catch (UnsupportedEncodingException e) {
 
  78                         logger.error("Exception occurred while performing DatabaseFileUploadController.getWidgetCSS in widget microservices. Details:" + e.getMessage());