org.springframework.web.bind.annotation.RequestMapping Java Examples
The following examples show how to use
org.springframework.web.bind.annotation.RequestMapping.
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: SysLogController.java From EasyEE with MIT License | 6 votes |
/** * 分页查询 * * @return * @throws Exception */ @SuppressWarnings("rawtypes") @RequestMapping("list") public Map<Object, Object> list(SysLogCriteria sysLogCriteria) throws Exception { String sort = ServletRequestUtils.getStringParameter(request, "sort", ""); String order = ServletRequestUtils.getStringParameter(request, "order", ""); if (!isNotNullAndEmpty(sort)) { sort = "logTime"; } if (!isNotNullAndEmpty(order)) { order = "desc"; } PageBean pb = super.getPageBean(); // 获得分页对象 pb.setSort(sort); pb.setSortOrder(order); sysLogService.findByPage(pb, sysLogCriteria); return super.setJsonPaginationMap(pb); }
Example #2
Source File: ApiController.java From kafka-webview with MIT License | 6 votes |
/** * POST list all consumer groups for a specific cluster. * This should require ADMIN role. */ @ResponseBody @RequestMapping(path = "/cluster/{id}/consumer/remove", method = RequestMethod.POST, produces = "application/json") public boolean removeConsumer( @PathVariable final Long id, @RequestBody final ConsumerRemoveRequest consumerRemoveRequest) { // Retrieve cluster final Cluster cluster = retrieveClusterById(consumerRemoveRequest.getClusterId()); try (final KafkaOperations operations = createOperationsClient(cluster)) { return operations.removeConsumerGroup(consumerRemoveRequest.getConsumerId()); } catch (final Exception exception) { throw new ApiException("ClusterNodes", exception); } }
Example #3
Source File: Log4JController.java From GreenSummer with GNU Lesser General Public License v2.1 | 6 votes |
/** * Reset. * * @return the response entity */ @RequestMapping(value = "reset", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET, headers = "Accept=application/json") @ResponseBody public ResponseEntity<LogResponse> reset() { final LoggerContext ctx = (LoggerContext) LogManager.getContext(false); synchronized (ctx) { // If the config location is null, it means we are using a non-standard path for // the config file (for example log4j2-spring.xml. In this case the name of the configuration // is usually the path to the configuration file. so we "fix" the path before reconfiguring if (ctx.getConfigLocation() == null) { ctx.setConfigLocation(Paths.get(ctx.getConfiguration().getName()).toUri()); } ctx.reconfigure(); initInMemoryAppender(); } return new ResponseEntity<>(listLoggers(ctx), HttpStatus.OK); }
Example #4
Source File: RegistrationController.java From website with GNU Affero General Public License v3.0 | 6 votes |
@RequestMapping(value = "/register", method = RequestMethod.POST) public String register(Model model, @Valid UserRegistration userRegistration, BindingResult result) { User user = userRegistration.getUser(); model.addAttribute("userRegistration", userRegistration); model.addAttribute("currencies", currencyService.getCurrencies()); model.addAttribute("countries", countryService.getCountries()); int captcha1 = (int)(Math.random() * ((9 - 0) + 1)); int captcha2 = (int)(Math.random() * ((9 - 0) + 1)); int captchaAnswer = captcha1 + captcha2; model.addAttribute("captcha1", captcha1); model.addAttribute("captcha2", captcha2); model.addAttribute("captchaAnswer", captchaAnswer); if (result.hasErrors()) { return "register"; } userRegistration.applyUserRoles(); saveUser(user, userRegistration.getCompany(), userRegistration.getAddress()); authenticationService.authenticateUser(user); emailGateway.userRegistration(user); model.addAttribute("user", user); return "registration/complete"; }
Example #5
Source File: LearningController.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Same as submitRankingHedging but doesn't update the records. * * @throws IOException * @throws ServletException * */ @RequestMapping("/nextPrev") @SuppressWarnings("unchecked") public String nextPrev(HttpServletRequest request, HttpSession session) throws IOException, ServletException { String sessionMapID = request.getParameter(PeerreviewConstants.ATTR_SESSION_MAP_ID); request.setAttribute(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMapID); SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) session.getAttribute(sessionMapID); ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); PeerreviewUser user = (PeerreviewUser) sessionMap.get(PeerreviewConstants.ATTR_USER); Long toolSessionId = (Long) sessionMap.get(PeerreviewConstants.PARAM_TOOL_SESSION_ID); Long criteriaId = WebUtil.readLongParam(request, "criteriaId"); RatingCriteria criteria = service.getCriteriaByCriteriaId(criteriaId); request.setAttribute(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); request.setAttribute(AttributeNames.ATTR_MODE, mode); request.setAttribute(PeerreviewConstants.PARAM_TOOL_SESSION_ID, toolSessionId); Boolean next = WebUtil.readBooleanParam(request, "next"); // goto standard screen return startRating(request, session, sessionMap, toolSessionId, user, mode, criteria, next); }
Example #6
Source File: PreparationAPI.java From data-prep with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/api/preparations/{preparationId}/unlock", method = PUT, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Mark a preparation as unlocked by a user.", notes = "Does not return any value, client may expect successful operation based on HTTP status code.") @Timed public void unlockPreparation(@PathVariable(value = "preparationId") @ApiParam(name = "preparationId", value = "Preparation id.") final String preparationId) { if (LOG.isDebugEnabled()) { LOG.debug("Locking preparation #{}...", preparationId); } final HystrixCommand<Void> command = getCommand(PreparationUnlock.class, preparationId); command.execute(); if (LOG.isDebugEnabled()) { LOG.debug("Locked preparation #{}...", preparationId); } }
Example #7
Source File: RequestTestController.java From spring-boot-projects with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/test2", method = RequestMethod.GET) public List<User> test2() { List<User> users = new ArrayList<>(); User user1 = new User(); user1.setId(1); user1.setName("十一"); user1.setPassword("12121"); User user2 = new User(); user2.setId(2); user2.setName("十二"); user2.setPassword("21212"); User user3 = new User(); user3.setId(3); user3.setName("十三"); user3.setPassword("31313"); users.add(user1); users.add(user2); users.add(user3); return users; }
Example #8
Source File: CommonsSpiderPanel.java From Gather-Platform with GNU General Public License v3.0 | 6 votes |
/** * 所有的抓取任务列表 * * @return */ @RequestMapping(value = "tasks", method = RequestMethod.GET) public ModelAndView tasks(@RequestParam(required = false, defaultValue = "false") boolean showRunning) { ModelAndView modelAndView = new ModelAndView("panel/commons/listTasks"); ResultListBundle<Task> listBundle; if (!showRunning) { listBundle = commonsSpiderService.getTaskList(true); } else { listBundle = commonsSpiderService.getTasksFilterByState(State.RUNNING, true); } ResultBundle<Long> runningTaskCount = commonsSpiderService.countByState(State.RUNNING); modelAndView.addObject("resultBundle", listBundle); modelAndView.addObject("runningTaskCount", runningTaskCount.getResult()); modelAndView.addObject("spiderInfoList", listBundle.getResultList().stream() .map(task -> StringEscapeUtils.escapeHtml4( gson.toJson(task.getExtraInfoByKey("spiderInfo") )) ).collect(Collectors.toList())); return modelAndView; }
Example #9
Source File: AdminController.java From pacbot with Apache License 2.0 | 6 votes |
/** * API to enable disable rule or job * * @author NKrishn3 * @param ruleId - valid rule or job Id * @param user - userId who performs the action * @param action - valid action (disable/ enable) * @return Success or Failure response */ @ApiOperation(httpMethod = "POST", value = "API to enable disable rule or job", response = Response.class, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/enable-disable", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> enableDisableRuleOrJob(@AuthenticationPrincipal Principal user, @ApiParam(value = "provide valid rule id", required = false) @RequestParam(name = "ruleId", required = false) String ruleId, @ApiParam(value = "provide valid job id", required = false) @RequestParam(name = "jobId", required = false) String jobId, @ApiParam(value = "provide valid action", required = true) @RequestParam(name = "action", required = true) String action) { try { if (!StringUtils.isBlank(ruleId)) { return ResponseUtils.buildSucessResponse(ruleService.enableDisableRule(ruleId, action, user.getName())); } else if (!StringUtils.isBlank(jobId)) { return ResponseUtils.buildSucessResponse(jobService.enableDisableJob(jobId, action, user.getName())); } else { return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), JOBID_OR_RULEID_NOT_EMPTY); } } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }
Example #10
Source File: ConsoleUserController.java From console with Apache License 2.0 | 6 votes |
@SuppressWarnings("unused") @RequestMapping("/deleteConsoleUserByUserids") @ResponseBody public int deleteConsoleUserByUserids(HttpServletRequest request) { long startTime = System.currentTimeMillis(); int nRows = 0; String _sUserIds = request.getParameter("userIds"); String type = request.getParameter("type"); if (!StringUtils.isNull(_sUserIds)) { nRows = consoleUserService.deleteConsoleUserUserIds(_sUserIds); boolean flag = false; // define opear result if (nRows != 0) flag = true; } return nRows; }
Example #11
Source File: StubCartController.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@RequestMapping (value = "/users/{userid}/cart/{cartid}/getcount", method = RequestMethod.GET) public int countProductsInCart(Principal principal, @PathVariable (value = "userid") String userid, @PathVariable (value = "cartid") String cartid) throws ProductCartServiceException { User user = (User)((UsernamePasswordAuthenticationToken) principal). getPrincipal(); fr.gael.dhus.service.ProductCartService productCartService = ApplicationContextProvider.getBean( fr.gael.dhus.service.ProductCartService.class); try { return productCartService.countProductsInCart(user.getUUID()); } catch (Exception e) { e.printStackTrace(); throw new ProductCartServiceException(e.getMessage()); } }
Example #12
Source File: IndexController.java From kob with Apache License 2.0 | 6 votes |
@RequestMapping(value = {"/change_project.htm"}) public String changeProject(Model model) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); User user = (User) request.getSession().getAttribute(Attribute.SESSION_USER); List<ProjectUser> projectUserList = indexService.selectProjectUserByUserCode(user.getCode()); request.getSession().setAttribute(Attribute.PROJECT_LIST, projectUserList); String projectCode = request.getParameter("project_code"); if (!KobUtils.isEmpty(projectUserList)) { for (ProjectUser projectUser : projectUserList) { if (projectUser.getProjectCode().equals(projectCode)) { request.getSession().setAttribute(Attribute.PROJECT_SELECTED, projectUser); return welcome(model); } } } return welcome(model); }
Example #13
Source File: AppManageController.java From cachecloud with Apache License 2.0 | 6 votes |
/** * 添加slave节点 * * @param appId * @param masterInstanceId * @param slaveHost * @return */ @RequestMapping(value = "/addSlave") public void addSlave(HttpServletRequest request, HttpServletResponse response, Model model, long appId, int masterInstanceId, String slaveHost) { AppUser appUser = getUserInfo(request); logger.warn("user {} addSlave: appId:{},masterInstanceId:{},slaveHost:{}", appUser.getName(), appId, masterInstanceId, slaveHost); boolean success = false; if (appId > 0 && StringUtils.isNotBlank(slaveHost) && masterInstanceId > 0) { try { success = redisDeployCenter.addSlave(appId, masterInstanceId, slaveHost); } catch (Exception e) { logger.error(e.getMessage(), e); } } logger.warn("user {} addSlave: appId:{},masterInstanceId:{},slaveHost:{} result is {}", appUser.getName(), appId, masterInstanceId, slaveHost, success); write(response, String.valueOf(success == true ? SuccessEnum.SUCCESS.value() : SuccessEnum.FAIL.value())); }
Example #14
Source File: DTSController.java From dtsopensource with Apache License 2.0 | 6 votes |
/** * 申购 * * @param productName * @param orderAmount * @param currentAmount * @param response */ @RequestMapping(value = "/purchase", method = RequestMethod.GET) public void puchase(@RequestParam String productName, @RequestParam BigDecimal orderAmount, @RequestParam BigDecimal currentAmount, HttpServletResponse response) { response.setHeader("Content-type", "text/html;charset=UTF-8"); try { this.sysout(response, "购买商品:[" + new String(productName.getBytes("iso8859-1"), "utf-8") + "],订单金额:[" + orderAmount + "],账户余额:[" + currentAmount + "]"); PurchaseContext context = new PurchaseContext(); context.setCurrentAmount(currentAmount); context.setOrderAmount(orderAmount); context.setProductName(new String(productName.getBytes("iso8859-1"), "utf-8")); log.info(context.toString()); String activityId = purchaseService.puchase(context); this.sysout(response, "业务活动ID:" + activityId); List<String> list = tradeLog.getNewLog(activityId); for (String an : list) { this.sysout(response, an); } } catch (Exception e) { log.error(e.getMessage(), e); } }
Example #15
Source File: GateController.java From lams with GNU General Public License v2.0 | 6 votes |
/** * <p> * The dispatch method that allows the teacher to view the status of the gate. It is expecting the caller passed in * lesson id and gate activity id as http parameter. Otherwise, the utility method will generate some exception. * </p> * * <p> * Based on the lesson id and gate activity id, it sets up the gate form to show the waiting learners and the total * waiting learners. Regarding schedule gate, it also shows the estimated gate opening time and gate closing time. * </p> * * <b>Note:</b> gate form attribute <code>waitingLearners</code> got setup after the view is dispatch to ensure * there won't be casting exception occur if the activity id is not a gate by chance. */ @RequestMapping("/viewGate") public String viewGate(@ModelAttribute GateForm gateForm, HttpServletRequest request, HttpServletResponse response) { // if this is the initial call then activity id will be in the request, otherwise // get it from the form (if being called from openGate.jsp Long gateIdLong = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID, true); if (gateIdLong == null) { gateIdLong = gateForm.getActivityId(); } long gateId = gateIdLong != null ? gateIdLong.longValue() : -1; GateActivity gate = (GateActivity) monitoringService.getActivityById(gateId); if (gate == null) { throw new MonitoringServiceException("Gate activity missing. Activity id" + gateId); } gateForm.setActivityId(gateIdLong); return findViewByGateType(gateForm, gate); }
Example #16
Source File: UserController.java From maven-framework-project with MIT License | 6 votes |
@RequestMapping(value="/update", method=RequestMethod.POST) public @ResponseBody User update( @RequestParam String username, @RequestParam String firstName, @RequestParam String lastName, @RequestParam Integer role) { Role existingRole = new Role(); existingRole.setRole(role); User existingUser = new User(); existingUser.setUsername(username); existingUser.setFirstName(firstName); existingUser.setLastName(lastName); existingUser.setRole(existingRole); return service.update(existingUser); }
Example #17
Source File: WeixinTmessageSendLogController.java From jeewx-boot with Apache License 2.0 | 5 votes |
/** * 详情 * @return */ @RequestMapping(value="toDetail",method = RequestMethod.GET) public void weixinTmessageSendLogDetail(@RequestParam(required = true, value = "id" ) String id,HttpServletResponse response,HttpServletRequest request)throws Exception{ VelocityContext velocityContext = new VelocityContext(); String viewName = "tmessage/back/weixinTmessageSendLog-detail.vm"; WeixinTmessageSendLog weixinTmessageSendLog = weixinTmessageSendLogService.queryById(id); velocityContext.put("weixinTmessageSendLog",weixinTmessageSendLog); ViewVelocity.view(request,response,viewName,velocityContext); }
Example #18
Source File: DebugController.java From alcor with Apache License 2.0 | 5 votes |
@RequestMapping( method = GET, value = "/project/all/subnets") public Map getAllSubnetStates() { Map result = new HashMap<String, Object>(); Map dataItems = this.subnetRedisRepository.findAllItems(); result.put("Count", dataItems.size()); result.put("Subnets", dataItems); return result; }
Example #19
Source File: VirtualRouterSimulator.java From zstack with Apache License 2.0 | 5 votes |
@RequestMapping(value = VirtualRouterConstant.VR_INIT, method = RequestMethod.POST) private @ResponseBody String init(HttpServletRequest req) { HttpEntity<String> entity = restf.httpServletRequestToHttpEntity(req); doInit(entity); return null; }
Example #20
Source File: JobConfigController.java From DataLink with Apache License 2.0 | 5 votes |
@ResponseBody @RequestMapping(value = "/crossDataCenter") @AuthIgnore public Map<String, Object> crossDataCenter(@ModelAttribute("name") String name, HttpServletRequest request) { Set<MediaSourceType> types = new HashSet<>(); if (name.toUpperCase().equals(MediaSourceType.ELASTICSEARCH.name())) { types.add(MediaSourceType.ELASTICSEARCH); } else if (name.toUpperCase().equals(MediaSourceType.HBASE.name())) { types.add(MediaSourceType.HBASE); } else if (name.toUpperCase().equals(MediaSourceType.HDFS.name())) { types.add(MediaSourceType.HDFS); } else if (name.toUpperCase().equals(MediaSourceType.MYSQL.name())) { types.add(MediaSourceType.MYSQL); } else if (name.toUpperCase().equals(MediaSourceType.SQLSERVER.name())) { types.add(MediaSourceType.SQLSERVER); } else if (name.toUpperCase().equals(MediaSourceType.POSTGRESQL.name())) { types.add(MediaSourceType.POSTGRESQL); } else if (name.toUpperCase().equals(MediaSourceType.SDDL.name())) { types.add(MediaSourceType.SDDL); } else if (name.toUpperCase().equals(MediaSourceType.ORACLE.name())){ types.add(MediaSourceType.ORACLE); } else { //忽略 } List<MediaSourceInfo> mediaSourceList = mediaSourceService.getListByType(types); Map<String, Object> map = new HashMap<>(); List<String> num = new ArrayList<>(); List<String> val = new ArrayList<>(); for (MediaSourceInfo info : mediaSourceList) { num.add(info.getId() + ""); val.add(info.getName()); } map.put("num", num); map.put("val", val); return map; }
Example #21
Source File: EmailController.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@PreAuthorize( "hasRole('ALL') or hasRole('F_SEND_EMAIL')" ) @RequestMapping( value = "/notification", method = RequestMethod.POST, produces = "application/json" ) public void sendEmailNotification( @RequestParam Set<String> recipients, @RequestParam String message, @RequestParam ( defaultValue = "DHIS 2" ) String subject, HttpServletResponse response, HttpServletRequest request ) throws WebMessageException { checkEmailSettings(); OutboundMessageResponse emailResponse = emailService.sendEmail( subject, message, recipients ); emailResponseHandler( emailResponse, request, response ); }
Example #22
Source File: OaNotifyController.java From Shop-for-JavaWeb with MIT License | 5 votes |
/** * 查看我的通知-发送记录 */ @RequestMapping(value = "viewRecordData") @ResponseBody public OaNotify viewRecordData(OaNotify oaNotify, Model model) { if (StringUtils.isNotBlank(oaNotify.getId())){ oaNotify = oaNotifyService.getRecordList(oaNotify); return oaNotify; } return null; }
Example #23
Source File: LoginMaintainController.java From lams with GNU General Public License v2.0 | 5 votes |
@RequestMapping(path = "/loginmaintain") public String execute(@ModelAttribute LoginMaintainForm loginMaintainForm, HttpServletRequest request) throws Exception { loginMaintainForm.setNews(loadNews()); return "loginmaintain"; }
Example #24
Source File: HomeController.java From Building-RESTful-Web-Services-with-Spring-5-Second-Edition with MIT License | 5 votes |
@ResponseBody @RequestMapping("/test/aop/with/annotation") @TokenRequired public Map<String, Object> testAOPAnnotation(){ Map<String, Object> map = new LinkedHashMap<>(); map.put("result", "Aloha"); return map; }
Example #25
Source File: PedagogicalPlannerController.java From lams with GNU General Public License v2.0 | 5 votes |
@RequestMapping("/initPedagogicalPlannerForm") public String initPedagogicalPlannerForm(@ModelAttribute("pedagogicalPlannerForm") ScribePedagogicalPlannerForm pedagogicalPlannerForm, HttpServletRequest request) { Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); Scribe scribe = scribeService.getScribeByContentId(toolContentID); pedagogicalPlannerForm.fillForm(scribe); String contentFolderId = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); pedagogicalPlannerForm.setContentFolderID(contentFolderId); return "pages/authoring/pedagogicalPlannerForm"; }
Example #26
Source File: TransformationService.java From data-prep with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/dictionary", method = GET, produces = APPLICATION_OCTET_STREAM_VALUE) @ApiOperation(value = "Get current dictionary (as serialized object).") @Timed public StreamingResponseBody getDictionary() { return outputStream -> { // Serialize it to output LOG.debug("Returning DQ dictionaries"); TdqCategories result = TdqCategoriesFactory.createFullTdqCategories(); try (ObjectOutputStream oos = new ObjectOutputStream(new GZIPOutputStream(outputStream))) { oos.writeObject(result); } }; }
Example #27
Source File: ClearController.java From logistics-back with MIT License | 5 votes |
/** * 客户结算-通过订单编号查询单个实体的已填所有信息 */ @RequestMapping(value = "/selectCustomerBillClearByCode/{goodsBillCode}", method = RequestMethod.GET) public CustomerBillClear selectCustomerBillClearByCode(@PathVariable("goodsBillCode") String goodsBillCode) { CustomerBillClear customerBillClear = clearService.selectByBillCode(goodsBillCode); System.out.println(customerBillClear); return customerBillClear; }
Example #28
Source File: HBaseTaskController.java From DataLink with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/toUpdateHbaseTask") public ModelAndView toUpdateHbaseTask(Long id) { ModelAndView mav = new ModelAndView("task/hbaseTaskUpdate"); TaskInfo taskInfo = taskService.getTask(id); Map<String, PluginWriterParameter> writerParameterMap = getWriterParameters(); taskInfo.getTaskWriterParameterObjs().forEach(i -> writerParameterMap.put(i.getPluginName(), i)); HBaseTaskModel hbaseTaskModel = new HBaseTaskModel( new TaskModel.TaskBasicInfo( id, taskInfo.getTaskName(), taskInfo.getTaskDesc(), taskInfo.getTargetState(), taskInfo.getGroupId() ), writerParameterMap, groupService.getAllGroups(), TargetState.getAllStates(), mediaService.getMediaSourcesByTypes(MediaSourceType.HBASE), buildZkMediaSources(), PluginWriterParameter.RetryMode.getAllModes(), RdbmsWriterParameter.SyncMode.getAllModes(), (HBaseReaderParameter) taskInfo.getTaskReaderParameterObj(), CommitMode.getAllCommitModes(), SerializeMode.getAllSerializeModes(), PartitionMode.getAllPartitionModes(), taskInfo.isLeaderTask() ? "1" : "0" ); hbaseTaskModel.setCurrentWriters(taskInfo.getTaskWriterParameterObjs().stream().collect(Collectors.toMap(PluginWriterParameter::getPluginName, i -> "1"))); mav.addObject("taskModel", hbaseTaskModel); return mav; }
Example #29
Source File: AssetController.java From iotplatform with Apache License 2.0 | 5 votes |
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/asset/types", method = RequestMethod.GET) @ResponseBody public List<TenantAssetType> getAssetTypes() throws IoTPException { try { SecurityUser user = getCurrentUser(); TenantId tenantId = user.getTenantId(); ListenableFuture<List<TenantAssetType>> assetTypes = assetService.findAssetTypesByTenantId(tenantId); return checkNotNull(assetTypes.get()); } catch (Exception e) { throw handleException(e); } }
Example #30
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); }