Search in sources :

Example 86 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project pinpoint by naver.

the class ScatterChartController method createScatterDataV1.

private ModelAndView createScatterDataV1(ScatterData scatterData, boolean complete) {
    ModelAndView mv = new ModelAndView();
    mv.addObject("resultFrom", scatterData.getOldestAcceptedTime());
    mv.addObject("resultTo", scatterData.getLatestAcceptedTime());
    mv.addObject("complete", complete);
    mv.addObject("scatter", scatterData);
    return mv;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView)

Example 87 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project pinpoint by naver.

the class AgentCommandController method createResponse.

private ModelAndView createResponse(boolean success, Object message) {
    ModelAndView mv = new ModelAndView();
    mv.setViewName("jsonView");
    if (success) {
        mv.addObject("code", 0);
    } else {
        mv.addObject("code", -1);
    }
    mv.addObject("message", message);
    return mv;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView)

Example 88 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.

the class LocationMonitorDetailsController method handle.

@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
public ModelAndView handle(HttpServletRequest request, @ModelAttribute("command") LocationMonitorIdCommand cmd, BindingResult errors) {
    m_validator.validate(cmd, errors);
    LocationMonitorListModel model = null;
    if (!errors.hasErrors()) {
        model = m_distributedPollerService.getLocationMonitorDetails(cmd, errors);
    }
    if (errors.hasErrors()) {
        return new ModelAndView(ERROR_VIEW);
    } else {
        ModelAndView modelAndView = new ModelAndView(SUCCESS_VIEW, "model", model);
        if (request.isUserInRole(Authentication.ROLE_ADMIN)) {
            modelAndView.addObject("isAdmin", "true");
        }
        return modelAndView;
    }
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) LocationMonitorListModel(org.opennms.web.svclayer.model.LocationMonitorListModel) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 89 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.

the class ServiceController method createErrorModelAndView.

private ModelAndView createErrorModelAndView(int node, String intf, int serviceId) {
    ModelAndView modelAndView = new ModelAndView("element/errorPageService");
    modelAndView.addObject("node", node);
    modelAndView.addObject("intf", intf);
    modelAndView.addObject("serviceId", serviceId);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView)

Example 90 with ModelAndView

use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.

the class AlarmDetailController method saveStickyMemo.

public ModelAndView saveStickyMemo(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
    int alarmId;
    String alarmIdString = "";
    // Try to parse alarm ID from string to integer
    try {
        alarmIdString = httpServletRequest.getParameter("alarmId");
        alarmId = Integer.parseInt(alarmIdString);
        String stickyMemoBody = httpServletRequest.getParameter("stickyMemoBody");
        m_webAlarmRepository.updateStickyMemo(alarmId, stickyMemoBody, httpServletRequest.getRemoteUser());
        return new ModelAndView(new RedirectView("detail.htm", true), "id", alarmId);
    } catch (NumberFormatException e) {
        logger.error("Could not parse alarm ID '{}' to integer.", httpServletRequest.getParameter("alarmId"));
        throw new ServletException("Could not parse alarm ID " + httpServletRequest.getParameter("alarmId") + " to integer.");
    }
}
Also used : ServletException(javax.servlet.ServletException) ModelAndView(org.springframework.web.servlet.ModelAndView) RedirectView(org.springframework.web.servlet.view.RedirectView)

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