org.springframework.web.bind.annotation.RequestMethod Java Examples
The following examples show how to use
org.springframework.web.bind.annotation.RequestMethod.
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: MonitoringController.java From lams with GNU General Public License v2.0 | 6 votes |
@RequestMapping(path = "/appointScribe", method = RequestMethod.POST) public String appointScribe(@ModelAttribute("monitoringForm") MonitoringForm monitoringForm, HttpServletRequest request) { ScribeSession session = scribeService.getSessionBySessionId(monitoringForm.getToolSessionID()); ScribeUser user = scribeService.getUserByUID(monitoringForm.getAppointedScribeUID()); session.setAppointedScribe(user); scribeService.saveOrUpdateScribeSession(session); ScribeDTO scribeDTO = setupScribeDTO(session.getScribe()); boolean isGroupedActivity = scribeService.isGroupedActivity(session.getScribe().getToolContentId()); request.setAttribute("isGroupedActivity", isGroupedActivity); request.setAttribute("monitoringDTO", scribeDTO); request.setAttribute("contentFolderID", monitoringForm.getContentFolderID()); monitoringForm.setCurrentTab(WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true)); return "pages/monitoring/monitoring"; }
Example #2
Source File: AuthenticationRestController.java From tour-of-heros-api-security-zerhusen with MIT License | 6 votes |
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST) public ResponseEntity<?> createAuthenticationToken(@RequestBody JwtAuthenticationRequest authenticationRequest, Device device) throws AuthenticationException { // Perform the security final Authentication authentication = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken( authenticationRequest.getUsername(), authenticationRequest.getPassword() ) ); SecurityContextHolder.getContext().setAuthentication(authentication); // Reload password post-security so we can generate token final UserDetails userDetails = userDetailsService.loadUserByUsername(authenticationRequest.getUsername()); final String token = jwtTokenUtil.generateToken(userDetails, device); // Return the token return ResponseEntity.ok(new JwtAuthenticationResponse(token)); }
Example #3
Source File: UserController.java From cf-SpringBootTrader with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/registration", method = RequestMethod.POST) public String register(Model model, @ModelAttribute(value="account") Account account) { logger.info("register: user:" + account.getUserid()); //need to set some stuff on account... account.setOpenbalance(account.getBalance()); account.setCreationdate(new Date()); AuthenticationRequest login = new AuthenticationRequest(); login.setUsername(account.getUserid()); model.addAttribute("login", login); model.addAttribute("marketSummary", summaryService.getMarketSummary()); accountService.createAccount(account); return "index"; }
Example #4
Source File: RoleAdminController.java From Roothub with GNU Affero General Public License v3.0 | 6 votes |
@RequestMapping(value = "/save", method = RequestMethod.POST) @Override public ModelAndView save(RoleVO roleVO, HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); String roleName = roleVO.getRoleName(); if (StringUtils.isEmpty(roleName)) { mv.setViewName(this.getJspPrefix() + "/add"); mv.addObject("error", "角色名称不能为空"); return mv; } QueryWrapper<Role> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("role_name", roleVO.getRoleName()); RoleDTO roleDTO = this.roleService.getOne(queryWrapper); if (roleDTO != null) { mv.setViewName(this.getJspPrefix() + "/add"); mv.addObject("error", "角色名称已存在"); return mv; } roleVO.setCreateDate(DateUtils.formatDateTime(new Date())); mv = super.save(roleVO, request, response); mv.setViewName(redirect(request, "/admin/role/list")); return mv; }
Example #5
Source File: UserController.java From springboot-security-wechat with Apache License 2.0 | 6 votes |
@RequestMapping(method = {RequestMethod.POST}, value = "/wechatJoin") @ResponseBody public Response wechatJoin(@RequestParam(value = "name") String name, @RequestParam(value = "phone") String phone, @RequestParam(value = "vCode") String vCode, @RequestParam(value = "password") String password, HttpServletRequest request) { UserResponse userResponse = null; try { User user = userService.wechatJoin(name, phone, vCode, password, getUser()); user.setPassword(""); userResponse = userService.getUserInfo(user); } catch (Exception e) { return errorResponse("绑定失败", e.toString()); } return successResponse("绑定成功", userResponse); }
Example #6
Source File: SysConfigController.java From batch-scheduler with MIT License | 6 votes |
@ApiOperation(value = "更新系统参数", notes = "更新结果只对当前操作的域有效") @ApiImplicitParams({ @ApiImplicitParam(required = true, name = "domain_id", value = "域编码"), @ApiImplicitParam(required = true, name = "config_id", value = "参数编码"), @ApiImplicitParam(required = true, name = "config_value", value = "参数值"), }) @RequestMapping(value = "/v1/dispatch/config/user", method = RequestMethod.POST) public String updateConfigValue(HttpServletResponse response, HttpServletRequest request) { String domainId = request.getParameter("domain_id"); String configId = request.getParameter("config_id"); String configValue = request.getParameter("config_value"); int size = sysConfigService.setValue(domainId, configId, configValue); if (size != 1) { response.setStatus(421); return Hret.error(421, "更新ETL调度系统核心参数失败", null); } return Hret.success(200, "success", null); }
Example #7
Source File: QywxMenuController.java From jeewx with Apache License 2.0 | 6 votes |
/** * 删除 * @return */ @RequestMapping(params="doDelete",method = RequestMethod.GET) @ResponseBody public AjaxJson doDelete(@RequestParam(required = true, value = "id" ) String id){ AjaxJson j = new AjaxJson(); try { QywxMenu qywxMenu = new QywxMenu(); qywxMenu.setId(id); qywxMenuDao.delete(qywxMenu); j.setMsg("删除成功"); } catch (Exception e) { log.info(e.getMessage()); j.setSuccess(false); j.setMsg("删除失败"); } return j; }
Example #8
Source File: BrownFieldSiteController.java From Microservices-Building-Scalable-Software with MIT License | 6 votes |
@RequestMapping(value="/confirm", method=RequestMethod.POST) public String ConfirmBooking(@ModelAttribute UIData uiData, Model model) { Flight flight= uiData.getSelectedFlight(); BookingRecord booking = new BookingRecord(flight.getFlightNumber(),flight.getOrigin(), flight.getDestination(), flight.getFlightDate(),null, flight.getFares().getFare()); Set<Passenger> passengers = new HashSet<Passenger>(); Passenger pax = uiData.getPassenger(); pax.setBookingRecord(booking); passengers.add(uiData.getPassenger()); booking.setPassengers(passengers); long bookingId =0; try { //long bookingId = bookingClient.postForObject("http://book-service/booking/create", booking, long.class); bookingId = bookingClient.postForObject("http://book-apigateway/api/booking/create", booking, long.class); logger.info("Booking created "+ bookingId); }catch (Exception e){ logger.error("BOOKING SERVICE NOT AVAILABLE...!!!"); } model.addAttribute("message", "Your Booking is confirmed. Reference Number is "+ bookingId); return "confirm"; }
Example #9
Source File: ApplicationViewController.java From abixen-platform with GNU Lesser General Public License v2.1 | 6 votes |
@RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView renderApplicationPage() { log.debug("renderApplicationPage()"); final List<ModuleType> moduleTypes = moduleTypeHystrixClient.getAllModuleTypes(); final Set<Resource> resources = new HashSet<>(); moduleTypes.forEach(moduleType -> { resources.addAll(moduleType.getResources()); }); resources.forEach(resource -> log.debug("resource: {}", resource)); List<Resource> uniqueResources = resources.stream().filter(distinctByKey(resource -> resource.getRelativeUrl())).collect(Collectors.toList()); List<String> angularJsModules = moduleTypes.stream().filter(moduleType -> moduleType.getAngularJsNameApplication() != null).filter(distinctByKey(moduleType -> moduleType.getAngularJsNameApplication())).map(moduleType -> moduleType.getAngularJsNameApplication()).collect(Collectors.toList()); angularJsModules.forEach(angularJsModule -> log.debug(angularJsModule)); ModelAndView modelAndView = new ModelAndView("application/index"); modelAndView.addObject("resources", uniqueResources); modelAndView.addObject("angularJsModules", angularJsModules); return modelAndView; }
Example #10
Source File: CommentController.java From Blog-System with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/api/comment/add", method = RequestMethod.POST) public @ResponseBody Object commentAdd(HttpServletRequest request) { Comment comment=new Comment(); comment.setArticleId(Long.parseLong(request.getParameter("articleId"))); comment.setContent(request.getParameter("content")); comment.setDate(new Date()); comment.setName(request.getParameter("name")); comment.setEmail(request.getParameter("email")); HashMap<String, String> res = new HashMap<String, String>(); if(commentService.insertComment(comment)>0){ res.put("stateCode", "1"); }else { res.put("stateCode", "0"); } return res; }
Example #11
Source File: OutcomeController.java From lams with GNU General Public License v2.0 | 6 votes |
@RequestMapping(path = "/outcomeRemoveMapping", method = RequestMethod.POST) public void outcomeRemoveMapping(HttpServletRequest request, HttpServletResponse response) throws Exception { Long mappingId = WebUtil.readLongParam(request, "mappingId"); OutcomeMapping outcomeMapping = (OutcomeMapping) userManagementService.findById(OutcomeMapping.class, mappingId); Organisation organisation = outcomeMapping.getOutcome().getOrganisation(); Integer organisationId = organisation == null ? null : organisation.getOrganisationId(); Integer userId = getUserDTO().getUserID(); if (organisationId == null) { if (!request.isUserInRole(Role.SYSADMIN) && !request.isUserInRole(Role.AUTHOR)) { String error = "User " + userId + " is not sysadmin nor an author and can not remove an outcome mapping"; log.error(error); throw new SecurityException(error); } } else { securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "remove outcome mapping", true); } userManagementService.delete(outcomeMapping); if (log.isDebugEnabled()) { log.debug("Deleted outcome mapping " + outcomeMapping); } }
Example #12
Source File: StepApiController.java From onboard with Apache License 2.0 | 6 votes |
@RequestMapping(value = "", method = RequestMethod.POST) @Interceptors({ ProjectMemberRequired.class }) @ResponseBody @Caching(evict = { @CacheEvict(value = IterationApiController.ITERATION_CACHE_NAME, key = "#projectId + '*'"), @CacheEvict(value = IterationApiController.ITERATIONS_CACHE_NAME, key = "#projectId + '*'"), @CacheEvict(value = StoryApiController.GET_STORIES_CACHE, key = "#projectId + '*'") }) public StepDTO newStep(@RequestBody Step step, @PathVariable int projectId) { step.setCreatorId(sessionService.getCurrentUser().getId()); step.setCreatorName(sessionService.getCurrentUser().getName()); step.setStatus(IterationItemStatus.TODO.getValue()); step = stepService.create(step); if (step.getAssigneeId() != null) { step.setAssignee(userService.getById(step.getAssigneeId())); } return StepTransform.stepToStepDTO(step); }
Example #13
Source File: SystemPermissionController.java From mumu with Apache License 2.0 | 6 votes |
/** * 添加权限 * @return */ @ResponseBody @RequiresPermissions("system:permission:add") @MumuLog(name = "添加权限",operater = "POST") @RequestMapping(value="/add",method=RequestMethod.POST) public ResponseEntity savePermission(SysPermission permission, HttpServletRequest request){ //获取权限内码和权限名称下面的权限列表 List<SysPermission> permissions = permissionService.querySysPermissionByCondition(null, permission.getPermissionCode(), permission.getPermissionName(), PublicEnum.NORMAL.value()); if(permissions!=null&&permissions.size()>0){ return new ResponseEntity(500, "权限内码、权限名称不可重复", null); } try { permission.setCreator(SecurityUtils.getSubject().getPrincipal().toString()); permissionService.addPermission(permission); } catch (Exception e) { log.error(e); return new ResponseEntity(500,"保存权限内码出现异常",null); } return new ResponseEntity(200, "保存权限操作成功", null); }
Example #14
Source File: AppAdminController.java From jeesuite-config with Apache License 2.0 | 6 votes |
@RequestMapping(value = "add", method = RequestMethod.POST) public ResponseEntity<WrapperResponseEntity> addApp(@RequestBody AddOrEditAppRequest addAppRequest){ SecurityUtil.requireSuperAdmin(); if(addAppRequest.getMasterUid() == null || addAppRequest.getMasterUid() == 0){ throw new JeesuiteBaseException(1002, "请选择项目负责人"); } if(appMapper.findByName(addAppRequest.getName()) != null){ throw new JeesuiteBaseException(1002, "应用["+addAppRequest.getName()+"]已存在"); } AppEntity appEntity = BeanUtils.copy(addAppRequest, AppEntity.class); // UserEntity master = userMapper.selectByPrimaryKey(addAppRequest.getMasterUid()); appEntity.setMaster(master.getName()); appMapper.insertSelective(appEntity); return new ResponseEntity<WrapperResponseEntity>(new WrapperResponseEntity(true),HttpStatus.OK); }
Example #15
Source File: MenuController.java From Mario with Apache License 2.0 | 6 votes |
@RequiresRoles("admin") @RequestMapping(value = "create", method = RequestMethod.POST) public String create(@Valid Menu menu, BindingResult result, Model model, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { Menu topMenu = accountService.getTopMenu(); menu.setParent(topMenu); model.addAttribute("menu", menu); model.addAttribute("allShows", allShows); model.addAttribute("action", "create"); return "account/menuForm"; } generateMenuParentIds(menu); accountService.saveMenu(menu); redirectAttributes.addFlashAttribute("message", "创建菜单成功"); return "redirect:/account/menu"; }
Example #16
Source File: LoginController.java From single-sign-on-out-auth-jwt-cookie-redis-springboot-freemarker with MIT License | 5 votes |
@RequestMapping(value = "login", method = RequestMethod.POST) public String login(HttpServletResponse httpServletResponse, String username, String password, String redirect, Model model){ if (username == null || !credentials.containsKey(username) || !credentials.get(username).equals(password)){ model.addAttribute("error", "Invalid username or password!"); return "login"; } String token = JwtUtil.generateToken(signingKey, username); CookieUtil.create(httpServletResponse, jwtTokenCookieName, token, false, -1, "localhost"); return "redirect:" + redirect; }
Example #17
Source File: AdminLoginController.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@RequestMapping(method=RequestMethod.GET) public String initForm(Model model, HttpServletRequest req){ LoginForm adminLoginForm = new LoginForm(); model.addAttribute("adminLoginForm", adminLoginForm); return "admin_login_form"; }
Example #18
Source File: BrownFieldSiteController.java From Microservices-Building-Scalable-Software with MIT License | 5 votes |
@RequestMapping(value="/search-booking", method=RequestMethod.GET) public String searchBookingForm(Model model) { UIData uiData = new UIData(); uiData.setBookingid("5"); model.addAttribute("uidata",uiData ); return "bookingsearch"; }
Example #19
Source File: RestUsers.java From NFVO with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Retrieve the current User", notes = "Returns the user currently accessing") @RequestMapping(value = "current", method = RequestMethod.GET) public User findCurrentUser() throws NotFoundException { User user = userManagement.getCurrentUser(); log.trace("Found User: " + user); return user; }
Example #20
Source File: TemperatureController.java From Hands-On-Reactive-Programming-in-Spring-5 with MIT License | 5 votes |
@RequestMapping(value = "/temperature-stream", method = RequestMethod.GET) public SseEmitter events(HttpServletRequest request) { log.info("SSE stream opened for client: " + request.getRemoteAddr()); SseEmitter emitter = new SseEmitter(SSE_SESSION_TIMEOUT); clients.add(emitter); // Remove SseEmitter from active clients on error or client disconnect emitter.onTimeout(() -> clients.remove(emitter)); emitter.onCompletion(() -> clients.remove(emitter)); return emitter; }
Example #21
Source File: AgentRegistrationController.java From gocd with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/admin/latest-agent.status", method = {RequestMethod.HEAD, RequestMethod.GET}) public void checkAgentStatus(HttpServletResponse response) { LOG.debug("Processing '/admin/latest-agent.status' request with values [{}:{}], [{}:{}], [{}:{}], [{}:{}]", SystemEnvironment.AGENT_CONTENT_MD5_HEADER, agentChecksum, SystemEnvironment.AGENT_LAUNCHER_CONTENT_MD5_HEADER, agentLauncherChecksum, SystemEnvironment.AGENT_PLUGINS_ZIP_MD5_HEADER, pluginsZip.md5(), SystemEnvironment.AGENT_TFS_SDK_MD5_HEADER, tfsSdkChecksum); response.setHeader(SystemEnvironment.AGENT_CONTENT_MD5_HEADER, agentChecksum); response.setHeader(SystemEnvironment.AGENT_LAUNCHER_CONTENT_MD5_HEADER, agentLauncherChecksum); response.setHeader(SystemEnvironment.AGENT_PLUGINS_ZIP_MD5_HEADER, pluginsZip.md5()); response.setHeader(SystemEnvironment.AGENT_TFS_SDK_MD5_HEADER, tfsSdkChecksum); response.setHeader(SystemEnvironment.AGENT_EXTRA_PROPERTIES_HEADER, getAgentExtraProperties()); setOtherHeaders(response); }
Example #22
Source File: StreamingV2Controller.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/cubes/{cubeName}/resumeConsume", method = { RequestMethod.PUT }) @ResponseBody public void resumeCubeConsume(@PathVariable String cubeName) { final String user = SecurityContextHolder.getContext().getAuthentication().getName(); logger.info("{} try to resume Consumers for cube {}", user, cubeName); CubeInstance cube = cubeMgmtService.getCubeManager().getCube(cubeName); streamingService.resumeConsumers(cube); }
Example #23
Source File: StatsApiController.java From onboard with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/activities", method = RequestMethod.GET) @Interceptors({ CompanyMemberRequired.class }) @ResponseBody public List<ActivityDTO> getCompanyActivityStats(@PathVariable int companyId, @RequestParam(value = "start") long start, @RequestParam(value = "end") long end) { Date since = new Date(start); Date until = new Date(end); List<Activity> activities = activityService.getActivitiesByCompanyAndDates(companyId, since, until); return Lists.transform(activities, ActivityTransForm.ACTIVITY_TO_ACTIVITYDTO_FUNCTION); }
Example #24
Source File: WebController.java From vpn-over-dns with BSD 3-Clause "New" or "Revised" License | 5 votes |
@RequestMapping(value = "/create-user", method = RequestMethod.POST) public ModelAndView createUserPost( @RequestParam(value = "username", required = false) final String username, @RequestParam(value = "password", required = false) final String password, final ModelMap model) throws GeneralException { log.info("TRACE: createuser;post;" + username + ";" + password + ";"); generalServices.createUser(username, password); log.info("TRACE: createuser;done;" + username + ";" + password + ";"); ModelAndView mav = new ModelAndView("redirect:admin", model); //mav.setViewName("forward:admin"); // est traité en interne, l'URL côté browser ne change pas => pour que l'URL change, il faut utiliser redirect return mav; }
Example #25
Source File: SynchronizationController.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@PreAuthorize( "hasRole('ALL')" ) @RequestMapping( value = "/metadataPull", method = RequestMethod.POST ) public void importMetaData( @RequestBody String url, HttpServletResponse response ) throws IOException { ImportReport importReport = synchronizationManager.executeMetadataPull( url ); response.setContentType( CONTENT_TYPE_JSON ); renderService.toJson( response.getOutputStream(), importReport ); }
Example #26
Source File: ValidateCodeFilter.java From Taroco with Apache License 2.0 | 5 votes |
/** * 是否校验验证码 * 1. 判断验证码开关是否开启 * 2. 判断请求是否登录请求 * 3. 判断终端是否支持 * * @return true/false */ @Override public boolean shouldFilter() { final HttpServletRequest request = RequestContext.getCurrentContext().getRequest(); if (RequestMethod.OPTIONS.toString().equalsIgnoreCase(request.getMethod())) { return false; } // 对指定的请求方法 进行验证码的校验 return StrUtil.containsAnyIgnoreCase(request.getRequestURI(), SecurityConstants.OAUTH_TOKEN_URL); }
Example #27
Source File: InterfaceCaseController.java From ATest with GNU General Public License v3.0 | 5 votes |
/** * 删除接口用例 */ @RequestMapping(value = "/toDelInterfaceCase", method = RequestMethod.POST) @ResponseBody public Boolean toDelInterfaceCase(Integer[] ids) { List<Integer> idList = Arrays.asList(ids); return interfaceCaseService.DeleteTestCases(idList); }
Example #28
Source File: QueryController.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
/** * * @param runTimeMoreThan in seconds * @return */ @RequestMapping(value = "/query/runningQueries", method = RequestMethod.GET) @ResponseBody public TreeSet<QueryContext> getRunningQueries( @RequestParam(value = "runTimeMoreThan", required = false, defaultValue = "-1") int runTimeMoreThan) { if (runTimeMoreThan == -1) { return QueryContextFacade.getAllRunningQueries(); } else { return QueryContextFacade.getLongRunningQueries(runTimeMoreThan * 1000L); } }
Example #29
Source File: NginxController.java From Jpom with MIT License | 5 votes |
@RequestMapping(value = "updateNgx", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody @OptLog(UserOperateLogV1.OptType.SaveNginx) @Feature(method = MethodFeature.EDIT) public String updateNgx() { return NodeForward.request(getNode(), getRequest(), NodeUrl.System_Nginx_updateNgx).toString(); }
Example #30
Source File: DataDictionaryListController.java From roncoo-adminlte-springmvc with Apache License 2.0 | 5 votes |
/** * 编辑 * * @param id * @param dId * @param modelMap */ @RequestMapping(value = EDIT, method = RequestMethod.GET) public void edit(@RequestParam(value = "id", defaultValue = "-1") Long id, @RequestParam(value = "dId") Long dId, ModelMap modelMap) { Result<RcDataDictionaryList> result = biz.query(id); modelMap.put("id", dId); if (result.isStatus()) { modelMap.put("dictionaryList", result.getResultData()); } }