本文整理汇总了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";
}
示例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";
}
示例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";
}
示例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";
}
示例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";
}
示例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";
}
示例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;
}
示例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";
}
示例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";
}
示例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";
}
示例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";
}
示例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));
}
示例13: searchForm
@RequestMapping(value = "/searchForm.html", produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView searchForm() {
return new ModelAndView("searchForm");
}
示例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));
}
示例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));
}