org.springframework.web.bind.annotation.GetMapping Java Examples
The following examples show how to use
org.springframework.web.bind.annotation.GetMapping.
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: WingtipsSpringWebfluxComponentTest.java From wingtips with Apache License 2.0 | 6 votes |
@GetMapping(FLUX_ENDPOINT_PATH) @ResponseBody Flux<String> fluxEndpoint(ServerHttpRequest request) { HttpHeaders headers = request.getHeaders(); if ("true".equals(headers.getFirst("throw-exception"))) { sleepThread(SLEEP_TIME_MILLIS); throw new RuntimeException("Error thrown in fluxEndpoint(), outside Flux"); } if ("true".equals(headers.getFirst("return-exception-in-flux"))) { return Flux.just("foo") .delayElements(Duration.ofMillis(SLEEP_TIME_MILLIS)) .map(d -> { throw new RuntimeException("Error thrown in fluxEndpoint(), inside Flux"); }); } long delayPerElementMillis = SLEEP_TIME_MILLIS / FLUX_ENDPOINT_PAYLOAD.size(); return Flux.fromIterable(FLUX_ENDPOINT_PAYLOAD).delayElements(Duration.ofMillis(delayPerElementMillis)); }
Example #2
Source File: HutoolController.java From mall-learning with Apache License 2.0 | 6 votes |
@ApiOperation("CollUtil使用:集合工具类") @GetMapping("/collUtil") public CommonResult collUtil() { //数组转换为列表 String[] array = new String[]{"a", "b", "c", "d", "e"}; List<String> list = CollUtil.newArrayList(array); //join:数组转字符串时添加连接符号 String joinStr = CollUtil.join(list, ","); LOGGER.info("collUtil join:{}", joinStr); //将以连接符号分隔的字符串再转换为列表 List<String> splitList = StrUtil.split(joinStr, ','); LOGGER.info("collUtil split:{}", splitList); //创建新的Map、Set、List HashMap<Object, Object> newMap = CollUtil.newHashMap(); HashSet<Object> newHashSet = CollUtil.newHashSet(); ArrayList<Object> newList = CollUtil.newArrayList(); //判断列表是否为空 CollUtil.isEmpty(list); CollUtil.isNotEmpty(list); return CommonResult.success(null, "操作成功"); }
Example #3
Source File: SleuthController.java From tutorials with MIT License | 6 votes |
@GetMapping("/new-thread") public String helloSleuthNewThread() { logger.info("New Thread"); Runnable runnable = () -> { try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } logger.info("I'm inside the new thread - with a new span"); }; executor.execute(runnable); logger.info("I'm done - with the original span"); return "success"; }
Example #4
Source File: QueueController.java From foremast with Apache License 2.0 | 6 votes |
@GetMapping("/load") public String load(@RequestParam("latency") float latency, @RequestParam("errorRate") float errorRate, HttpServletResponse response) throws IOException { float error = errorRate * 100; if (error > 0.1) { int r = random.nextInt(1000); if (r < error * 10) { response.sendError(501, "Internal error"); return "Error"; } } if (latency <= 0) { latency = 10; } try { Thread.sleep((int)latency); } catch(Exception ex) { } return "OK"; }
Example #5
Source File: UserController.java From spring-boot-study with MIT License | 6 votes |
@GetMapping("/test") public String testCache(){ System.out.println("============以下第一次调用 ================"); userService.list(); userService.get(1); userService.save(new UserDO(1,"fishpro","123456",1)); userService.update(new UserDO(1,"fishpro","123456434",1)); System.out.println("============以下第二次调用 观察 list 和 get 方法 ================"); userService.list(); userService.get(1); userService.save(new UserDO(1,"fishpro","123456",1)); userService.update(new UserDO(1,"fishpro","123456434",1)); System.out.println("============以下第三次调用 先删除 观察 list 和 get 方法 ================"); userService.delete(1); userService.list(); userService.get(1); userService.save(new UserDO(1,"fishpro","123456",1)); userService.update(new UserDO(1,"fishpro","123456434",1)); return ""; }
Example #6
Source File: FileSystemContorller.java From springboot-plus with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GetMapping(MODEL + "/download/{fileId}/{batchFileUUID}/{name}") public ModelAndView download(HttpServletResponse response,@PathVariable Long fileId,@PathVariable String batchFileUUID ) throws IOException { FileItem item = fileService.getFileItemById(fileId,batchFileUUID); response.setHeader("Content-Disposition", "attachment; filename="+item.getName()); item.copy(response.getOutputStream()); return null; }
Example #7
Source File: CommitController.java From apollo with Apache License 2.0 | 5 votes |
@GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits") public List<CommitDTO> find(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @Valid @PositiveOrZero(message = "page should be positive or 0") @RequestParam(defaultValue = "0") int page, @Valid @Positive(message = "size should be positive number") @RequestParam(defaultValue = "10") int size) { if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) { return Collections.emptyList(); } return commitService.find(appId, Env.valueOf(env), clusterName, namespaceName, page, size); }
Example #8
Source File: SampleController.java From wingtips with Apache License 2.0 | 5 votes |
@GetMapping(path = ASYNC_ERROR_PATH) @SuppressWarnings("unused") public DeferredResult<String> getAsyncError() { logger.info("Async error endpoint hit"); sleepThread(SLEEP_TIME_MILLIS); DeferredResult<String> deferredResult = new DeferredResult<>(); deferredResult.setErrorResult(new RuntimeException("Intentional exception by asyncError endpoint")); return deferredResult; }
Example #9
Source File: UserController.java From LuckyFrameWeb with GNU Affero General Public License v3.0 | 5 votes |
/** * 修改用户 */ @GetMapping("/edit/{userId}") public String edit(@PathVariable("userId") Long userId, ModelMap mmap) { mmap.put("user", userService.selectUserById(userId)); mmap.put("roles", roleService.selectRolesByUserId(userId)); mmap.put("posts", postService.selectPostsByUserId(userId)); mmap.put("projects", projectService.selectProjectAll(0)); return "system/user/edit"; }
Example #10
Source File: LocaleController.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GetMapping( value = "/ui" ) public @ResponseBody List<WebLocale> getUiLocales( Model model ) { List<Locale> locales = localeManager.getAvailableLocales(); List<WebLocale> webLocales = locales.stream().map( WebLocale::fromLocale ).collect( Collectors.toList() ); return webLocales; }
Example #11
Source File: DataProcessController.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
/** * 获取设备组的压力概览 * * @return 返回消息对象 */ @GetMapping("/pressure") public ResMsg getDeviceGroupPressure() { logger.info("/server/dataprocess/devicegroup/pressure"); GroupCacheItem item = null; item = GroupCacheItem.randomInstance(); item.setAlarmLimit(100, 500); return new ResMsg(item); }
Example #12
Source File: OrderController.java From soul with Apache License 2.0 | 5 votes |
/** * Find by id order dto. * * @param id the id * @return the order dto */ @GetMapping("/findById") @SoulSpringCloudClient(path = "/findById") public OrderDTO findById(@RequestParam("id") final String id) { OrderDTO orderDTO = new OrderDTO(); orderDTO.setId(id); orderDTO.setName("hello world spring cloud findById"); return orderDTO; }
Example #13
Source File: DiscountController.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
@GetMapping public String displayDiscountCodes(Model model) { Map<String, Integer> codes = discountProps.getCodes(); model.addAttribute("codes", codes); return "discountList"; }
Example #14
Source File: FileUploadController.java From spring-guides with Apache License 2.0 | 5 votes |
@GetMapping("/") public String listUploadedFiles(Model model) throws IOException { model.addAttribute("files", storageService.loadAll().map( path -> MvcUriComponentsBuilder.fromMethodName(FileUploadController.class, "serveFile", path.getFileName().toString()).build().toString()) .collect(Collectors.toList())); return "uploadForm"; }
Example #15
Source File: AdminController.java From scoold with Apache License 2.0 | 5 votes |
@GetMapping public String get(HttpServletRequest req, Model model) { if (!utils.isAuthenticated(req) || !utils.isAdmin(utils.getAuthUser(req))) { return "redirect:" + ADMINLINK; } Map<String, Object> configMap = new LinkedHashMap<String, Object>(); for (Map.Entry<String, ConfigValue> entry : Config.getConfig().entrySet()) { ConfigValue value = entry.getValue(); configMap.put(entry.getKey(), value != null ? value.unwrapped() : "-"); } configMap.putAll(System.getenv()); Pager itemcount = utils.getPager("page", req); Pager itemcount1 = utils.getPager("page1", req); itemcount.setLimit(40); model.addAttribute("path", "admin.vm"); model.addAttribute("title", utils.getLang(req).get("administration.title")); model.addAttribute("configMap", configMap); model.addAttribute("version", pc.getServerVersion()); model.addAttribute("endpoint", pc.getEndpoint()); model.addAttribute("paraapp", Config.getConfigParam("access_key", "x")); model.addAttribute("spaces", pc.findQuery("scooldspace", "*", itemcount)); model.addAttribute("webhooks", pc.findQuery(Utils.type(Webhook.class), "*", itemcount1)); model.addAttribute("scooldimports", pc.findQuery("scooldimport", "*", new Pager(7))); model.addAttribute("coreScooldTypes", utils.getCoreScooldTypes()); model.addAttribute("customHookEvents", utils.getCustomHookEvents()); model.addAttribute("apiKeys", utils.getApiKeys()); model.addAttribute("apiKeysExpirations", utils.getApiKeysExpirations()); model.addAttribute("itemcount", itemcount); model.addAttribute("itemcount1", itemcount1); model.addAttribute("isDefaultSpacePublic", utils.isDefaultSpacePublic()); model.addAttribute("scooldVersion", Optional.ofNullable(scooldVersion).orElse("unknown")); Sysprop theme = utils.getCustomTheme(); String themeCSS = (String) theme.getProperty("theme"); model.addAttribute("selectedTheme", theme.getName()); model.addAttribute("customTheme", StringUtils.isBlank(themeCSS) ? utils.getDefaultTheme() : themeCSS); return "base"; }
Example #16
Source File: SysJobController.java From supplierShop with MIT License | 5 votes |
@RequiresPermissions("monitor:job:detail") @GetMapping("/detail/{jobId}") public String detail(@PathVariable("jobId") Long jobId, ModelMap mmap) { mmap.put("name", "job"); mmap.put("job", jobService.selectJobById(jobId)); return prefix + "/detail"; }
Example #17
Source File: SysMenuController.java From scaffold-cloud with MIT License | 5 votes |
@GetMapping("/sysMenuEdit") public String SysMenuEdit(Model model, SysMenuAO sysMenu) { SysMenuResp sysMenuResp; if (null == sysMenu.getId()) { sysMenuResp = Builder.build(sysMenu, SysMenuResp.class); } else { ResponseModel<SysMenuBO> resp = sysMenuFeign.selectById(sysMenu.getId()); sysMenuResp = Builder.build(resp.getData(), SysMenuResp.class); } model.addAttribute("sysMenu", sysMenuResp); return ftlPath + "sysMenuEdit"; }
Example #18
Source File: CategoryController.java From mayday with GNU General Public License v3.0 | 5 votes |
/** * 跳转修改页面 * * @param model * @param categoryId * @return */ @GetMapping(value = "/edit") public String updateCategory(Model model, @RequestParam(value = "categoryId") int categoryId) { try { Category category = categoryService.findByCategoryId(categoryId); List<Category> categorys = categoryService.findCategory(); model.addAttribute("Categorys", categorys); model.addAttribute("category", category); } catch (Exception e) { log.error(e.getMessage()); } return "admin/admin_category"; }
Example #19
Source File: AdminStatController.java From mall with MIT License | 5 votes |
@RequiresPermissions("admin:stat:user") @RequiresPermissionsDesc(menu={"统计管理" , "用户统计"}, button="查询") @GetMapping("/user") public Object statUser() { List<Map> rows = statService.statUser(); String[] columns = new String[]{"day", "users"}; StatVo statVo = new StatVo(); statVo.setColumns(columns); statVo.setRows(rows); return ResponseUtil.ok(statVo); }
Example #20
Source File: InvestorController.java From Hands-On-RESTful-API-Design-Patterns-and-Best-Practices with MIT License | 5 votes |
@GetMapping("/investors/{investorId}") public Investor fetchInvestorById(@PathVariable String investorId) { Investor resultantInvestor = investorService.fetchInvestorById(investorId); if (resultantInvestor == null) { throw new InvestorNotFoundException("Investor Id-" + investorId); } return resultantInvestor; }
Example #21
Source File: PeopleController.java From scoold with Apache License 2.0 | 5 votes |
@GetMapping public String get(@RequestParam(required = false, defaultValue = Config._TIMESTAMP) String sortby, @RequestParam(required = false, defaultValue = "*") String q, HttpServletRequest req, Model model) { if (!utils.isDefaultSpacePublic() && !utils.isAuthenticated(req)) { return "redirect:" + SIGNINLINK + "?returnto=" + PEOPLELINK; } Profile authUser = utils.getAuthUser(req); Pager itemcount = utils.getPager("page", req); itemcount.setSortby(sortby); // [space query filter] + original query string String qs = utils.sanitizeQueryString(q, req); if (req.getParameter("bulkedit") != null && utils.isAdmin(authUser)) { qs = q; } else { qs = qs.replaceAll("properties\\.space:", "properties.spaces:"); } List<Profile> userlist = utils.getParaClient().findQuery(Utils.type(Profile.class), qs, itemcount); model.addAttribute("path", "people.vm"); model.addAttribute("title", utils.getLang(req).get("people.title")); model.addAttribute("peopleSelected", "navbtn-hover"); model.addAttribute("itemcount", itemcount); model.addAttribute("userlist", userlist); if (req.getParameter("bulkedit") != null && utils.isAdmin(authUser)) { List<ParaObject> spaces = utils.getParaClient().findQuery("scooldspace", "*", new Pager(Config.DEFAULT_LIMIT)); model.addAttribute("spaces", spaces); } return "base"; }
Example #22
Source File: InvestorController.java From Hands-On-RESTful-API-Design-Patterns-and-Best-Practices with MIT License | 5 votes |
@GetMapping("/investors/{investorId}") public Investor fetchInvestorById(@PathVariable String investorId) { Investor resultantInvestor = investorService.fetchInvestorById(investorId); if (resultantInvestor == null) { throw new InvestorNotFoundException("Investor Id-" + investorId); } return resultantInvestor; }
Example #23
Source File: AllianceController.java From retro-game with GNU Affero General Public License v3.0 | 5 votes |
@GetMapping("/alliance/manage/text") @PreAuthorize("hasPermission(#bodyId, 'ACCESS')") @Activity(bodies = "#bodyId") public String manageText(@RequestParam(name = "body") long bodyId, @RequestParam(name = "alliance") long allianceId, @RequestParam @NotNull AllianceTextKindDto kind, Model model) { model.addAttribute("bodyId", bodyId); model.addAttribute("allianceId", allianceId); model.addAttribute("kind", kind); String text = allianceService.getText(bodyId, allianceId, kind); model.addAttribute("text", text); return "alliance-manage-text"; }
Example #24
Source File: LetterRestController.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 5 votes |
@GetMapping("/templates") @ApiOperation("Available Email templates") public JSONLookupValuesList getTemplates() { return MADBoilerPlate.getAll(Env.getCtx()) .stream() .map(adBoilerPlate -> JSONLookupValue.of(adBoilerPlate.getAD_BoilerPlate_ID(), adBoilerPlate.getName())) .collect(JSONLookupValuesList.collect()); }
Example #25
Source File: BannerInfoController.java From api-boot with Apache License 2.0 | 5 votes |
/** * 查询全部轮播图 * * @return * @throws KnowledgeException */ @GetMapping(value = "/") @ApiOperation(value = "查询文章专题列表", response = ArticleTopicInfoDTO.class) @ApiResponse(code = 200, message = "查询成功", response = ArticleTopicInfoDTO.class) public ApiBootResult getAllBanner() throws KnowledgeException { return ApiBootResult.builder().data(bannerInfoService.selectAllBanner()).build(); }
Example #26
Source File: CoreCodeGenController.java From springboot-plus with BSD 3-Clause "New" or "Revised" License | 5 votes |
@GetMapping(MODEL + "/tableDetail.do") public ModelAndView tableDetail(String table) { ModelAndView view = new ModelAndView("/core/codeGen/edit.html"); Entity entity = codeGenService.getEntityInfo(table); view.addObject("entity", entity); return view; }
Example #27
Source File: DecisionTableClientResource.java From flowable-engine with Apache License 2.0 | 5 votes |
@GetMapping(value = "/rest/admin/decision-tables/{decisionTableId}", produces = "application/json") public JsonNode getDecisionTable(@PathVariable String decisionTableId) throws BadRequestException { ServerConfig serverConfig = retrieveServerConfig(EndpointType.DMN); try { return clientService.getDecisionTable(serverConfig, decisionTableId); } catch (FlowableServiceException e) { LOGGER.error("Error getting decision table {}", decisionTableId, e); throw new BadRequestException(e.getMessage()); } }
Example #28
Source File: DictController.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
@GetMapping(value = "/web/info/{id}") @ApiOperation(value = "获取字典-后端管理数据字典管理", notes = "获取字典-后端管理数据字典管理") public ApiResponse getDict(@ApiParam(value = "字典id",required = true)@PathVariable String id){ if(StringUtils.isBlank(id)){ return fail("id不能为空"); } DictVo dict = dictService.queryDictById(id); if (null == dict){ return fail("未查找到该字典"); }else{ return success(dict); } }
Example #29
Source File: RestControllerV2.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
/** * Retrieve an entity collection, optionally specify which attributes to include in the response. */ @Transactional(readOnly = true) @GetMapping("/{entityTypeId}") public EntityCollectionResponseV2 retrieveEntityCollection( @PathVariable("entityTypeId") String entityTypeId, @Valid EntityCollectionRequestV2 request, HttpServletRequest httpRequest, @RequestParam(value = "includeCategories", defaultValue = "false") boolean includeCategories) { ServletUriComponentsBuilder uriBuilder = createUriBuilder(); return createEntityCollectionResponse( uriBuilder, entityTypeId, request, httpRequest, includeCategories); }
Example #30
Source File: SysDictTypeController.java From RuoYi-Vue with MIT License | 5 votes |
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:dict:export')") @GetMapping("/export") public AjaxResult export(SysDictType dictType) { List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); return util.exportExcel(list, "字典类型"); }