Java 类org.springframework.web.bind.annotation.PathVariable 实例源码

项目:csap-core    文件:HelloService.java   
@RequestMapping({ "helloWithOptionalName", "helloWithOptional/{name}" })
public ObjectNode helloWithOptionalName(@PathVariable Optional<String> name) {

    ObjectNode resultJson = jacksonMapper.createObjectNode();
    logger.info( "simple log" ) ;

    if (name.isPresent()  )
        resultJson.put("name", name.get()) ;
    else
        resultJson.put( "name", "not-provided" ) ;


    resultJson.put( "Response", "Hello from " + HOST_NAME + " at "
            + LocalDateTime.now().format( DateTimeFormatter.ofPattern( "HH:mm:ss,   MMMM d  uuuu " ) ));

    return resultJson ;
}
项目:movie-db-java-on-azure    文件:MovieController.java   
/**
 * Get movie info by movie id.
 *
 * @param id    movie id
 * @param model spring model
 * @return movie detail page
 */
@RequestMapping(value = "/movies/{id}", method = RequestMethod.GET)
public String getMovieById(@PathVariable Long id, Model model) {
    Movie movie = movieRepository.getMovie(Long.toString(id));
    if (movie != null) {
        if (movie.getImageUri() != null) {
            movie.setImageFullPathUri(
                    azureStorageUploader.getAzureStorageBaseUri(applicationContext) + movie.getImageUri());
        }

        model.addAttribute("movie", movie);
        return "moviedetail";
    } else {
        return "moviedetailerror";
    }
}
项目:SpringMicroservice    文件:BrownFieldSiteController.java   
@RequestMapping(value="/checkin/{flightNumber}/{origin}/{destination}/{flightDate}/{fare}/{firstName}/{lastName}/{gender}/{bookingid}", method=RequestMethod.GET)
public String bookQuery(@PathVariable String flightNumber, 
           @PathVariable String origin, 
           @PathVariable String destination, 
           @PathVariable String flightDate, 
           @PathVariable String fare, 
           @PathVariable String firstName, 
           @PathVariable String lastName, 
           @PathVariable String gender, 
           @PathVariable String bookingid, 
           Model model) {


        CheckInRecord checkIn = new CheckInRecord(firstName, lastName, "28C", null,
                                                    flightDate,flightDate, new Long(bookingid).longValue());

        long checkinId = checkInClient.postForObject("http://checkin-apigateway/api/checkin/create", checkIn, long.class); 
        model.addAttribute("message","Checked In, Seat Number is 28c , checkin id is "+ checkinId);
       return "checkinconfirm"; 
}
项目:ponto-inteligente-api    文件:LancamentoController.java   
/**
 * Atualiza os dados de um lançamento.
 * 
 * @param id
 * @param lancamentoDto
 * @return ResponseEntity<Response<Lancamento>>
 * @throws ParseException 
 */
@PutMapping(value = "/{id}")
public ResponseEntity<Response<LancamentoDto>> atualizar(@PathVariable("id") Long id,
        @Valid @RequestBody LancamentoDto lancamentoDto, BindingResult result) throws ParseException {
    log.info("Atualizando lançamento: {}", lancamentoDto.toString());
    Response<LancamentoDto> response = new Response<LancamentoDto>();
    validarFuncionario(lancamentoDto, result);
    lancamentoDto.setId(Optional.of(id));
    Lancamento lancamento = this.converterDtoParaLancamento(lancamentoDto, result);

    if (result.hasErrors()) {
        log.error("Erro validando lançamento: {}", result.getAllErrors());
        result.getAllErrors().forEach(error -> response.getErrors().add(error.getDefaultMessage()));
        return ResponseEntity.badRequest().body(response);
    }

    lancamento = this.lancamentoService.persistir(lancamento);
    response.setData(this.converterLancamentoDto(lancamento));
    return ResponseEntity.ok(response);
}
项目:plumdo-work    文件:TaskIdentityResource.java   
@RequestMapping(value="/task/{taskId}/identity/{type}/{identityId}", method = RequestMethod.DELETE, name="任务候选人删除")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteIdentityLink(@PathVariable("taskId") String taskId, @PathVariable("identityId") String identityId, 
          @PathVariable("type") String type) {
    Task task = getTaskFromRequest(taskId,false);

    validateIdentityLinkArguments(identityId, type);

    getIdentityLink(taskId, identityId, type);

    if (TaskIdentityRequest.AUTHORIZE_GROUP.equals(type)) {
        taskService.deleteGroupIdentityLink(task.getId(), identityId,IdentityLinkType.CANDIDATE);
    } else if(TaskIdentityRequest.AUTHORIZE_USER.equals(type)) {
        taskService.deleteUserIdentityLink(task.getId(), identityId,IdentityLinkType.CANDIDATE);
    }
}
项目:CommonInformationSpace    文件:CISAdaptorConnectorRestController.java   
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
       @ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
       @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
     })
@ApiResponses(value = { 
           @ApiResponse(code = 200, message = "Success", response = Participant.class),
           @ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
           @ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
    log.info("--> getParticipantFromCGOR: " + cgorName);

    Participant participant;

    try {
        participant = connector.getParticipantFromCGOR(cgorName, organisation);
    } catch (CISCommunicationException e) {
        log.error("Error executing the request: Communication Error" , e);
        participant = null;
    }

    HttpHeaders responseHeaders = new HttpHeaders();

    log.info("getParticipantFromCGOR -->");
    return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
项目:gauravbytes    文件:UserController.java   
@PutMapping(value = "/{id}")
public ResponseEntity<User> updateUser(@PathVariable("id") long id, @RequestBody User user) {
    logger.info("Updating User: {} ", user);

    Optional<User> optionalUser = userService.findById(id);
    if (optionalUser.isPresent()) {
        User currentUser = optionalUser.get();
        currentUser.setUsername(user.getUsername());
        currentUser.setAddress(user.getAddress());
        currentUser.setEmail(user.getEmail());
        userService.updateUser(currentUser);
        return ResponseEntity.ok(currentUser);

    }
    else {
        logger.warn("User with id :{} doesn't exists", id);
        return ResponseEntity.notFound().build();
    }


}
项目:simple-openid-provider    文件:ClientRegistrationEndpoint.java   
@DeleteMapping(path = "/{id:.*}")
public void deleteClientConfiguration(HttpServletRequest request, HttpServletResponse response,
        @PathVariable ClientID id) throws IOException {
    HTTPRequest httpRequest = ServletUtils.createHTTPRequest(request);

    try {
        ClientDeleteRequest clientDeleteRequest = ClientDeleteRequest.parse(httpRequest);
        resolveAndValidateClient(id, clientDeleteRequest);

        this.clientRepository.deleteById(id);

        response.setStatus(HttpServletResponse.SC_NO_CONTENT);
    }
    catch (GeneralException e) {
        ClientRegistrationResponse registrationResponse = new ClientRegistrationErrorResponse(e.getErrorObject());
        ServletUtils.applyHTTPResponse(registrationResponse.toHTTPResponse(), response);
    }
}
项目:sjk    文件:TagAppController.java   
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/tagapp/topic/{catalog}/{tagId}.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String appTagTopic(@PathVariable short catalog, @PathVariable int tagId) {

    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    try {
        Set<AppTopic> list = service.getAppTopic(tagId, catalog);
        output.put("result", server);
        output.put("data", list);
        output.put("total", list == null ? 0 : list.size());
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
        logger.error("Exception", e);
    }
    return output.toJSONString(jsonStyle);
}
项目:apollo-custom    文件:NamespaceBranchController.java   
@RequestMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/rules",
    method = RequestMethod.GET)
public GrayReleaseRuleDTO findBranchGrayRules(@PathVariable String appId,
                                              @PathVariable String clusterName,
                                              @PathVariable String namespaceName,
                                              @PathVariable String branchName) {

  checkBranch(appId, clusterName, namespaceName, branchName);

  GrayReleaseRule rules = namespaceBranchService.findBranchGrayRules(appId, clusterName, namespaceName, branchName);
  if (rules == null) {
    return null;
  }
  GrayReleaseRuleDTO ruleDTO =
      new GrayReleaseRuleDTO(rules.getAppId(), rules.getClusterName(), rules.getNamespaceName(),
                             rules.getBranchName());

  ruleDTO.setReleaseId(rules.getReleaseId());

  ruleDTO.setRuleItems(GrayReleaseRuleItemTransformer.batchTransformFromJSON(rules.getRules()));

  return ruleDTO;
}
项目:mirrorgate    文件:BuildController.java   
@RequestMapping(value = "/dashboards/{name}/builds", method = GET,
        produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getBuildsByBoardName(@PathVariable("name") String name) {

    DashboardDTO dashboard = dashboardService.getDashboard(name);
    if (dashboard == null || dashboard.getCodeRepos() == null
            || dashboard.getCodeRepos().isEmpty()) {
        return null;
    }

    List<Build> builds = buildService
            .getLastBuildsByKeywordsAndByTeamMembers(
                    dashboard.getCodeRepos(), dashboard.getTeamMembers());
    BuildStats stats = buildService.getStatsByKeywordsAndByTeamMembers(
            dashboard.getCodeRepos(), dashboard.getTeamMembers());

    Map<String, Object> response = new HashMap<>();
    response.put("lastBuilds", builds);
    response.put("stats", stats);

    return response;
}
项目:spring-boot-blog    文件:PostController.java   
/**
 * Edit post with provided id.
 * It is not possible to edit if the user is not authenticated
 * and if he is now the owner of the post
 *
 * @param id
 * @param principal
 * @return post model and postForm view, for editing post
 */
@RequestMapping(value = "/editPost/{id}", method = RequestMethod.GET)
public ModelAndView editPostWithId(@PathVariable Long id, Principal principal) {
    ModelAndView modelAndView = new ModelAndView();
    Post post = postService.findPostForId(id);
    // Not possible to edit if user is not logged in, or if he is now the owner of the post
    if (principal == null || !principal.getName().equals(post.getUser().getUsername())) {
        modelAndView.setViewName("403");
    }
    if (post == null) {
        modelAndView.setViewName("404");
    } else {
        modelAndView.addObject("post", post);
        modelAndView.setViewName("postForm");
    }
    return modelAndView;
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:UploadController.java   
@GetMapping(value = BASE_PATH + "/" + FILENAME + "/raw",
    produces = MediaType.IMAGE_JPEG_VALUE)
@ResponseBody
public Mono<ResponseEntity<?>> oneRawImage(
    @PathVariable String filename) {
    // tag::try-catch[]
    return imageService.findOneImage(filename)
        .map(resource -> {
            try {
                return ResponseEntity.ok()
                    .contentLength(resource.contentLength())
                    .body(new InputStreamResource(
                        resource.getInputStream()));
            } catch (IOException e) {
                return ResponseEntity.badRequest()
                    .body("Couldn't find " + filename +
                        " => " + e.getMessage());
            }
        });
    // end::try-catch[]
}
项目:kafka-webview    文件:ApiController.java   
/**
 * GET Details for a specific Topic.
 */
@ResponseBody
@RequestMapping(path = "/cluster/{id}/topic/{topic}/details", method = RequestMethod.GET, produces = "application/json")
public TopicDetails getTopicDetails(@PathVariable final Long id, @PathVariable final String topic) {
    // Retrieve cluster
    final Cluster cluster = clusterRepository.findOne(id);
    if (cluster == null) {
        throw new NotFoundApiException("TopicDetails", "Unable to find cluster");
    }

    // Create new Operational Client
    try (final KafkaOperations operations = createOperationsClient(cluster)) {
        return operations.getTopicDetails(topic);
    } catch (final Exception e) {
        throw new ApiException("TopicDetails", e);
    }
}
项目:apollo-custom    文件:NamespaceBranchController.java   
@RequestMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}", method = RequestMethod.DELETE)
public void deleteBranch(@PathVariable String appId,
                         @PathVariable String env,
                         @PathVariable String clusterName,
                         @PathVariable String namespaceName,
                         @PathVariable String branchName) {

  boolean canDelete = permissionValidator.hasReleaseNamespacePermission(appId, namespaceName) ||
                      (permissionValidator.hasModifyNamespacePermission(appId, namespaceName) &&
                       releaseService.loadLatestRelease(appId, Env.valueOf(env), branchName, namespaceName) == null);


  if (!canDelete) {
    throw new AccessDeniedException("Forbidden operation. "
                                    + "Caused by: 1.you don't have release permission "
                                    + "or 2. you don't have modification permission "
                                    + "or 3. you have modification permission but branch has been released");
  }

  namespaceBranchService.deleteBranch(appId, Env.valueOf(env), clusterName, namespaceName, branchName);

}
项目:sporticus    文件:RestControllerAdminUser.java   
/**
 * Function to delete a user -
 * Only the administrators can perform this operation
 *
 * @param id
 * @return ResponseEntity<DtoUser>
 */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<DtoUser> deleteOne(@PathVariable("id") final long id) {
    if (!this.getLoggedInUser().isAdmin()) {
        LOGGER.error(() -> "Users can only be deleted by system administrators");
        return new ResponseEntity<>(HttpStatus.FORBIDDEN);
    }
    final IUser found = serviceUser.findOne(id);
    if (found == null) {
        LOGGER.warn(() -> "User with id " + id + " not found");
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }

    LOGGER.debug(() -> "Deleting User with id " + id);
    serviceUser.deleteUser(found.getId());
    return new ResponseEntity<>(getDtoUser(found), HttpStatus.OK);
}
项目:DAFramework    文件:DictController.java   
@RequestMapping(value="type/{type}")
public ActionResultObj findByType(@PathVariable String type){
    ActionResultObj result = new ActionResultObj();
    try{
        if(StringUtil.isNotBlank(type)){
                List<EDict> dictList = dictDao.query(Cnd.where("type", "=", type).and("del_flag", "=", Constans.POS_NEG.NEG).orderBy("sort", "asc"));
                //处理返回值
                WMap map = new WMap();
                map.put("type", type);
                map.put("data", dictList);
                result.ok(map);
                result.okMsg("查询成功!");
        }else{
            result.errorMsg("查询失败,字典类型不存在!");
        }
    }catch(Exception e){
        e.printStackTrace();
        LOG.error("查询失败,原因:"+e.getMessage());
        result.error(e);
    }
    return result;
}
项目:agile-wroking-backend    文件:MeetingRoomController.java   
/**
 * 创新排期,单 JVM 并发量可期的情况下,简单粗暴的使用 synchronized 来解决并发创建、更新排期的问题.
 * 
 * @param id 会议室 id
 * @param schedule 新建的排期
 */
@RequestMapping(path = "/meetingRooms/{id}/schedule", method = RequestMethod.POST)
public synchronized Result<Schedule> createOrUpdateSchedule(@PathVariable(name = "id") Long id,
        @RequestParam(name = "formId", required = false) String formId, @RequestBody Schedule schedule) {
    MeetingRoom meetingRoom = meetingRoomRepository.findOne(id);
    validate(id, schedule);
    if (null == schedule.getId()) {
        schedule.setMeetingRoom(meetingRoom);
        schedule.addParticipant(creatorAsParticipant(schedule, formId));
        scheduleRepository.save(schedule);
    } else {
        Schedule s = scheduleRepository.findOne(schedule.getId());
        Assert.notNull(s, "修改的排期不存在.");
        s.setTitle(schedule.getTitle());
        s.setStartTime(schedule.getStartTime());
        s.setEndTime(schedule.getEndTime());
        s.setDate(schedule.getDate());
        s.setRepeatMode(schedule.getRepeatMode());
        scheduleRepository.save(s);
    }
    return DefaultResult.newResult(schedule);
}
项目:opencron    文件:GroupController.java   
@RequestMapping("edit/{groupId}.htm")
public String edit(@PathVariable("groupId")Long groupId, Model model) {
    Group group = groupService.getById(groupId);
    List<Group> groups = groupService.getGroupforAgent();
    model.addAttribute("group",group);
    model.addAttribute("groups",groups);
    return "/group/edit";
}
项目:product-management-system    文件:UserController.java   
/**
 * Return json-information about all users in database.
 */
@GetMapping("/{id}")
@ResponseStatus(HttpStatus.OK)
public UserDto loadUserById(@PathVariable final String id) {
    log.info("Start loadUserById: {}", id);
    return mapper.map(userService.find(id), UserDto.class);
}
项目:omero-ms-queue    文件:ImportStatusController.java   
@RequestMapping(method = GET, value = "{" + ImportIdPathVar + "}") 
public ResponseEntity<String> getStatusUpdate(
        @PathVariable(value=ImportIdPathVar) String importId, 
        HttpServletResponse response) throws IOException {
    ImportId taskId = new ImportId(importId);
    Path importLog = service.importLogPathFor(taskId).get(); 
    FileStreamer streamer = new FileStreamer(importLog, 
                                             MediaType.TEXT_PLAIN, 
                                             Caches::doNotCache);
    return streamer.streamOr404(response);
}
项目:bxbot-ui-server    文件:BotStatusController.java   
/**
 * Returns the Bot status for a given Bot id.
 *
 * @param user  the authenticated user.
 * @param botId the id of the Bot to fetch.
 * @return the Bot status for the given id.
 */
@PreAuthorize("hasRole('USER')")
@RequestMapping(value = "/{botId}" + STATUS_RESOURCE_PATH, method = RequestMethod.GET)
public ResponseEntity<?> getBotStatus(@AuthenticationPrincipal User user, @PathVariable String botId) {

    LOG.info("GET " + RUNTIME_ENDPOINT_BASE_URI + botId + STATUS_RESOURCE_PATH + " - getBotStatus()"); // - caller: " + user.getUsername());

    final BotStatus botStatus = botProcessService.getBotStatus(botId);
    return botStatus == null
            ? new ResponseEntity<>(HttpStatus.NOT_FOUND)
            : buildResponseEntity(botStatus, HttpStatus.OK);
}
项目:Spring-5.0-Cookbook    文件:DepartmentController.java   
@RequestMapping(value="/updatedept.html/{id}", method=RequestMethod.POST)
public String updateRecordSubmit(Model model, @ModelAttribute("departmentForm") DepartmentForm departmentForm, @PathVariable("id") Integer id ){

    departmentServiceImpl.updateDepartment(departmentForm, id);

    model.addAttribute("departments", departmentServiceImpl.readDepartments());
    return "dept_result";
}
项目:SaleWeb    文件:SaleWebController.java   
@GetMapping("/articulo/{id}/eliminar")
public String eliminarArticulo (Model model, @PathVariable long id){

    Articulo articulo = articulo_repository.findOne(id);
    articulo_repository.delete(articulo);
    model.addAttribute("articulos", articulo_repository.findAll());
    return "articulo_eliminado";
}
项目:ci-hands-on    文件:UserApi.java   
@RequestMapping(value = "/{user_id}", method = GET)
public ResponseEntity<UserView> get(@PathVariable("user_id") final String userId)
{
    Optional<User> userOptional = userRemoteService.get(userId);
    if (userOptional.isPresent()) {
        UserView userView = userMapper.map(userOptional.get(), UserView.class);
        return ResponseEntity.ok(userView);
    }
    return ResponseEntity.notFound().build();
}
项目:SilkAppDriver    文件:W3CProtocolController.java   
/**
 * Implements the "Go" command See https://www.w3.org/TR/webdriver/#dfn-go
 */
@RequestMapping(value = "/session/{sessionId}/url", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
public @ResponseBody ResponseEntity<Response> go(@PathVariable String sessionId,
        @RequestBody(required = false) String body) throws Throwable {
    LOGGER.info("go -->");
    LOGGER.info("  -> " + body);
    LOGGER.info("  <- ERROR: unknown command");
    LOGGER.info("go <--");

    return responseFactory.error(sessionId, ProtocolError.UNKNOWN_COMMAND);
}
项目:FCat    文件:TElementController.java   
/**
 * 通过menuId获取元素列表
 * @return
 * @throws RuntimeException
 */
@ApiOperation(value = "通过menuId获取元素列表" )
@RequestMapping(value = "getByMenuId/{menuId}", method = RequestMethod.GET)
public JSONObject getByMenuId(@PathVariable Integer menuId)throws Exception{
    List<TElement> result = bsi.getListByMenuId(menuId);
    return JsonUtil.getSuccessJsonObject(result);
}
项目:karanotes    文件:FaqController.java   
@RequestMapping(value="/extra/user/deletefaq/{faqid}")
public ResultBody deleteFaq(@PathVariable String faqid) throws GlobalErrorInfoException{
    try {
        faqinfoServiceImpl.deleteFaqinfo(faqid);
    } catch (Exception e) {
        e.printStackTrace();
        logger.debug(e);
        throw new GlobalErrorInfoException(NodescribeErrorInfoEnum.NO_DESCRIBE_ERROR);
    }
    return new ResultBody(new HashMap<>());
}
项目:Practical-Microservices    文件:FinancialController.java   
@RequestMapping(method = RequestMethod.POST, value = "{userId}/obligation", produces = "application/json", consumes = "application/json")
public ResponseEntity<String> addObligationDetails(@RequestBody ObligationDetails obligationDetails, @PathVariable("userId") UUID userId) {
    logger.debug(addObligationDetails + " Creating user's obligation with Id " + userId + " and details : " + obligationDetails);
    obligationDetails.setUserId(userId.toString());
    financialService.saveObligation(obligationDetails);
    return new ResponseEntity<>(HttpStatus.CREATED);
}
项目:microservice-kubernetes    文件:CustomerController.java   
@RequestMapping(value = "/{id}.html", method = RequestMethod.PUT)
public ModelAndView put(@PathVariable("id") long id, Customer customer,
        HttpServletRequest httpRequest) {
    customer.setId(id);
    customerRepository.save(customer);
    return new ModelAndView("success");
}
项目:forweaver2.0    文件:CodeController.java   
@RequestMapping("/tags:{tagNames}/search:{search}/sort:{sort}/page:{page}")
public String tagsWithSearch(@PathVariable("tagNames") String tagNames,
        @PathVariable("search") String search,
        @PathVariable("sort") String sort,
        @PathVariable("page") String page,Model model){
    List<String> tags = this.tagService.stringToTagList(tagNames);

    Weaver currentWeaver = this.weaverService.getCurrentWeaver();
    if(!this.tagService.validateTag(tags,currentWeaver)){
        return "redirect:/code/sort:age-desc/page:1";
    }

    int pageNum = WebUtil.getPageNumber(page);
    int size = WebUtil.getPageSize(page,5);

    model.addAttribute("codes",
            this.codeService.getCodes(currentWeaver,tags, search, sort, pageNum, size));
    model.addAttribute("codeCount",
            this.codeService.countCodes(currentWeaver,tags, search, sort));

    model.addAttribute("number", size);
    model.addAttribute("tagNames", tagNames);
    model.addAttribute("search", search);
    model.addAttribute("pageIndex", pageNum);
    model.addAttribute("pageUrl", "/tags:"+tagNames+"/search:"+search+"/sort:"+sort+"/page:");

    return "/code/front";
}
项目:buenojo    文件:ExerciseTipResource.java   
/**
 * DELETE  /exerciseTips/:id -> delete the "id" exerciseTip.
 */
@RequestMapping(value = "/exerciseTips/{id}",
        method = RequestMethod.DELETE,
        produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Void> deleteExerciseTip(@PathVariable Long id) {
    log.debug("REST request to delete ExerciseTip : {}", id);
    exerciseTipRepository.delete(id);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("exerciseTip", id.toString())).build();
}
项目:ProBOT    文件:HolidayController.java   
@RequestMapping( value = "/after/{date}", method = RequestMethod.POST )
public List< Holidays > getHolidaysAfter( @PathVariable String date ) throws ParseException
{
    SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yyyy" );
    Date actualDate = sdf.parse( date );
    logger.info( "Fetching holidays after " + actualDate );
    return holidayService.getHolidaysafter( actualDate );
}
项目:bruxelas    文件:TalkerRestController.java   
@RequestMapping(value="/languagelearn/delete/{id}", method=RequestMethod.POST, produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
public void deleteLanguagelearn(@PathVariable("id") Long languageId){
    logger.info( "deleteLanguagelearn()..." );
    try {
        this.talkerService.deleteLanguageLearn(languageId);         
    } catch (Exception e) {
        logger.error(e.getMessage());
    }
}
项目:the-legacy-app    文件:FraudDetectionImplBaseController.java   
@GetMapping(value = "/customer/{name}/get/fraud/get/",
        produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
ResponseEntity<FraudResponse> frauds(@PathVariable String name) {
    // I smell NPE
    List<Charge> charges = manager.listAllCharges(name).getCharges();
    if (charges.isEmpty()) {
        return ResponseEntity
                .accepted()
                .body(new FraudResponse("You're not a fraud", UUID.randomUUID().toString()));
    }
    return ResponseEntity
            .status(HttpStatus.BAD_REQUEST)
            .body(new FraudResponse("Pay your debts first", UUID.randomUUID().toString()));
}
项目:appng-examples    文件:PersonRestService.java   
@RequestMapping(value = "/person/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Person> getPerson(@PathVariable("id") Integer id, Environment environment) {
    Person person = service.getPerson(id);
    if (null != person) {
        return new ResponseEntity<Person>(person, HttpStatus.OK);
    }
    return new ResponseEntity<Person>(HttpStatus.NOT_FOUND);
}
项目:Mastering-Spring-5.0    文件:TodoController.java   
@PostMapping("/users/{name}/todos")
ResponseEntity<?> add(@PathVariable String name, @Valid @RequestBody Todo todo) {
    Todo createdTodo = todoService.addTodo(name, todo.getDesc(), todo.getTargetDate(), todo.isDone());
    if (createdTodo == null) {
        return ResponseEntity.noContent().build();
    }
    URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}")
            .buildAndExpand(createdTodo.getId()).toUri();
    return ResponseEntity.created(location).build();
}
项目:mumu    文件:SystemMenuController.java   
/**
 * 删除权限
 * @param permissionId 权限id
 * @return
 */
@ResponseBody
@RequiresPermissions("system:menu:permissionDelete")
@MumuLog(name = "删除菜单下的权限",operater = "DELETE")
@RequestMapping(value = "/permission/{permissionId}", method = RequestMethod.DELETE)
public ResponseEntity deleteMenuPermission(@PathVariable String permissionId) {
    try {
        permissionService.deletePermissionById(permissionId);
    } catch (Exception e) {
        log.error(e);
        return new ResponseEntity(500, "删除菜单权限出现异常", null);
    }
    return new ResponseEntity(200,"删除菜单权限操作成功",null);
}
项目:uckefu    文件:TopicController.java   
@RequestMapping("/delete/{id}")
@Menu(type = "apps" , subtype = "topic" , access = true)
public ModelAndView delete(HttpServletRequest request , HttpServletResponse response, @PathVariable String id) {
    ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/")) ;
    if(!StringUtils.isBlank(id)){
        topicRes.delete(id);
    }
    return view;
}
项目:DAFramework    文件:OrgController.java   
@RequestMapping(value = "/getOrgs/{type}")
public ActionResultObj getOrgsByListByType(@PathVariable String type) {
    ActionResultObj result = new ActionResultObj();
    try {
        if (StringUtil.isNotBlank(type)) {
            // 处理查询条件
            Criteria cnd = Cnd.cri();
            if(!type.equals("all")){
                cnd.where().andEquals("type", type);
            }
            cnd.getOrderBy().desc("id");

            // 分页查询
            List<EOrg> orgList = orgDao.query(cnd);

            // 处理返回值
            WMap map = new WMap();
            map.put("data", orgList);
            result.ok(map);
            result.okMsg("查询成功!");
        } else {
            result.errorMsg("删除失败,链接不存在!");
        }
    } catch (Exception e) {
        e.printStackTrace();
        LOG.error("查询失败,原因:" + e.getMessage());
        result.error(e);
    }
    return result;
}