Search in sources :

Example 66 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project head by mifos.

the class ViewUploadedFilesController method uploadNewFile.

@RequestMapping(value = "/uploadNewFile", method = RequestMethod.GET)
public ModelAndView uploadNewFile(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView("uploadNewFile");
    UploadedFileFormBean uploadedFileFormBean = new UploadedFileFormBean();
    modelAndView.addObject("entityId", request.getParameter("entityId"));
    modelAndView.addObject("entityType", request.getParameter("entityType"));
    modelAndView.addObject("backPageUrl", request.getParameter("backPageUrl"));
    modelAndView.addObject("formBean", uploadedFileFormBean);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 67 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.

the class DemoPortalDataController method getHostsReport.

/**
	 * Method to Bulk Update trust status for selected host.
	 * 
	 * @param req (HttpServletRequest Object)
	 * @param res (HttpServletResponse Object)
	 * @return
	 */
public ModelAndView getHostsReport(HttpServletRequest req, HttpServletResponse res) {
    log.info("DemoPortalDataController.getHostsReport >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    String[] list = req.getParameterValues("selectedHost");
    if (list == null) {
        responseView.addObject("message", "No hosts were selected for reports.");
        log.info("DemoPortalDataController.getHostsReport<<<");
        return responseView;
    }
    List<String> hosts = Arrays.asList(list);
    try {
        responseView.addObject("reports", demoPortalServices.getHostTrustReport(hosts, getAttestationService(req, ApiClient.class)));
        responseView.addObject("result", true);
    } catch (DemoPortalException e) {
        log.error(e.getMessage());
        responseView.addObject("result", false);
        responseView.addObject("message", e.getMessage());
        return responseView;
    }
    responseView.addObject("message", "");
    log.info("DemoPortalDataController.getHostsReport<<<");
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Example 68 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.

the class DemoPortalDataController method trustVerificationDetailsXML.

/**
	 * Method to get Trust Verification Details using SAML.
	 * 
	 * @param req (HttpServletRequest Object)
	 * @param res (HttpServletResponse Object)
	 * @return
	 */
public ModelAndView trustVerificationDetailsXML(HttpServletRequest req, HttpServletResponse res) {
    log.info("DemoPortalDataController.trustVerificationDetailsXML >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    String hostName = req.getParameter("hostName");
    try {
        responseView.addObject("trustSamlDetails", demoPortalServices.trustVerificationDetails(hostName, getAttestationService(req, AttestationService.class), getTrustedCertificates(req)));
        responseView.addObject("hostName", hostName);
        responseView.addObject("result", true);
    } catch (DemoPortalException e) {
        log.error(e.toString());
        e.printStackTrace();
        responseView.addObject("result", false);
        responseView.addObject("message", e.getMessage());
        e.printStackTrace();
        return responseView;
    }
    responseView.addObject("message", "");
    responseView.addObject("result", true);
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Example 69 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.

the class WLMDataController method addOSData.

/**
	 * Method to add OS Data into REST Services.
	 * 
	 * @param req (HttpServletRequest Object)
	 * @param res (HttpServletResponse Object)
	 * @return
	 */
public ModelAndView addOSData(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.addOSData >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        OSDataVO dataVONew = new OSDataVO();
        //Getting OS data from request parameter
        dataVONew.setOsName(req.getParameter("osName"));
        dataVONew.setOsVersion(req.getParameter("osVersion"));
        dataVONew.setOsDescription(req.getParameter("osDescription"));
        //Calling into Service Layer(OSClientServiceImpl) to add OS Data.
        responseView.addObject("result", osClientService.addOSInfo(dataVONew, getWhitelistService(req)));
    } catch (WLMPortalException e) {
        log.error("Error Wile Adding OS Data. Root cause " + e.getMessage());
        responseView.addObject("result", false);
        responseView.addObject("message", e.getMessage());
    }
    log.info("WLMDataController.addOSData <<<");
    return responseView;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 70 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.

the class WLMDataController method getUploadedMenifestFile.

public ModelAndView getUploadedMenifestFile(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getUploadedMenifestFile >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    Object manifest = req.getSession().getAttribute("manifestValue");
    boolean result = false;
    if (manifest != null) {
        result = true;
        responseView.addObject("manifestValue", manifest);
    }
    responseView.addObject("result", result);
    log.info("WLMDataController.getUploadedMenifestFile <<<");
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView)

Aggregations

ModelAndView (org.springframework.web.servlet.ModelAndView)1576 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)669 Test (org.junit.jupiter.api.Test)195 Test (org.junit.Test)188 HashMap (java.util.HashMap)166 ArrayList (java.util.ArrayList)140 RedirectView (org.springframework.web.servlet.view.RedirectView)90 Map (java.util.Map)85 List (java.util.List)69 IOException (java.io.IOException)62 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)60 Date (java.util.Date)57 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)50 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)49 MockHttpServletResponse (org.springframework.web.testfixture.servlet.MockHttpServletResponse)49 MockHttpServletRequest (org.springframework.web.testfixture.servlet.MockHttpServletRequest)47 GetMapping (org.springframework.web.bind.annotation.GetMapping)45 HandlerMethod (org.springframework.web.method.HandlerMethod)45 IPerson (org.apereo.portal.security.IPerson)43 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)35