当前位置: 首页>>代码示例>>Java>>正文


Java MediaType.TEXT_HTML_VALUE属性代码示例

本文整理汇总了Java中org.springframework.http.MediaType.TEXT_HTML_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.TEXT_HTML_VALUE属性的具体用法?Java MediaType.TEXT_HTML_VALUE怎么用?Java MediaType.TEXT_HTML_VALUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.http.MediaType的用法示例。


在下文中一共展示了MediaType.TEXT_HTML_VALUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteRoute

@RequestMapping(path = "/_remove/{routeId}", method = RequestMethod.GET,
    produces = {MediaType.TEXT_HTML_VALUE, MediaType.APPLICATION_XHTML_XML_VALUE})
public String deleteRoute(@PathVariable("routeId") String routeId,
    RedirectAttributes attributes) {

  zuulRouteRepository.findOneByRouteId(routeId).map(zuulRouteEntity -> {
    zuulRouteRepository.delete(zuulRouteEntity);
    addSuccessMessage(attributes, "路由 " + routeId + " 已删除。");
    publisher.publishEvent(new InstanceRegisteredEvent<>(this, this.environment));
    return zuulRouteEntity;
  }).orElseGet(() -> {
    addWarningMessage(attributes, "没有找到 " + routeId + " 路由。");
    return null;
  });
  return "redirect:/restRoute.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:16,代码来源:RestRouteAdminController.java

示例2: createRole

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                                                  MediaType.APPLICATION_XHTML_XML_VALUE })
public String createRole(@RequestParam("roleName") String roleName, RedirectAttributes attributes) {
    if (ROLE_NAME_PATTERN.matcher(roleName).matches()) {
        if (roleRepository.findOneByName(roleName.toUpperCase()).isPresent()) {
            // error message
            addErrorMessage(attributes, "角色名 " + roleName + " 已存在。");
            attributes.addFlashAttribute("roleName", roleName);
        } else {
            roleRepository.save(RoleEntity.builder().name(roleName.toUpperCase()).build());
            // success message
            addSuccessMessage(attributes, "已成功添加 " + roleName + " 角色。");
        }

    } else {
        addErrorMessage(attributes, "角色名 " + roleName + " 含有非法字符。(只能使用[a-zA-Z0-9_])");
        attributes.addFlashAttribute("roleName", roleName);
    }
    return "redirect:/roles.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:20,代码来源:RoleAdminController.java

示例3: create

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                                                  MediaType.APPLICATION_XHTML_XML_VALUE })
public String create(@RequestParam("resId") String resId, RedirectAttributes attributes) {

    if (RESOURCE_ID_PATTERN.matcher(resId).matches()) {
        if (resourceIdRepository.findOneByValue(resId).isPresent()) {
            // error message
            addErrorMessage(attributes, "资源ID " + resId + " 已经存在。");
            attributes.addFlashAttribute("resId", resId);
        } else {
            resourceIdRepository.save(ResourceIdEntity.builder().value(resId).build());
            // success message
            addSuccessMessage(attributes, "已成功添加 " + resId + " 资源ID。");
        }
    } else {
        addErrorMessage(attributes, "资源ID " + resId + " 含有非法字符。(只能使用[a-zA-Z0-9_])");
        attributes.addFlashAttribute("resId", resId);
    }

    return "redirect:/resourceIds";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:21,代码来源:ResourceIdAdminController.java

示例4: remove

@RequestMapping(path = "/_remove/{scopeValue}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                         MediaType.APPLICATION_XHTML_XML_VALUE })
public String remove(@PathVariable("scopeValue") String scopeValue, RedirectAttributes attributes) {

    scopeRepository.findOneByValue(scopeValue).map(scopeEntity -> {

        Set<ClientDetailsToScopesXrefEntity> xref = scopeEntity.getClientDetailsToScopesXrefs();
        if (xref.isEmpty()) {

            scopeRepository.delete(scopeEntity);
            addSuccessMessage(attributes, "已成功删除 " + scopeValue + " 授权范围。");

        } else {
            addErrorMessage(attributes, "有" + xref.size() + "个客户端正在使用该授权范围,无法删除。");
        }

        return scopeEntity;

    }).orElseGet(() -> {
        addWarningMessage(attributes, "没有找到 " + scopeValue + " 授权范围");
        return null;
    });

    return "redirect:/scopes.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:25,代码来源:ScopeAdminController.java

示例5: deleteRoute

@RequestMapping(path = "/_remove/{routeId}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                      MediaType.APPLICATION_XHTML_XML_VALUE })
public String deleteRoute(@PathVariable("routeId") String routeId, RedirectAttributes attributes) {

    zuulRouteRepository.findOneByRouteId(routeId).map(zuulRouteEntity -> {
        zuulRouteRepository.delete(zuulRouteEntity);
        addSuccessMessage(attributes, "路由 " + routeId + " 已删除。");
        publisher.publishEvent(new InstanceRegisteredEvent<>(this, this.environment));
        return zuulRouteEntity;
    }).orElseGet(() -> {
        addWarningMessage(attributes, "没有找到 " + routeId + " 路由。");
        return null;
    });
    return "redirect:/grpcRoute.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:15,代码来源:GrpcRouteAdminController.java

示例6: create

@RequestMapping(path = "/_create", method = RequestMethod.POST,
    consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
    produces = {MediaType.TEXT_HTML_VALUE, MediaType.APPLICATION_XHTML_XML_VALUE})
public String create(@RequestParam(name = "routeId", required = true) String routeId,
    @RequestParam(name = "routePath", required = true) String routePath,
    @RequestParam(name = "routeUrl", required = true) String routeUrl,
    @RequestParam(name = "serviceId", required = true) String serviceId,
    @RequestParam(name = "stripPrefix", defaultValue = "false") Boolean stripPrefix,
    @RequestParam(name = "retryAble", defaultValue = "false") Boolean retryAble,
    @RequestParam(name = "sensitiveHeaders", defaultValue = "") String sensitiveHeaders,
    RedirectAttributes attributes) {
  if (zuulRouteRepository.findOneByRouteId(routeId).isPresent()) {
    addErrorMessage(attributes, routeId + "已经存在 ");
    resetRequestParams(routeId, routePath, routeUrl, serviceId, stripPrefix, retryAble,
        sensitiveHeaders, attributes);
    return "redirect:/restRoute.html?type=add";
  }
  ZuulRouteEntity entityRest = ZuulRouteEntity.builder()//
      .zuul_route_id(routeId)//
      .path(routePath)//
      .strip_prefix(stripPrefix)//
      .retryable(retryAble)//
      .url(routeUrl)//
      .service_id(serviceId)//
      .sensitiveHeaders(sensitiveHeaders)//
      .build();
  zuulRouteRepository.save(entityRest);
  publisher.publishEvent(new InstanceRegisteredEvent<>(this, this.environment));
  return "redirect:/restRoute.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:30,代码来源:RestRouteAdminController.java

示例7: systemPage

@RequestMapping(method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView systemPage() {
    System system = systemService.get();
    ModelAndView mav = new ModelAndView("cereebro/system");
    mav.getModelMap().put("system", system);
    Graph graph = Graph.of(system);
    DependencyWheel wheel = DependencyWheel.of(system);
    // Will be serialized to JSON objects by thymeleaf
    mav.addObject("graph", graph);
    mav.addObject("wheel", wheel);
    return mav;
}
 
开发者ID:cereebro,项目名称:cereebro,代码行数:12,代码来源:CereebroSystemController.java

示例8: removeRole

@RequestMapping(path = "/_remove/{roleName}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                       MediaType.APPLICATION_XHTML_XML_VALUE })
public String removeRole(@PathVariable("roleName") String roleName, RedirectAttributes attributes) {

    if (INVINCIBLE_ROLES_LIST.contains(roleName.toUpperCase())) {

        addErrorMessage(attributes, "该角色不可删除:" + roleName);

    } else {

        roleRepository.findOneByName(roleName.toUpperCase()).map(roleEntity -> {

            Set<UserRoleXrefEntity> xRefList = roleEntity.getUsers();
            if (xRefList.isEmpty()) {

                roleRepository.delete(roleEntity);
                addSuccessMessage(attributes, "已成功删除 " + roleName + " 角色。");
            } else {
                addErrorMessage(attributes, "有" + xRefList.size() + "个用户正在使用该角色,无法删除。");
            }

            return roleEntity;
        }).orElseGet(() -> {
            addWarningMessage(attributes, "没有找到 " + roleName + " 角色。");
            return null;
        });
    }

    return "redirect:/roles.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:30,代码来源:RoleAdminController.java

示例9: delete

@RequestMapping(path = "/_remove/{clientId}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                                                       MediaType.APPLICATION_XHTML_XML_VALUE })
public String delete(@PathVariable("clientId") String clientId, RedirectAttributes attributes) {

    try {
        clientDetailsService.removeClientDetails(clientId);
    } catch (NoSuchClientException e) {
        addWarningMessage(attributes, "没有找到客户端ID " + clientId + " 对应的客户端。");
    }

    return "redirect:/clientDetails.html";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:12,代码来源:ClientDetailsAdminController.java

示例10: listAll

@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                         MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAll(Model model, Pageable pageable) {

    model.addAttribute("scopes", scopeRepository.findAll(pageable));
    return "clients/scopes";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:7,代码来源:ScopeAdminController.java

示例11: listAll

@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                         MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAll(Model model, Pageable pageable) {

    model.addAttribute("resIds", resourceIdRepository.findAll(pageable));
    return "clients/resourceIds";
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:7,代码来源:ResourceIdAdminController.java

示例12: Item

@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView Item(@PathVariable("id") long id) {
	return new ModelAndView("item", "item", itemRepository.findOne(id));
}
 
开发者ID:ewolff,项目名称:microservice-cloudfoundry,代码行数:4,代码来源:CatalogController.java

示例13: searchForm

@RequestMapping(value = "/searchForm.html", produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView searchForm() {
	return new ModelAndView("searchForm");
}
 
开发者ID:ewolff,项目名称:microservice-cloudfoundry,代码行数:4,代码来源:CatalogController.java

示例14: Item

@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView Item(@PathVariable("id") long id) {
	return new ModelAndView("invoice", "invoice", invoiceRepository.findOne(id));
}
 
开发者ID:ewolff,项目名称:microservice-kafka,代码行数:4,代码来源:InvoiceController.java

示例15: customer

@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView customer(@PathVariable("id") long id) {
	return new ModelAndView("customer", "customer",
			customerRepository.findOne(id));
}
 
开发者ID:ewolff,项目名称:microservice-cloudfoundry,代码行数:5,代码来源:CustomerController.java


注:本文中的org.springframework.http.MediaType.TEXT_HTML_VALUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。