org.springframework.web.servlet.ModelAndView Java Examples

The following examples show how to use org.springframework.web.servlet.ModelAndView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: M3UController.java    From subsonic with GNU General Public License v3.0 6 votes vote down vote up
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    response.setContentType("audio/x-mpegurl");
    response.setCharacterEncoding(StringUtil.ENCODING_UTF8);

    Player player = playerService.getPlayer(request, response);

    String url = request.getRequestURL().toString();
    url = url.replaceFirst("play.m3u.*", "stream?");

    // Rewrite URLs in case we're behind a proxy.
    if (settingsService.isRewriteUrlEnabled()) {
        String referer = request.getHeader("referer");
        url = StringUtil.rewriteUrl(url, referer);
    }

    url = settingsService.rewriteRemoteUrl(url);

    if (player.isExternalWithPlaylist()) {
        createClientSidePlaylist(response.getWriter(), player, url);
    } else {
        createServerSidePlaylist(response.getWriter(), player, url);
    }
    return null;
}
 
Example #2
Source File: JobControllerIntegrationTest.java    From gocd with Apache License 2.0 6 votes vote down vote up
@Test
public void jobDetailModel_shouldNotHaveElasticPluginIdAndElasticAgentIdForACompletedJob() throws Exception {
    Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
    Stage stage = pipeline.getFirstStage();
    JobInstance job = stage.getFirstJob();

    final Agent agent = new Agent(job.getAgentUuid(), "localhost", "127.0.0.1", uuidGenerator.randomUuid());
    agent.setElasticAgentId("elastic_agent_id");
    agent.setElasticPluginId("plugin_id");
    agentService.saveOrUpdate(agent);

    ModelAndView modelAndView = controller.jobDetail(pipeline.getName(), String.valueOf(pipeline.getCounter()),
            stage.getName(), String.valueOf(stage.getCounter()), job.getName());

    assertNull(modelAndView.getModel().get("elasticAgentPluginId"));
    assertNull(modelAndView.getModel().get("elasticAgentId"));
}
 
Example #3
Source File: RequestMappingHandlerAdapter.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Nullable
private ModelAndView getModelAndView(ModelAndViewContainer mavContainer,
		ModelFactory modelFactory, NativeWebRequest webRequest) throws Exception {

	modelFactory.updateModel(webRequest, mavContainer);
	if (mavContainer.isRequestHandled()) {
		return null;
	}
	ModelMap model = mavContainer.getModel();
	ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model, mavContainer.getStatus());
	if (!mavContainer.isViewReference()) {
		mav.setView((View) mavContainer.getView());
	}
	if (model instanceof RedirectAttributes) {
		Map<String, ?> flashAttributes = ((RedirectAttributes) model).getFlashAttributes();
		HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
		if (request != null) {
			RequestContextUtils.getOutputFlashMap(request).putAll(flashAttributes);
		}
	}
	return mav;
}
 
Example #4
Source File: UserController.java    From MOOC with MIT License 6 votes vote down vote up
@RequestMapping(value = "regist")
// 注册
public ModelAndView regist(ModelAndView mav, String varcode, User user, HttpSession session, HttpServletRequest req) {
	String id = DateUtil.getId();
	String username = user.getUsername();
	mav.setViewName("redirect:course");
	if (varcode == null) {
		return mav;
	}
	if (userBiz.selectUser(username) == 1 || !CaptchaUtil.ver(varcode, req)) {
		return mav;
	}
	user.setId(id);
	user.setMission(null);
	user.setBuycase(null);
	user.setMycase(null);
	user.setVip(null);
	userBiz.insertSelective(user);
	setlog(user, req.getRemoteAddr(), "普通注册");
	return mav;
}
 
Example #5
Source File: SignonInterceptor.java    From jpetstore-kubernetes with Apache License 2.0 6 votes vote down vote up
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws Exception {
	UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession");
	if (userSession == null) {
		String url = request.getServletPath();
		String query = request.getQueryString();
		ModelAndView modelAndView = new ModelAndView("SignonForm");
		if (query != null) {
			modelAndView.addObject("signonForwardAction", url+"?"+query);
		}
		else {
			modelAndView.addObject("signonForwardAction", url);
		}
		throw new ModelAndViewDefiningException(modelAndView);
	}
	else {
		return true;
	}
}
 
Example #6
Source File: TaskController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取用户任务的表单字段
 */
@RequestMapping(value = "task/getform/{taskId}")
public ModelAndView readTaskForm(@PathVariable("taskId") String taskId) throws Exception {
    String viewName = "chapter6/task-form";
    ModelAndView mav = new ModelAndView(viewName);
    TaskFormData taskFormData = formService.getTaskFormData(taskId);
    if (taskFormData.getFormKey() != null) {
        Object renderedTaskForm = formService.getRenderedTaskForm(taskId);
        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
        mav.addObject("task", task);
        mav.addObject("taskFormData", renderedTaskForm);
        mav.addObject("hasFormKey", true);
    } else {
        mav.addObject("taskFormData", taskFormData);
    }
    return mav;
}
 
Example #7
Source File: EncryptionController.java    From rice with Educational Community License v2.0 6 votes vote down vote up
/**
 * Decrypt the text of the input field.
 *
 * <p>
 * The encryptedText and decryptedText filds are populated when decryption is successful.  An error message
 * is displayed otherwise.
 * </p>
 */
@RequestMapping(params = "methodToCall=decrypt")
public ModelAndView decrypt(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response) {
    EncryptionForm encryptionForm = (EncryptionForm) form;

    try {
        encryptionForm.setEncryptedText(encryptionForm.getInput());
        encryptionForm.setDecryptedText(getEncryptionService().decrypt(
                encryptionForm.getInput()));
    }
    catch (GeneralSecurityException gse) {
        GlobalVariables.getMessageMap().putError(INPUT_FIELD, ENCRYPTION_ERROR, gse.toString());
    }

    return getModelAndView(form);
}
 
Example #8
Source File: HandlerExceptionResolverComposite.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Resolve the exception by iterating over the list of configured exception resolvers.
 * <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null} is returned.
 */
@Override
@Nullable
public ModelAndView resolveException(
		HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {

	if (this.resolvers != null) {
		for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) {
			ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex);
			if (mav != null) {
				return mav;
			}
		}
	}
	return null;
}
 
Example #9
Source File: LogoutActionTest.java    From web-sso with Apache License 2.0 6 votes vote down vote up
@Test
public void testLogoutWithCredentialButNoService() throws IOException {
	MockHttpServletRequest request = new MockHttpServletRequest();
	MockHttpServletResponse response = new MockHttpServletResponse();
	HttpSession session = request.getSession();
	CredentialResolver credentialResolver = Mockito.mock(CredentialResolver.class);
	logoutAction.setCredentialResolver(credentialResolver);
	Ki4soService ki4soService = Mockito.mock(Ki4soService.class);
	logoutAction.setKi4soService(ki4soService);
	
	//测试存在cookie,登出后要清除cookie值,但是service参数的值是null的情况。
	request.setCookies(new Cookie(WebConstants.KI4SO_SERVER_ENCRYPTED_CREDENTIAL_COOKIE_KEY, "dddsd"));
	ModelAndView mv = logoutAction.logout(request, response,session);
	Assert.assertEquals(1, response.getCookies().length);
	Assert.assertEquals(0, response.getCookies()[0].getMaxAge());
	Assert.assertEquals("logoutSucess", mv.getViewName());
}
 
Example #10
Source File: SysUserController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   * @param response
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息"));
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #11
Source File: MyErrorViewResolver.java    From EasyEE with MIT License 6 votes vote down vote up
@Override
public ModelAndView resolveErrorView(HttpServletRequest request, HttpStatus status, Map<String, Object> model) {
	// Use the request or status to optionally return a ModelAndView
	// System.out.println(status.value());
	// System.out.println(status.is5xxServerError());
	// System.out.println(model);
	if(logger.isErrorEnabled()){
		logger.error("View error! ["+status.value()+", "+status.getReasonPhrase()+"]");
	}
	ModelAndView mav = new ModelAndView();
	if(status.is4xxClientError()){
		mav.setViewName("error/notFound");
	}else{
		mav.setViewName("error/serverError");
	}
	
	return mav;
}
 
Example #12
Source File: DocumentControllerServiceImpl.java    From rice with Educational Community License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ModelAndView superUserDisapprove(DocumentFormBase form) {
    Document document = form.getDocument();

    if (StringUtils.isBlank(document.getSuperUserAnnotation())) {
        GlobalVariables.getMessageMap().putErrorForSectionId(
                "Uif-SuperUserAnnotation", RiceKeyConstants.ERROR_SUPER_USER_DISAPPROVE_MISSING);
    }

    Set<String> selectedCollectionLines = form.getSelectedCollectionLines().get(UifPropertyPaths.ACTION_REQUESTS);

    if (!CollectionUtils.isEmpty(selectedCollectionLines)) {
        GlobalVariables.getMessageMap().putErrorForSectionId(
                "Uif-SuperUserActionRequests", RiceKeyConstants.ERROR_SUPER_USER_DISAPPROVE_ACTIONS_CHECKED);
    }

    if (GlobalVariables.getMessageMap().hasErrors()) {
        return getModelAndViewService().getModelAndView(form);
    }

    performSuperUserWorkflowAction(form, UifConstants.SuperUserWorkflowAction.DISAPPROVE);

    return getModelAndViewService().getModelAndView(form);
}
 
Example #13
Source File: IMAgentController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/tag")
@Menu(type = "setting" , subtype = "tag" , admin= false)
public ModelAndView tag(ModelMap map , HttpServletRequest request , @Valid String code) {
	SysDic tagType = null ;
	List<SysDic> tagList = UKeFuDic.getInstance().getDic("com.dic.tag.type") ;
	if(tagList.size() > 0){
		
		if(!StringUtils.isBlank(code)){
			for(SysDic dic : tagList){
				if(code.equals(dic.getCode())){
					tagType = dic ;
				}
			}
		}else{
			tagType = tagList.get(0) ;
		}
		map.put("tagType", tagType) ;
	}
	if(tagType!=null){
		map.put("tagList", tagRes.findByOrgiAndTagtype(super.getOrgi(request) , tagType.getCode() , new PageRequest(super.getP(request), super.getPs(request)))) ;
	}
	map.put("tagTypeList", tagList) ;
	return request(super.createAppsTempletResponse("/apps/setting/agent/tag"));
}
 
Example #14
Source File: Alert.java    From tddl5 with Apache License 2.0 6 votes vote down vote up
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
                                                                                                      throws Exception {
    int reason = 0;
    String result = null;
    try {
        reason = Integer.parseInt(request.getParameter("reason").trim());
    } catch (NullPointerException e) {
        reason = 0;
    }
    result = typeMap.get(reason);
    if (null == result) {
        result = typeMap.get(UNKNOW);
    }
    return new ModelAndView("failure", "reason", result);
}
 
Example #15
Source File: MetadataController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes"})
@RequestMapping("/synctodb")
   @Menu(type = "admin" , subtype = "metadata" , admin = true)
   public ModelAndView synctodb(ModelMap map , HttpServletRequest request,@Valid String id) throws SQLException, BeansException, ClassNotFoundException {
   	if(!StringUtils.isBlank(id)) {
   		MetadataTable table = metadataRes.findById(id) ;
   		if(table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
   			SysDic dic = UKeFuDic.getInstance().getDicItem(table.getListblocktemplet()) ;
   			
   			if(dic!=null) {
    			Object bean = UKDataContext.getContext().getBean(Class.forName(dic.getCode())) ;
    			if(bean instanceof ElasticsearchRepository) {
    				ElasticsearchRepository jpa = (ElasticsearchRepository)bean ;
    				if(!StringUtils.isBlank(table.getPreviewtemplet())) {
    					Iterable dataList = jpa.findAll();
    					for(Object object : dataList) {
    						service.delete(object);
    						service.save(object);
    					}
    				}
    			}
   			}
   		}
   	}
   	return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
   }
 
Example #16
Source File: ErrorController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@ExceptionHandler(Throwable.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ModelAndView exception(final Throwable throwable, final Model model) {
    logger.error("Exception during execution of SpringSecurity application", throwable);
    StringBuffer sb = new StringBuffer();
    sb.append("Exception during execution of Spring Security application!  ");
    sb.append((throwable != null ? throwable.getMessage() : "Unknown error"));
    sb.append(", root cause: ").append((throwable != null ? throwable.getCause() : "Unknown cause"));
    model.addAttribute("error", sb.toString());

    ModelAndView mav = new ModelAndView();
    mav.addObject("error", sb.toString());
    mav.setViewName("error");

    return mav;
}
 
Example #17
Source File: Prj3000Controller.java    From oslits with GNU General Public License v3.0 5 votes vote down vote up
/**
	 * Prj3000 산출물 양식 확정 AJAX
	 * 산출물 파일 확정 처리
	 * @param 
	 * @return 
	 * @exception Exception
	 */
	@RequestMapping(value="/prj/prj3000/prj3000/updatePrj3000FileSnAjax.do")
    public ModelAndView updatePrj3000FileSnAjax(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception {
    	
    	try{
        	
    		// request 파라미터를 map으로 변환
        	Map<String, String> paramMap = RequestConvertor.requestParamToMap(request, true);
        	
        	HttpSession ss = request.getSession();
        	paramMap.put("prjId", (String)ss.getAttribute("selPrjId"));
        //	paramMap.put("docFileSn", "0");

        	
        	// 산출물 확정 처리
     	prj3000Service.updatePrj3000FileSnSelect(paramMap);
        	
        	//등록 성공 메시지 세팅
     	model.addAttribute("saveYN", "Y");
        	model.addAttribute("message", egovMessageSource.getMessage("success.common.update"));
        	
        	return new ModelAndView("jsonView");
    	}
    	catch(Exception ex){
    		Log.error("updatePrj3000FileSnAjax()", ex);

    		//수정 실패 메시지 세팅 및 저장 성공여부 세팅
    		model.addAttribute("saveYN", "N");
    		model.addAttribute("message", egovMessageSource.getMessage("fail.common.update"));
    		return new ModelAndView("jsonView");
    	}
}
 
Example #18
Source File: QuickReplyController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/delete")
@Menu(type = "setting" , subtype = "quickreply" , admin= true)
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
	QuickReply quickReply = quickReplyRes.findOne(id) ;
	if(quickReply!=null){
		quickReplyRes.delete(quickReply);
	}
	return request(super.createRequestPageTempletResponse("redirect:/setting/quickreply/index.html?typeid="+quickReply.getCate()));
}
 
Example #19
Source File: SimpleServletHandlerAdapter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws Exception {

	((Servlet) handler).service(request, response);
	return null;
}
 
Example #20
Source File: PassParametersControllerIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void testPassParametersWithModelAndView() throws Exception {
    ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/goToViewPage")).andReturn().getModelAndView();

    //Validate view
    Assert.assertEquals(mv.getViewName(), "viewPage");

    //Validate attribute
    Assert.assertEquals(mv.getModelMap().get("message").toString(), "Baeldung");
}
 
Example #21
Source File: AnnotationAjaxController.java    From webcurator with Apache License 2.0 5 votes vote down vote up
private ModelAndView processTargetRequest(HttpServletRequest request, HttpServletResponse response, Object aCmd, BindException aErrors)
		throws Exception {
	Long targetOid = new Long(request.getParameter("targetOid"));
	Target target = targetManager.load(targetOid, true);
	// the annotations are not recovered by hibernate during the target fetch so we need to add them
	target.setAnnotations(targetManager.getAnnotations(target));
	ModelAndView mav = new ModelAndView(Constants.VIEW_TARGET_ANNOTATION_HISTORY);
	mav.addObject(TargetInstanceCommand.TYPE_TARGET, target);
	return mav;
}
 
Example #22
Source File: OAuth20AuthorizeControllerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test
public void testOKWithState() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", CONTEXT
            + OAuthConstants.AUTHORIZE_URL);
    mockRequest.setParameter(OAuthConstants.CLIENT_ID, CLIENT_ID);
    mockRequest.setParameter(OAuthConstants.REDIRECT_URI, REDIRECT_URI);
    mockRequest.setParameter(OAuthConstants.STATE, STATE);
    mockRequest.setServerName(CAS_SERVER);
    mockRequest.setServerPort(CAS_PORT);
    mockRequest.setScheme(CAS_SCHEME);
    final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
    final ServicesManager servicesManager = mock(ServicesManager.class);
    final List<RegisteredService> services = new ArrayList<RegisteredService>();
    services.add(getRegisteredService(REDIRECT_URI, SERVICE_NAME));
    when(servicesManager.getAllServices()).thenReturn(services);
    final OAuth20WrapperController oauth20WrapperController = new OAuth20WrapperController();
    oauth20WrapperController.setLoginUrl(CAS_URL);
    oauth20WrapperController.setServicesManager(servicesManager);
    oauth20WrapperController.afterPropertiesSet();
    final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
    final HttpSession session = mockRequest.getSession();
    assertEquals(REDIRECT_URI, session.getAttribute(OAuthConstants.OAUTH20_CALLBACKURL));
    assertEquals(SERVICE_NAME, session.getAttribute(OAuthConstants.OAUTH20_SERVICE_NAME));
    assertEquals(STATE, session.getAttribute(OAuthConstants.OAUTH20_STATE));
    final View view = modelAndView.getView();
    assertTrue(view instanceof RedirectView);
    final RedirectView redirectView = (RedirectView) view;
    assertEquals(
            OAuthUtils.addParameter(CAS_URL, "service", CAS_URL + CONTEXT + OAuthConstants.CALLBACK_AUTHORIZE_URL),
            redirectView.getUrl());
}
 
Example #23
Source File: JeecgListDemoController.java    From jeecg with Apache License 2.0 5 votes vote down vote up
/**
 * jeecgDemo-bootstrap编辑页面跳转
 * 
 * @return
 */
@RequestMapping(params = "goBootStrapTableUpdate")
public ModelAndView goBootStrapTableUpdate(JeecgDemoEntity jeecgDemo, HttpServletRequest req) {
	if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
		jeecgDemo = jeecgDemoService.getEntity(JeecgDemoEntity.class, jeecgDemo.getId());
		req.setAttribute("jeecgDemoPage", jeecgDemo);
	}
	return new ModelAndView("com/jeecg/demo/jeecgDemo-bootstrap-update");
}
 
Example #24
Source File: ReportController.java    From mysql_perf_analyzer with Apache License 2.0 5 votes vote down vote up
private ModelAndView delete(HttpServletRequest req,
		HttpServletResponse resp) throws Exception
{
	int status = 0;
	String message = "OK";
	String fname = req.getParameter("file");//file name
	String id = req.getParameter("rpid");//report id
	ResultList rList = null;
	UserReportManager urm = this.getUserReportManager(req);
	try
	{
		//delete first, the  update the idx file, and re-list
		//get session
		String appUser = WebAppUtil.findUserFromRequest(req);
		if(appUser==null || urm==null)
		{
			status = -1;
			message="Not login or session timed out";
		}else
		{
			urm.deleteFile(fname, id);
			rList = urm.listResultList();
		}
	}catch(Exception ex)
	{
		logger.log(Level.SEVERE,"Exception", ex);
	}
	ModelAndView mv = new ModelAndView(this.jsonView);
	mv.addObject("json_result", ResultListUtil.toJSONString(rList, null, status, message));
	return mv;
}
 
Example #25
Source File: SysCrawlerRulerInfoController.java    From danyuan-application with Apache License 2.0 5 votes vote down vote up
@GetMapping("/detail/{uuid}")
public ModelAndView name(@PathVariable("uuid") String uuid) {
	ModelAndView modelAndView = new ModelAndView("crawler/param/syscrawlerrulerinfodetail");
	SysCrawlerRulerInfo info = new SysCrawlerRulerInfo();
	info.setUuid(uuid);
	modelAndView.addObject("sysCrawlerRulerInfo", sysCrawlerRulerInfoService.findOne(info));
	return modelAndView;
}
 
Example #26
Source File: UserController.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@PostMapping("/login")
public ModelAndView login(User user, HttpServletRequest request) {
	ModelAndView mv = new ModelAndView();

	mv.addObject(user);
	mv.setViewName("redirect:/");

	request.getSession().setAttribute("user", user);
	return mv;
}
 
Example #27
Source File: HelpAndFeedbackPageController.java    From BlogSystem with Apache License 2.0 5 votes vote down vote up
@RequestMapping("")
public ModelAndView page(HttpServletRequest request) {

    ModelAndView mv = new ModelAndView();
    mv.setViewName("blogger/help_feedback");

    return mv;
}
 
Example #28
Source File: EventsController.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@GetMapping("/my")
    public ModelAndView myEvents(@AuthenticationPrincipal UsernamePasswordAuthenticationToken upat) {
        CalendarUser currentUser = (CalendarUser)upat.getPrincipal();

        return myEvents(currentUser);
//        Integer currentUserId = currentUser.getId();
//        ModelAndView result = new ModelAndView("events/my", "events", calendarService.findForUser(currentUserId));
//        result.addObject("currentUser", currentUser);
//        return result;
    }
 
Example #29
Source File: KbsController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/type/save")
@Menu(type = "apps" , subtype = "kbs")
public ModelAndView typesave(HttpServletRequest request ,@Valid KbsType kbsType) {
	int count = kbsTypeRes.countByOrgiAndNameAndParentid(super.getOrgi(request), kbsType.getName(), kbsType.getParentid()) ;
	if(count == 0){
		kbsType.setOrgi(super.getOrgi(request));
		kbsType.setCreater(super.getUser(request).getId());
		kbsType.setCreatetime(new Date());
		kbsTypeRes.save(kbsType) ;
	}
	return request(super.createRequestPageTempletResponse("redirect:/apps/kbs/list.html"));
}
 
Example #30
Source File: AdminController.java    From TinyMooc with Apache License 2.0 5 votes vote down vote up
@RequestMapping("deletLevel.htm")
public ModelAndView deletLevel(HttpServletRequest req,
                               HttpServletResponse res) {
    String levelId = ServletRequestUtils.getStringParameter(req, "levelId", "");
    Level level = admin.findById(Level.class, levelId);
    admin.delete(level);
    return new ModelAndView("redirect:turnToLevelManage.htm");
}