本文整理匯總了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));
}