本文整理汇总了Java中org.springframework.http.MediaType.APPLICATION_XHTML_XML_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.APPLICATION_XHTML_XML_VALUE属性的具体用法?Java MediaType.APPLICATION_XHTML_XML_VALUE怎么用?Java MediaType.APPLICATION_XHTML_XML_VALUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.http.MediaType
的用法示例。
在下文中一共展示了MediaType.APPLICATION_XHTML_XML_VALUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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";
}
示例2: createGrantType
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String createGrantType(@RequestParam("grantTypeName") String grantTypeName, RedirectAttributes attributes) {
if (GRANT_TYPES_PATTERN.matcher(grantTypeName).matches()) {
if (grantTypeRepository.findOneByValue(grantTypeName.toLowerCase()).isPresent()) {
// error message
addErrorMessage(attributes, "授权方式 " + grantTypeName + " 已经存在。");
attributes.addFlashAttribute("grantTypeName", grantTypeName);
} else {
grantTypeRepository.save(GrantTypeEntity.builder().value(grantTypeName.toLowerCase()).build());
// success message
addSuccessMessage(attributes, "已成功添加 " + grantTypeName + " 授权方式。");
}
} else {
addErrorMessage(attributes, "授权方式 " + grantTypeName + " 含有非法字符。(只能使用[a-zA-Z_])");
attributes.addFlashAttribute("grantTypeName", grantTypeName);
}
return "redirect:/grantTypes.html";
}
示例3: removeGrantType
@RequestMapping(path = "/_remove/{grantTypeName}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String removeGrantType(@PathVariable("grantTypeName") String grantTypeName, RedirectAttributes attributes) {
grantTypeRepository.findOneByValue(grantTypeName.toLowerCase()).map(grantTypeEntity -> {
Set<ClientDetailsToAuthorizedGrantTypeXrefEntity> xref = grantTypeEntity.getClientDetailsToAuthorizedGrantTypeXrefs();
if (xref.isEmpty()) {
grantTypeRepository.delete(grantTypeEntity);
addSuccessMessage(attributes, "已成功删除 " + grantTypeName + " 授权方式。");
} else {
addErrorMessage(attributes, "有" + xref.size() + "个客户端正在使用该授权方式,无法删除。");
}
return grantTypeEntity;
}).orElseGet(() -> {
addWarningMessage(attributes, "没有找到 " + grantTypeName + " 授权方式。");
return null;
});
return "redirect:/grantTypes.html";
}
示例4: 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("scopeValue") String scopeValue, RedirectAttributes attributes) {
if (SCOPE_PATTERN.matcher(scopeValue).matches()) {
if (scopeRepository.findOneByValue(scopeValue).isPresent()) {
// error message
addErrorMessage(attributes, "授权范围 " + scopeValue + " 已经存在。");
attributes.addFlashAttribute("scopeValue", scopeValue);
} else {
scopeRepository.save(ScopeEntity.builder().value(scopeValue).build());
// success message
addSuccessMessage(attributes, "已成功添加 " + scopeValue + " 授权范围。");
}
} else {
addErrorMessage(attributes, "授权范围 " + scopeValue + " 含有非法字符。(只能使用[a-zA-Z0-9_])");
attributes.addFlashAttribute("scopeValue", scopeValue);
}
return "redirect:/scopes.html";
}
示例5: deleteUser
@RequestMapping(path = "/_remove/{username}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String deleteUser(@PathVariable("username") String username, RedirectAttributes attributes) {
if (INVINCIBLE_USERS_LIST.contains(username)) {
addErrorMessage(attributes, "不能删除用户:" + username);
} else {
userRepository.findOneByUsername(username).map(userEntity -> {
userRepository.delete(userEntity);
addSuccessMessage(attributes, "用户 " + username + " 已删除。");
return userEntity;
}).orElseGet(() -> {
addWarningMessage(attributes, "没有找到 " + username + " 用户。");
return null;
});
}
return "redirect:/users.html";
}
示例6: listAll
@RequestMapping(method = RequestMethod.GET,
produces = {MediaType.TEXT_HTML_VALUE, MediaType.APPLICATION_XHTML_XML_VALUE})
public String listAll(@RequestParam(name = "type", required = false) String editType,
@RequestParam(name = "edit", required = false) String editRestRoute, Model model,
Pageable pageable) {
if (!StringUtils.isEmpty(editType)) {
if (!StringUtils.isEmpty(editRestRoute)) {
zuulRouteRepository.findOneByRouteId(editRestRoute).map(zuulRouteEntity -> {
model.addAttribute("routeId", zuulRouteEntity.getZuul_route_id());
model.addAttribute("routePath", zuulRouteEntity.getPath());
model.addAttribute("serviceId", zuulRouteEntity.getService_id());
model.addAttribute("routeUrl", zuulRouteEntity.getUrl());
model.addAttribute("stripPrefix", zuulRouteEntity.getStrip_prefix());
model.addAttribute("retryAble", zuulRouteEntity.getRetryable());
model.addAttribute("sensitiveHeaders", zuulRouteEntity.getSensitiveHeaders());
return null;
});
}
return "route/restroute";
}
model.addAttribute("routeList", zuulRouteRepository.findAllRest(pageable));
return "route/restroutes";
}
示例7: 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";
}
示例8: 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";
}
示例9: 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";
}
示例10: listAllGrantTypes
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAllGrantTypes(Model model, Pageable pageable) {
model.addAttribute("grantTypes", grantTypeRepository.findAll(pageable));
return "clients/grantTypes";
}
示例11: 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";
}
示例12: createApiJar
@RequestMapping(method = RequestMethod.POST, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String createApiJar(@RequestParam("jarUrl") String jarUrl, @RequestParam("jarVersion") String jarVersion,
RedirectAttributes attributes) {
apiJarService.saveJar(jarVersion, jarUrl);
return "redirect:/api.html";
}
示例13: 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";
}
示例14: update
@RequestMapping(path = "/_update", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = {MediaType.TEXT_HTML_VALUE, MediaType.APPLICATION_XHTML_XML_VALUE})
public String update(@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) {
zuulRouteRepository.findOneByRouteId(routeId).map(zuulRouteEntity -> {
zuulRouteEntity.setZuul_route_id(routeId);
zuulRouteEntity.setPath(routePath);
zuulRouteEntity.setUrl(routeUrl);
zuulRouteEntity.setService_id(serviceId);
zuulRouteEntity.setStrip_prefix(stripPrefix);
zuulRouteEntity.setRetryable(retryAble);
zuulRouteEntity.setSensitiveHeaders(sensitiveHeaders);
return zuulRouteRepository.save(zuulRouteEntity);
}).orElseGet(() -> {
addErrorMessage(attributes, "routeId" + routeId + " 不存在。");
return null;
});
publisher.publishEvent(new InstanceRegisteredEvent<>(this, this.environment));
return "redirect:/restRoute.html";
}
示例15: listAll
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAll(@RequestParam(name = "type", required = false) String editType,
@RequestParam(name = "edit", required = false) String editRestRoute, Model model,
Pageable pageable) {
if (!StringUtils.isEmpty(editType)) {
if (!StringUtils.isEmpty(editRestRoute)) {
zuulRouteRepository.findOneByRouteId(editRestRoute).map(zuulRouteEntity -> {
model.addAttribute("routeId", zuulRouteEntity.getZuul_route_id());
model.addAttribute("routePath", zuulRouteEntity.getPath());
model.addAttribute("isGrpc", true);
model.addAttribute("serviceName", zuulRouteEntity.getService_name());
model.addAttribute("group", zuulRouteEntity.getGroup());
model.addAttribute("version", zuulRouteEntity.getVersion());
model.addAttribute("method", zuulRouteEntity.getMethod());
Set<ZuulGrpcFieldMappingEntity> mappingEntitys = zuulRouteEntity.getFieldMapping();
StringBuilder fieldMapping = new StringBuilder("");
int index = 0;
for (ZuulGrpcFieldMappingEntity mappingEntity : mappingEntitys) {
fieldMapping.append(mappingEntity.getSourceField());
fieldMapping.append("->");
fieldMapping.append(mappingEntity.getTargetField());
if (index != mappingEntitys.size() - 1) {
fieldMapping.append(",");
}
index++;
}
model.addAttribute("fieldMapping", fieldMapping.toString());
return null;
});
}
return "route/grpcroute";
}
model.addAttribute("routeList", zuulRouteRepository.findAllGrpc(pageable));
return "route/grpcroutes";
}