You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/03/29 06:35:15 UTC

[GitHub] acsukesh closed pull request #607: [SCB-406] Chassis must support standard parameter validation handler

acsukesh closed pull request #607: [SCB-406] Chassis must support standard parameter validation handler
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/607
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/coverage-reports/pom.xml b/coverage-reports/pom.xml
index efbb934ff..c06d79768 100644
--- a/coverage-reports/pom.xml
+++ b/coverage-reports/pom.xml
@@ -62,6 +62,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-loadbalance</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>handler-validator</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-publickey-auth</artifactId>
diff --git a/handlers/handler-validator/pom.xml b/handlers/handler-validator/pom.xml
new file mode 100644
index 000000000..0b0da8e00
--- /dev/null
+++ b/handlers/handler-validator/pom.xml
@@ -0,0 +1,52 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.servicecomb</groupId>
+    <artifactId>handlers</artifactId>
+    <version>1.0.0-m1</version>
+  </parent>
+  <artifactId>handler-validator</artifactId>
+  <name>Java Chassis::Handlers::Validator</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-validator</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.glassfish</groupId>
+      <artifactId>javax.el</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/DefaultParamException.java b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/DefaultParamException.java
new file mode 100644
index 000000000..04e4e184f
--- /dev/null
+++ b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/DefaultParamException.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+/**
+ * DefaultParamException
+ * Default invalid parameter exception data
+ *
+ */
+public class DefaultParamException {
+
+  private String parameterName;
+
+  private int errorCode;
+
+  private String errorMessage;
+
+  public DefaultParamException(String paramName, int errCode, String message) {
+    this.parameterName = paramName;
+    this.errorCode = errCode;
+    this.errorMessage = message;
+  }
+
+  public DefaultParamException() {
+  }
+
+  public String getParameterName() {
+    return parameterName;
+  }
+
+  public void setParameterName(String parameterName) {
+    this.parameterName = parameterName;
+  }
+
+  public int getErrorCode() {
+    return errorCode;
+  }
+
+  public void setErrorCode(int errorCode) {
+    this.errorCode = errorCode;
+  }
+
+  public String getErrorMessage() {
+    return errorMessage;
+  }
+
+  public void setErrorMessage(String errorMessage) {
+    this.errorMessage = errorMessage;
+  }
+}
diff --git a/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/InvalidParamException.java b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/InvalidParamException.java
new file mode 100644
index 000000000..0f669e4f7
--- /dev/null
+++ b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/InvalidParamException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+/**
+ * InvalidParamException
+ * Interface to custom the parameter validation exception message
+ *
+ */
+public interface InvalidParamException {
+
+  Object getExceptionData(Object arg);
+}
diff --git a/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamException.java b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamException.java
new file mode 100644
index 000000000..660681a29
--- /dev/null
+++ b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamException.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ParamException {
+  int errorCode() default 400;
+  Class<?> errorHandler() default Object.class;
+}
diff --git a/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamValidateHandler.java b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamValidateHandler.java
new file mode 100644
index 000000000..23be50e17
--- /dev/null
+++ b/handlers/handler-validator/src/main/java/org/apache/servicecomb/validator/ParamValidateHandler.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+
+import org.apache.servicecomb.core.Handler;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+import org.apache.servicecomb.swagger.invocation.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ParamValidateHandler
+ * Handler to validate the input request parameters 
+ *
+ */
+public class ParamValidateHandler implements Handler {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ParamValidateHandler.class);
+
+  private static Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
+
+  @Override
+  public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
+    Object[] args = invocation.getArgs();
+    boolean invalid = false;
+    List<Object> errList = new ArrayList<>();
+    if (null != args) {
+      for (Object arg : args) {
+        Set<ConstraintViolation<Object>> violations = validator.validate(arg);
+        if (violations.size() > 0) {
+          invalid = true;
+          ParamException paramExcep = null;
+          for (ConstraintViolation<Object> constraintViolation : violations) {
+            String paramName = constraintViolation.getPropertyPath().toString();
+            paramExcep = processErrorAnnotation(arg, paramName);
+            int errCode = 400;
+            Class<?> errHanlder = null;
+            if (null != paramExcep) {
+              errCode = paramExcep.errorCode();
+              errHanlder = paramExcep.errorHandler();
+              try {
+                Object instance = errHanlder.newInstance();
+                if (instance instanceof InvalidParamException) {
+                  InvalidParamException invalidParamException = (InvalidParamException) instance;
+                  errList.add(invalidParamException.getExceptionData(arg));
+                } else {
+                  LOGGER.warn("Failed to load configured error details class " + errHanlder.getCanonicalName()
+                      + "; Using the default Error hanlder");
+                  processDefaultError(errCode, constraintViolation.getMessage(), paramName, errList);
+                }
+              } catch (InstantiationException e) {
+                LOGGER.warn("Failed to load configured error details class " + errHanlder.getCanonicalName()
+                    + "; Using the default Error hanlder");
+                processDefaultError(errCode, constraintViolation.getMessage(), paramName, errList);
+              }
+
+            } else {
+              processDefaultError(errCode, constraintViolation.getMessage(), paramName, errList);
+            }
+
+          }
+        }
+      }
+    }
+
+    if (invalid) {
+      Response res = Response.create(400, "Invalid parameter(s).", errList);
+      asyncResp.complete(res);
+    } else {
+      invocation.next(asyncResp);
+    }
+  }
+
+  private void processDefaultError(int errCode, String message, String paramName, List<Object> errList) {
+    DefaultParamException defaultErrorInfo = new DefaultParamException(paramName, errCode, message);
+    errList.add(defaultErrorInfo);
+  }
+
+  private ParamException processErrorAnnotation(Object arg, String paramName) {
+    Field[] fields = arg.getClass().getDeclaredFields();
+    for (Field field : fields) {
+      if (paramName.equals(field.getName()) && field.isAnnotationPresent(ParamException.class)) {
+        ParamException paramExcep = field.getAnnotation(ParamException.class);
+        return paramExcep;
+      }
+
+    }
+    return null;
+  }
+
+}
diff --git a/handlers/handler-validator/src/main/resources/config/cse.handler.xml b/handlers/handler-validator/src/main/resources/config/cse.handler.xml
new file mode 100644
index 000000000..063313129
--- /dev/null
+++ b/handlers/handler-validator/src/main/resources/config/cse.handler.xml
@@ -0,0 +1,21 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<config>
+	<handler id="validator"
+		class="org.apache.servicecomb.validator.ParamValidateHandler" />
+</config>
diff --git a/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/CustomException.java b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/CustomException.java
new file mode 100644
index 000000000..8754dd477
--- /dev/null
+++ b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/CustomException.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+public class CustomException implements InvalidParamException {
+
+  @Override
+  public Object getExceptionData(Object arg) {
+    return new Person("testing custom error " + arg.getClass().getName());
+  }
+
+}
diff --git a/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/Person.java b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/Person.java
new file mode 100644
index 000000000..def7079b1
--- /dev/null
+++ b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/Person.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+import javax.validation.constraints.Min;
+
+import org.apache.servicecomb.validator.ParamException;
+import org.hibernate.validator.constraints.NotEmpty;
+
+public class Person {
+  @NotEmpty
+  private String name;
+
+  @Min(value = 20, message = "age must be more than 20")
+  @ParamException(errorCode = 240, errorHandler = CustomException.class)
+  private int age;
+
+  @NotEmpty
+  @ParamException(errorHandler = Object.class)
+  private String addr;
+
+  public void setAge(int age) {
+    this.age = age;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Person() {
+  }
+
+  public void setAddr(String addr) {
+    this.addr = addr;
+  }
+
+  public Person(String name) {
+    this.name = name;
+  }
+}
diff --git a/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestDefaultParamException.java b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestDefaultParamException.java
new file mode 100644
index 000000000..a06c6e01c
--- /dev/null
+++ b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestDefaultParamException.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestDefaultParamException {
+
+  @Test
+  public void testHandleForException() throws Exception {
+    DefaultParamException defaultErrorInfo = new DefaultParamException();
+    defaultErrorInfo.setParameterName("testparam");
+    defaultErrorInfo.setErrorCode(402);
+    defaultErrorInfo.setErrorMessage("testmessage");
+    Assert.assertEquals("testparam", defaultErrorInfo.getParameterName());
+    Assert.assertEquals(402, defaultErrorInfo.getErrorCode());
+    Assert.assertEquals("testmessage", defaultErrorInfo.getErrorMessage());
+  }
+
+}
diff --git a/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestParamValidateHandler.java b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestParamValidateHandler.java
new file mode 100644
index 000000000..454eb413f
--- /dev/null
+++ b/handlers/handler-validator/src/test/java/org/apache/servicecomb/validator/TestParamValidateHandler.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.validator;
+
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class TestParamValidateHandler {
+
+  ParamValidateHandler handler;
+
+  Invocation invocation;
+
+  AsyncResponse asyncResp;
+
+  @Before
+  public void setUP() {
+    handler = new ParamValidateHandler();
+    invocation = Mockito.mock(Invocation.class);
+    asyncResp = Mockito.mock(AsyncResponse.class);
+  }
+
+  @After
+  public void afterTest() {
+    handler = null;
+    invocation = null;
+    asyncResp = null;
+  }
+
+  @Test
+  public void testHandleForException() throws Exception {
+    Person obj = new Person();
+    obj.setName("test");
+    obj.setAge(11);
+    Mockito.when(invocation.getArgs()).thenReturn(new Person[] {obj});
+    handler.handle(invocation, ar -> {
+      InvocationException exp = ar.getResult();
+      Assert.assertNotNull(exp.getErrorData());
+    });
+  }
+
+  @Test
+  public void testHandleException() throws Exception {
+    Person obj = new Person();
+    obj.setName("");
+    obj.setAge(11);
+    Mockito.when(invocation.getArgs()).thenReturn(new Person[] {obj});
+    handler.handle(invocation, ar -> {
+      InvocationException exp = ar.getResult();
+      Assert.assertNotNull(exp.getErrorData());
+    });
+  }
+
+  @Test
+  public void testHandleInvalidClass() throws Exception {
+    Person obj = new Person();
+    obj.setName("");
+    obj.setAge(11);
+    obj.setAddr("");
+    Mockito.when(invocation.getArgs()).thenReturn(new Person[] {obj});
+    handler.handle(invocation, ar -> {
+      InvocationException exp = ar.getResult();
+      Assert.assertNotNull(exp.getErrorData());
+    });
+  }
+
+  @Test
+  public void testHandle() throws Exception {
+    boolean isSuccess = true;
+    Person obj = new Person();
+    obj.setName("test");
+    obj.setAge(21);
+    obj.setAddr("addr");
+    try {
+      Mockito.when(invocation.getArgs()).thenReturn(new Person[] {obj});
+      handler.handle(invocation, asyncResp);
+    } catch (Exception e) {
+      isSuccess = false;
+    }
+    Assert.assertTrue(isSuccess);
+  }
+}
diff --git a/handlers/handler-validator/src/test/resources/log4j.properties b/handlers/handler-validator/src/test/resources/log4j.properties
new file mode 100644
index 000000000..fbea91e7a
--- /dev/null
+++ b/handlers/handler-validator/src/test/resources/log4j.properties
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+log4j.rootLogger=INFO, out, stdout
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/test.log
+log4j.appender.out.append=true
diff --git a/handlers/pom.xml b/handlers/pom.xml
index 1dea7784a..935c0129b 100644
--- a/handlers/pom.xml
+++ b/handlers/pom.xml
@@ -37,6 +37,7 @@
     <module>handler-flowcontrol-qps</module>
     <module>handler-loadbalance</module>
     <module>handler-publickey-auth</module>
+    <module>handler-validator</module>
   </modules>
 
 </project>
diff --git a/java-chassis-dependencies/pom.xml b/java-chassis-dependencies/pom.xml
index 8739033b9..59b36f8e5 100644
--- a/java-chassis-dependencies/pom.xml
+++ b/java-chassis-dependencies/pom.xml
@@ -824,6 +824,11 @@
         <artifactId>handler-loadbalance</artifactId>
         <version>1.0.0-m1</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>handler-validator</artifactId>
+        <version>1.0.0-m1</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>handler-flowcontrol-qps</artifactId>
diff --git a/java-chassis-distribution/pom.xml b/java-chassis-distribution/pom.xml
index b29e8b4ff..c7123cb83 100644
--- a/java-chassis-distribution/pom.xml
+++ b/java-chassis-distribution/pom.xml
@@ -124,6 +124,10 @@
             <groupId>org.apache.servicecomb</groupId>
             <artifactId>handler-loadbalance</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.servicecomb</groupId>
+            <artifactId>handler-validator</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.servicecomb</groupId>
             <artifactId>handler-tracing-zipkin</artifactId>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services