提交 4fb1044b 编写于 作者: C Calvin

add comments and fix url

上级 cb041981
......@@ -3,7 +3,7 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>Restful Service高级演示</title>
<title>Web Service高级演示</title>
<script>
$(document).ready(function() {
$("#webservice-tab").addClass("active");
......@@ -23,7 +23,7 @@
<h2>2. 基于JAX-RS实现的Restful演示</h2>
<ul>
<li>服务端是基于CXF的JAX-WS演示, CXF自动生成的<a href="${ctx}/cxf/">wadl文件列表</a></li>
<li>演示地址:<a href="${ctx}/cxf/rest/user/1.xml">/cxf/rest/user/1.xml</a><a href="${ctx}/cxf/rest/user/1.xml">/cxf/rest/user/1.json</a></li>
<li>演示地址:<a href="${ctx}/cxf/rest/user/1.xml">/cxf/rest/user/1.xml</a><a href="${ctx}/cxf/rest/user/1.json">/cxf/rest/user/1.json</a></li>
</ul>
<h2>3. SpringMVC Restful Service高级演示</h2>
......
......@@ -29,20 +29,21 @@ public class DynamicSpecifications {
List<Predicate> predicates = Lists.newArrayList();
for (SearchFilter filter : filters) {
// nested path translate
// nested path translate, 如Task的名为"user.name"的filedName, 转换为Task.user.name属性
String[] names = StringUtils.split(filter.fieldName, ".");
Path expression = root.get(names[0]);
for (int i = 1; i < names.length; i++) {
expression = expression.get(names[i]);
}
// convert value
// convert value from string to target type
Class attributeClass = expression.getJavaType();
if (!attributeClass.equals(String.class) && filter.value instanceof String
&& conversionService.canConvert(String.class, attributeClass)) {
filter.value = conversionService.convert(filter.value, attributeClass);
}
// logic operator
switch (filter.operator) {
case EQ:
predicates.add(builder.equal(expression, filter.value));
......@@ -65,6 +66,7 @@ public class DynamicSpecifications {
}
}
// 将所有条件用 and 联合起来
if (predicates.size() > 0) {
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
}
......
......@@ -161,7 +161,7 @@ public class Servlets {
}
/**
* 组合Parameters生成Query String的Parameter部分,并在paramter name上加上prefix.
* 组合Parameters生成Query String的Parameter部分, 并在paramter name上加上prefix.
*
* @see #getParametersStartingWith
*/
......
......@@ -4,8 +4,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
"
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd"
default-lazy-init="true">
<description>Spring公共配置文件</description>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册