You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2019/04/16 07:04:12 UTC

[servicecomb-samples] branch master updated (015e630 -> f46f134)

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git.


    from 015e630  [SCB-1193]upgread spring boot versions and add easy to use dependency - samples
     new 9c9b18d  项目升级到1.2.0,并且增加相关的说明
     new f46f134  fix review comments and add internal access demo

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                          |  14 ++-
 dependency_management/README.md                    |  19 ++++
 dependency_management/spring4/pom.xml              |   4 +-
 dependency_management/spring5/pom.xml              |   4 +-
 dependency_management/springboot1/pom.xml          |  10 +-
 dependency_management/springboot2/pom.xml          |   3 +-
 porter_lightweight/README.md                       | 109 +++++++++++++++++++++
 .../porter/file/api/InternalAccessEndpoint.java    |  20 ++--
 .../porter/file/api/InternalAccessService.java     |   5 +
 ...Service.java => InternalAccessServiceImpl.java} |  17 ++--
 ...geSSLCustom.java => InternalAccessHandler.java} |  27 +++--
 .../src/main/resources/config/cse.handler.xml      |   6 +-
 .../src/main/resources/microservice.yaml           |   2 +-
 porter_lightweight/pom.xml                         |   2 +-
 14 files changed, 198 insertions(+), 44 deletions(-)
 create mode 100644 dependency_management/README.md
 copy dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java => porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java (68%)
 create mode 100644 porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
 copy porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/{FileStoreService.java => InternalAccessServiceImpl.java} (75%)
 copy porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/{EdgeSSLCustom.java => InternalAccessHandler.java} (55%)


[servicecomb-samples] 02/11: add porter demo

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 4bfdb295453193dc5bc82bb11365614a1a10b8df
Author: liubao <ba...@huawei.com>
AuthorDate: Wed Mar 6 22:47:42 2019 +0800

    add porter demo
---
 .gitignore                                         |  85 +++++++++++
 README.md                                          |   2 +
 porter_lightweight/README.md                       |  82 ++++++++++
 porter_lightweight/common/pom.xml                  |  31 ++++
 .../java/samples/porter/file/api/FileEndpoint.java |  51 +++++++
 .../java/samples/porter/file/api/FileService.java  |  26 ++++
 .../java/samples/porter/user/api/SessionInfo.java  |  50 +++++++
 .../java/samples/porter/user/api/UserEndpoint.java |  49 ++++++
 .../java/samples/porter/user/api/UserService.java  |  27 ++++
 .../common/src/main/resources/microservice.yaml    |  30 ++++
 porter_lightweight/file-service/pom.xml            |  49 ++++++
 .../servicecomb/samples/porter/file/FileMain.java  |  28 ++++
 .../porter/file/service/FileServiceImpl.java       |  53 +++++++
 .../porter/file/service/FileStoreService.java      |  31 ++++
 .../porter/file/service/LocalFileStoreService.java |  64 ++++++++
 .../samples/porter/file/service/SessionInfo.java   |  81 ++++++++++
 .../main/resources/META-INF/spring/file.bean.xml   |  29 ++++
 .../src/main/resources/microservice.yaml           |  30 ++++
 porter_lightweight/gateway-service/pom.xml         |  58 ++++++++
 .../samples/porter/gateway/ApiDispatcher.java      |  68 +++++++++
 .../samples/porter/gateway/AuthHandler.java        | 105 +++++++++++++
 .../samples/porter/gateway/EdgeSSLCustom.java      |  38 +++++
 .../samples/porter/gateway/GatewayMain.java        |  28 ++++
 .../porter/gateway/StaticWebpageDispatcher.java    |  52 +++++++
 ...cecomb.transport.rest.vertx.VertxHttpDispatcher |  19 +++
 .../src/main/resources/config/cse.handler.xml      |  21 +++
 .../src/main/resources/microservice.yaml           |  45 ++++++
 .../src/main/resources/ui/css/style.css            |  49 ++++++
 .../src/main/resources/ui/js/jquery-1.11.1.min.js  |   4 +
 .../src/main/resources/ui/js/login.js              |  52 +++++++
 .../src/main/resources/ui/js/upload.js             |  63 ++++++++
 .../src/main/resources/ui/login.html               |  45 ++++++
 .../src/main/resources/ui/upload.html              |  61 ++++++++
 porter_lightweight/pom.xml                         | 165 +++++++++++++++++++++
 porter_lightweight/user-service/.gitignore         |   1 +
 porter_lightweight/user-service/pom.xml            |  85 +++++++++++
 .../servicecomb/samples/porter/user/UserMain.java  |  28 ++++
 .../samples/porter/user/dao/SessionInfoModel.java  |  90 +++++++++++
 .../samples/porter/user/dao/SessionMapper.java     |  28 ++++
 .../samples/porter/user/dao/UserInfo.java          |  61 ++++++++
 .../samples/porter/user/dao/UserMapper.java        |  24 +++
 .../porter/user/service/UserServiceImpl.java       | 114 ++++++++++++++
 .../main/resources/META-INF/spring/user.bean.xml   |  57 +++++++
 .../src/main/resources/config/SessionMapper.xml    |  57 +++++++
 .../src/main/resources/config/UserMapper.xml       |  46 ++++++
 .../src/main/resources/config/create_db_user.sql   |  46 ++++++
 .../src/main/resources/config/mybatis-config.xml   |  27 ++++
 .../src/main/resources/microservice.yaml           |  27 ++++
 48 files changed, 2362 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..67e5a7d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,85 @@
+# Output Directory
+target/
+
+# C pre-compile
+*.gch
+*.pch
+
+# C compile
+*.a
+*.o
+*.ko
+*.la
+*.lo
+*.obj
+*.elf
+*.so
+*.so.*
+*.dylib
+*.exe
+*.lib
+*.dll
+*.out
+*.app
+*.hex
+
+# Debug files
+*.dSYM/
+
+# Java
+*.class
+
+# Java Package Files
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# Zip Files
+*.rar
+*.zip
+*.7z
+*.tar
+*.gz
+
+# Ant
+build/
+
+# Compiled Python
+__pycache__/
+*.py[cod]
+*py.class
+
+# Eclipse
+.settings/
+.classpath
+.project
+
+# IntelliJ, based on http://devnet.jetbrains.net/docs/DOC-1186
+.idea/
+*.iml
+*.ipr
+*.iws
+
+# logs and trace
+*.log
+*.trace
+*.dat
+
+# vi swap
+*.swp
+
+# Backup Files
+*.bak
+*.old
+
+# SVN metadata
+.svn/
+
+# Mac
+.DS_Store
+
+# gradle
+.gradle
diff --git a/README.md b/README.md
index 3cf272a..ac5abc5 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,4 @@
 # servicecomb samples
 
+## porter_lightweight
+A sample shows an application with basic login, download file, delete file functions. 
diff --git a/porter_lightweight/README.md b/porter_lightweight/README.md
new file mode 100644
index 0000000..ef8c671
--- /dev/null
+++ b/porter_lightweight/README.md
@@ -0,0 +1,82 @@
+This project shows how to using java-chassis and service-center to create a simple microservice application. It shows basic authentication and authorization, uploading files and delte files operations.
+
+## build and run
+
+* compile
+
+```
+mvn clean install
+```
+
+* run
+  * create a database using mysql with user name and password(e.g. root/root)
+  * execute create_db_user.sql
+
+* run user-service:
+
+```
+java $JAVA_OPT -Ddb.url="jdbc:mysql://localhost/porter_user_db?useSSL=false" -Ddb.username=root -Ddb.password=root -jar porter-user-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+* run file-service:
+
+```
+java $JAVA_OPT -jar porter-file-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+* run gateway-serivce:
+
+gateway-service contains static webpages in resources/ui. First copy to web root folder,e.g webapp, which is relative to working directory. 
+
+```
+java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+## Try it
+
+1. Using browser: http://localhost:9090/ui/login.html with user admin or guest to login, password is test.
+2. Choose a file to upload. Uploaded file is stored in file-service workding directory. And name is random number generated. 
+3. Delete file. Input the random number generated in step 2. 
+
+
+这个项目帮助开发者学习如何使用ServiceComb开发完整的微服务。 这个项目实现的功能非常简单,用户登录后,上传一个文件和删除一个文件,验证了没有权限的用户无法删除文件。
+
+# 编译和运行
+
+* 编译
+
+```
+mvn clean install
+```
+
+* 运行
+  * 安装mysql数据库,设置用户名密码(假设为root/root)
+  * 执行脚本create_db_user.sql
+
+
+* 启动user-service:
+
+```
+java $JAVA_OPT -Ddb.url="jdbc:mysql://localhost/porter_user_db?useSSL=false" -Ddb.username=root -Ddb.password=root -jar porter-user-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+* 启动file-service:
+
+```
+java $JAVA_OPT -jar porter-file-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+* 启动gateway-serivce:
+
+gateway-service包含了静态页面文件,在resources/ui目录。首先需要将页面文件拷贝到WEB主目录(相对路径,当前运行目录),比如: webapp,然后将ui目录整体拷贝到webapp/ui目录。启动:
+```
+java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
+```
+
+# 使用
+
+1. 输入: http://localhost:9090/ui/login.html 使用admin或者guest登陆,密码为test。
+2. 选择一个文件上传,上传成功,上传成功后的文件会保存在file-service的当前目录, 文件名称是一个随机的数字,这个数字就是文件ID。
+3. 删除文件:输入上一步的文件ID,点击删除。 如果是admin用户,上传成功;如果是guest用户,上传失败。
+
+
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/common/pom.xml
new file mode 100644
index 0000000..772ec4e
--- /dev/null
+++ b/porter_lightweight/common/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.samples.porter</groupId>
+    <artifactId>porter-application</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>porter-common</artifactId>
+  <packaging>jar</packaging>
+
+</project>
diff --git a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java b/porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java
new file mode 100644
index 0000000..e7c1f0c
--- /dev/null
+++ b/porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java
@@ -0,0 +1,51 @@
+/*
+ * 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 samples.porter.file.api;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestSchema(schemaId = "file")
+@RequestMapping(path = "/")
+public class FileEndpoint {
+  @Autowired
+  private FileService fileService;
+  
+  /**
+   * upload and return file id
+   */
+  @PostMapping(path = "/upload", produces = MediaType.TEXT_PLAIN_VALUE)
+  public String uploadFile(@RequestPart(name = "fileName") MultipartFile file) {
+      return fileService.uploadFile(file);
+  }
+
+  /**
+   * delete file by id
+   */
+  @DeleteMapping(path = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
+  public boolean deleteFile(@RequestParam(name = "id") String id) {
+      return fileService.deleteFile(id);
+  }
+}
diff --git a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.java b/porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.java
new file mode 100644
index 0000000..606e727
--- /dev/null
+++ b/porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.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 samples.porter.file.api;
+
+import org.springframework.web.multipart.MultipartFile;
+
+public interface FileService {
+  public String uploadFile(MultipartFile file);
+
+  public boolean deleteFile(String id);
+}
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java b/porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java
new file mode 100644
index 0000000..2aca62b
--- /dev/null
+++ b/porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java
@@ -0,0 +1,50 @@
+/*
+ * 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 samples.porter.user.api;
+
+public class SessionInfo {
+  private String sessiondId;
+
+  private String userName;
+
+  private String roleName;
+
+  public String getSessiondId() {
+    return sessiondId;
+  }
+
+  public void setSessiondId(String sessiondId) {
+    this.sessiondId = sessiondId;
+  }
+
+  public String getUserName() {
+    return userName;
+  }
+
+  public void setUserName(String userName) {
+    this.userName = userName;
+  }
+
+  public String getRoleName() {
+    return roleName;
+  }
+
+  public void setRoleName(String roleName) {
+    this.roleName = roleName;
+  }
+}
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java b/porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java
new file mode 100644
index 0000000..8a248d3
--- /dev/null
+++ b/porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java
@@ -0,0 +1,49 @@
+/*
+ * 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 samples.porter.user.api;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "user")
+@RequestMapping(path = "/")
+public class UserEndpoint {
+  @Autowired
+  private UserService userService;
+
+  @PostMapping(path = "/v1/user/login", produces = MediaType.APPLICATION_JSON_VALUE)
+  public SessionInfo login(@RequestParam(name = "userName") String userName,
+      @RequestParam(name = "password") String password) {
+    return userService.login(userName, password);
+  }
+
+  @GetMapping(path = "/v1/user/session", produces = MediaType.APPLICATION_JSON_VALUE)
+  public SessionInfo getSession(@RequestParam(name = "sessionId") String sessionId) {
+    return userService.getSession(sessionId);
+  }
+
+  @GetMapping(path = "/v1/user/ping", produces = MediaType.APPLICATION_JSON_VALUE)
+  public String ping(@RequestParam(name = "message") String message) {
+    return userService.ping(message);
+  }
+}
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.java b/porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.java
new file mode 100644
index 0000000..a37ffa3
--- /dev/null
+++ b/porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.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 samples.porter.user.api;
+
+public interface UserService {
+  public SessionInfo login(String userName,
+      String password);
+
+  public SessionInfo getSession(String sessionId);
+
+  public String ping(String message);
+}
diff --git a/porter_lightweight/common/src/main/resources/microservice.yaml b/porter_lightweight/common/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..9e3de6e
--- /dev/null
+++ b/porter_lightweight/common/src/main/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+servicecomb-config-order: 10
+
+APPLICATION_ID: porter-application
+service_description:
+  version: 0.0.1
+
+servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
\ No newline at end of file
diff --git a/porter_lightweight/file-service/pom.xml b/porter_lightweight/file-service/pom.xml
new file mode 100644
index 0000000..d42ed5c
--- /dev/null
+++ b/porter_lightweight/file-service/pom.xml
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.samples.porter</groupId>
+    <artifactId>porter-application</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>porter-file-service</artifactId>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>porter-common</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+  </dependencies>
+  <properties>
+    <main.class>org.apache.servicecomb.samples.porter.file.FileMain</main.class>
+  </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java
new file mode 100644
index 0000000..9b13142
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java
@@ -0,0 +1,28 @@
+/*
+ * 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.samples.porter.file;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+public class FileMain {
+    public static void main(String[] args) throws Exception {
+        Log4jUtils.init();
+        BeanUtils.init();
+    }
+}
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java
new file mode 100644
index 0000000..78aea60
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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.samples.porter.file.service;
+
+import org.apache.servicecomb.foundation.common.utils.JsonUtils;
+import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+@Service
+public class FileServiceImpl implements samples.porter.file.api.FileService {
+    @Autowired
+    private FileStoreService fileService;
+
+    public String uploadFile(MultipartFile file) {
+        return fileService.uploadFile(file);
+    }
+
+    public boolean deleteFile(String id) {
+        String session = ContextUtils.getInvocationContext().getContext("session-info");
+        if (session == null) {
+            throw new InvocationException(403, "", "not allowed");
+        } else {
+            SessionInfo sessionInfo = null;
+            try {
+                sessionInfo = JsonUtils.readValue(session.getBytes("UTF-8"), SessionInfo.class);
+            } catch (Exception e) {
+                throw new InvocationException(403, "", "session not allowed");
+            }
+            if (sessionInfo == null || !sessionInfo.getRoleName().equals("admin")) {
+                throw new InvocationException(403, "", "not allowed");
+            }
+        }
+        return fileService.deleteFile(id);
+    }
+}
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileStoreService.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileStoreService.java
new file mode 100644
index 0000000..f9ff5c9
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileStoreService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.samples.porter.file.service;
+
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * file storage service, can implement using file system, OBS, etc.
+ */
+public interface FileStoreService {
+
+    public String uploadFile(MultipartFile file);
+
+    public boolean deleteFile(String id);
+
+}
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/LocalFileStoreService.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/LocalFileStoreService.java
new file mode 100644
index 0000000..adb8b19
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/LocalFileStoreService.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.samples.porter.file.service;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.UUID;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ *  Simple file storage implementation.
+ *  Caution: file check and other security constraints not implemented. 
+ */
+@Component
+public class LocalFileStoreService implements FileStoreService {
+    // maxmum BUFFER_SIZE * BUFFER_NUM
+    private static final int BUFFER_SIZE = 10240;
+
+    private static final File BASE_FILE = new File(".");
+
+    @Override
+    public String uploadFile(MultipartFile file) {
+        byte[] buffer = new byte[BUFFER_SIZE];
+        String fileId = UUID.randomUUID().toString();
+
+        File outFile = new File(BASE_FILE, fileId);
+        int len;
+        try (InputStream is = file.getInputStream(); OutputStream os = new FileOutputStream(outFile)) {
+            while ((len = is.read(buffer)) != -1) {
+                os.write(buffer, 0, len);
+            }
+        } catch (IOException e) {
+            return null;
+        }
+        return fileId;
+    }
+
+    @Override
+    public boolean deleteFile(String id) {
+        File outFile = new File(BASE_FILE, id);
+        return outFile.delete();
+    }
+
+}
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/SessionInfo.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/SessionInfo.java
new file mode 100644
index 0000000..eeff226
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/SessionInfo.java
@@ -0,0 +1,81 @@
+/*
+ * 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.samples.porter.file.service;
+
+public class SessionInfo {
+    private int id;
+
+    private String sessiondId;
+
+    private String userName;
+
+    private String roleName;
+
+    private java.sql.Timestamp creationTime;
+
+    private java.sql.Timestamp activeTime;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getSessiondId() {
+        return sessiondId;
+    }
+
+    public void setSessiondId(String sessiondId) {
+        this.sessiondId = sessiondId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public java.sql.Timestamp getCreationTime() {
+        return creationTime;
+    }
+
+    public void setCreationTime(java.sql.Timestamp creationTime) {
+        this.creationTime = creationTime;
+    }
+
+    public java.sql.Timestamp getActiveTime() {
+        return activeTime;
+    }
+
+    public void setActiveTime(java.sql.Timestamp activeTime) {
+        this.activeTime = activeTime;
+    }
+
+}
diff --git a/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml b/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml
new file mode 100644
index 0000000..4a3846c
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:util="http://www.springframework.org/schema/util"
+    xmlns:context="http://www.springframework.org/schema/context"
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <!-- Only scan file components. Other beans in common module like org.apache.servicecomb.samples.porter.user.api.UserEndpoint ignored. -->
+    <context:component-scan base-package="samples.porter.file" />
+</beans>
\ No newline at end of file
diff --git a/porter_lightweight/file-service/src/main/resources/microservice.yaml b/porter_lightweight/file-service/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..bb71959
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+# override common configurations in common module
+servicecomb-config-order: 10
+
+service_description:
+  name: file-service
+
+servicecomb:
+  rest:
+    address: 0.0.0.0:9091
+
+  uploads:
+    directory: tmp_for_upload_file
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/pom.xml b/porter_lightweight/gateway-service/pom.xml
new file mode 100644
index 0000000..427c75e
--- /dev/null
+++ b/porter_lightweight/gateway-service/pom.xml
@@ -0,0 +1,58 @@
+<!--
+  ~ 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.samples.porter</groupId>
+    <artifactId>porter-application</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>porter-gateway-service</artifactId>
+  <packaging>jar</packaging>
+
+  <properties>
+    <main.class>org.apache.servicecomb.samples.porter.gateway.GatewayMain</main.class>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>porter-common</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>edge-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>metrics-core</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
new file mode 100644
index 0000000..c80f42a
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
@@ -0,0 +1,68 @@
+/*
+ * 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.samples.porter.gateway;
+
+import java.util.Map;
+
+import org.apache.servicecomb.edge.core.AbstractEdgeDispatcher;
+import org.apache.servicecomb.edge.core.EdgeInvocation;
+
+import io.vertx.ext.web.Cookie;
+import io.vertx.ext.web.Router;
+import io.vertx.ext.web.RoutingContext;
+import io.vertx.ext.web.handler.CookieHandler;
+
+public class ApiDispatcher extends AbstractEdgeDispatcher {
+  @Override
+  public int getOrder() {
+    return 10002;
+  }
+
+  @Override
+  public void init(Router router) {
+    String regex = "/api/([^\\/]+)/(.*)";
+    router.routeWithRegex(regex).handler(CookieHandler.create());
+    router.routeWithRegex(regex).handler(createBodyHandler());
+    router.routeWithRegex(regex).failureHandler(this::onFailure).handler(this::onRequest);
+  }
+
+  protected void onRequest(RoutingContext context) {
+    Map<String, String> pathParams = context.pathParams();
+    String microserviceName = pathParams.get("param0");
+    String path = "/" + pathParams.get("param1");
+
+    EdgeInvocation invoker = new EdgeInvocation() {
+      // 认证鉴权:构造Invocation的时候,设置会话信息。如果是认证请求,则添加Cookie。
+      protected void createInvocation() {
+        super.createInvocation();
+        // 既从cookie里面读取会话ID,也从header里面读取,方便各种独立的测试工具联调
+        String sessionId = context.request().getHeader("session-id");
+        if (sessionId != null) {
+          this.invocation.addContext("session-id", sessionId);
+        } else {
+          Cookie sessionCookie = context.getCookie("session-id");
+          if (sessionCookie != null) {
+            this.invocation.addContext("session-id", sessionCookie.getValue());
+          }
+        }
+      }
+    };
+    invoker.init(microserviceName, context, path, httpServerFilters);
+    invoker.edgeInvoke();
+  }
+}
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
new file mode 100644
index 0000000..73cc06d
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
@@ -0,0 +1,105 @@
+/*
+ * 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.samples.porter.gateway;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.servicecomb.core.Handler;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.foundation.common.utils.JsonUtils;
+import org.apache.servicecomb.provider.springmvc.reference.async.CseAsyncRestTemplate;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+import org.apache.servicecomb.swagger.invocation.Response;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.concurrent.ListenableFuture;
+import org.springframework.util.concurrent.ListenableFutureCallback;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+import samples.porter.user.api.SessionInfo;
+
+
+public class AuthHandler implements Handler {
+  private CseAsyncRestTemplate restTemplate = new CseAsyncRestTemplate();
+
+  //服务端会话过期是10分钟,客户端缓存1分钟会话。
+  private Cache<String, String> sessionCache = CacheBuilder.newBuilder()
+      .expireAfterAccess(30, TimeUnit.SECONDS)
+      .build();
+
+  @Override
+  public void handle(Invocation invocation, AsyncResponse asyncResponse) throws Exception {
+    if (invocation.getMicroserviceName().equals("user-service")
+        && (invocation.getOperationName().equals("login")
+            || (invocation.getOperationName().equals("getSession")))) {
+      // login: 直接返回认证结果。  开发者需要在JS里面设置cookie。 
+      invocation.next(asyncResponse);
+    } else {
+      // check session
+      String sessionId = invocation.getContext("session-id");
+      if (sessionId == null) {
+        throw new InvocationException(403, "", "session is not valid.");
+      }
+
+      String sessionInfo = sessionCache.getIfPresent(sessionId);
+      if (sessionInfo != null) {
+        try {
+          // 将会话信息传递给后面的微服务。后面的微服务可以从context获取到会话信息,从而可以进行鉴权等。 
+          invocation.addContext("session-id", sessionId);
+          invocation.addContext("session-info", sessionInfo);
+          invocation.next(asyncResponse);
+        } catch (Exception e) {
+          asyncResponse.complete(Response.failResp(new InvocationException(500, "", e.getMessage())));
+        }
+        return;
+      }
+
+      // 在网关执行的Hanlder逻辑,是reactive模式的,不能使用阻塞调用。
+      ListenableFuture<ResponseEntity<SessionInfo>> sessionInfoFuture =
+          restTemplate.getForEntity("cse://user-service/v1/user/session?sessionId=" + sessionId, SessionInfo.class);
+      sessionInfoFuture.addCallback(
+          new ListenableFutureCallback<ResponseEntity<SessionInfo>>() {
+            @Override
+            public void onFailure(Throwable ex) {
+              asyncResponse.complete(Response.failResp(new InvocationException(403, "", "session is not valid.")));
+            }
+
+            @Override
+            public void onSuccess(ResponseEntity<SessionInfo> result) {
+              SessionInfo sessionInfo = result.getBody();
+              if (sessionInfo == null) {
+                asyncResponse.complete(Response.failResp(new InvocationException(403, "", "session is not valid.")));
+                return;
+              }
+              try {
+                // 将会话信息传递给后面的微服务。后面的微服务可以从context获取到会话信息,从而可以进行鉴权等。 
+                invocation.addContext("session-id", sessionId);
+                String sessionInfoStr = JsonUtils.writeValueAsString(sessionInfo);
+                invocation.addContext("session-info", sessionInfoStr);
+                invocation.next(asyncResponse);
+                sessionCache.put(sessionId, sessionInfoStr);
+              } catch (Exception e) {
+                asyncResponse.complete(Response.failResp(new InvocationException(500, "", e.getMessage())));
+              }
+            }
+          });
+    }
+  }
+}
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java
new file mode 100644
index 0000000..159c10d
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java
@@ -0,0 +1,38 @@
+/*
+ * 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.samples.porter.gateway;
+
+import java.io.File;
+
+import org.apache.servicecomb.foundation.ssl.SSLCustom;
+
+public class EdgeSSLCustom extends SSLCustom {
+
+    @Override
+    public char[] decode(char[] plain) {
+        return plain;
+    }
+
+    @Override
+    public String getFullPath(String name) {
+        String fullName = System.getProperty("user.dir") + File.separator + name;
+        System.out.println(fullName);
+        return (new File(fullName)).getAbsolutePath();
+    }
+
+}
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java
new file mode 100644
index 0000000..48c1824
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java
@@ -0,0 +1,28 @@
+/*
+ * 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.samples.porter.gateway;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+public class GatewayMain {
+    public static void main(String[] args) throws Exception {
+        Log4jUtils.init();
+        BeanUtils.init();
+    }
+}
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java
new file mode 100644
index 0000000..791c512
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java
@@ -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.
+ */
+
+package org.apache.servicecomb.samples.porter.gateway;
+
+import org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicPropertyFactory;
+
+import io.vertx.ext.web.Router;
+import io.vertx.ext.web.handler.StaticHandler;
+
+public class StaticWebpageDispatcher implements VertxHttpDispatcher {
+  private static final Logger LOGGER = LoggerFactory.getLogger(StaticWebpageDispatcher.class);
+
+  private static final String WEB_ROOT = DynamicPropertyFactory.getInstance()
+      .getStringProperty("gateway.webroot", "/var/static")
+      .get();
+
+  @Override
+  public int getOrder() {
+    return Integer.MAX_VALUE;
+  }
+
+  @Override
+  public void init(Router router) {
+    String regex = "/ui/(.*)";
+    StaticHandler webpageHandler = StaticHandler.create();
+    webpageHandler.setWebRoot(WEB_ROOT);
+    LOGGER.info("server static web page for WEB_ROOT={}", WEB_ROOT);
+    router.routeWithRegex(regex).failureHandler((context) -> {
+      LOGGER.error("", context.failure());
+    }).handler(webpageHandler);
+  }
+
+}
diff --git a/porter_lightweight/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher b/porter_lightweight/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
new file mode 100644
index 0000000..71009db
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.servicecomb.samples.porter.gateway.ApiDispatcher
+org.apache.servicecomb.samples.porter.gateway.StaticWebpageDispatcher
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml b/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml
new file mode 100644
index 0000000..00295f8
--- /dev/null
+++ b/porter_lightweight/gateway-service/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="auth"
+			 class="org.apache.servicecomb.samples.porter.gateway.AuthHandler" />
+</config>
diff --git a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..5623c60
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
@@ -0,0 +1,45 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# override common configurations in common module
+servicecomb-config-order: 100
+
+service_description:
+  name: gateway-service
+
+servicecomb:
+  rest:
+    address: 0.0.0.0:9090?sslEnabled=false
+
+  handler:
+    chain:
+      Consumer:
+        default: auth,qps-flowcontrol-consumer,loadbalance
+
+  uploads:
+    directory: tmp_for_upload_gateway
+
+  accesslog:
+    enabled: true
+  metrics:
+    window_time: 30000
+    publisher.defaultLog.enabled: true
+
+servicecomb.http.dispatcher.edge.default.enabled: false
+servicecomb.http.dispatcher.rest.enabled: false
+gateway.webroot: /code/servicecomb-samples/porter_lightweight/gateway-service/src/main/resources
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/css/style.css b/porter_lightweight/gateway-service/src/main/resources/ui/css/style.css
new file mode 100644
index 0000000..5731863
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/css/style.css
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+.error {
+    font-family:verdana;
+    color:red;
+}
+
+.header {
+    background-color:black;
+    color:white;
+    text-align:center;
+    padding:5px;
+}
+
+.nav {
+    line-height:30px;
+    background-color:#eeeeee;
+    height:300px;
+    width:100px;
+    float:left;
+    padding:5px; 
+}
+
+.section {
+    text-align:center;
+    padding:5px;
+}
+
+.footer {
+    color:red;
+    clear:both;
+    text-align:center;
+    padding:25px; 
+}
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/js/jquery-1.11.1.min.js b/porter_lightweight/gateway-service/src/main/resources/ui/js/jquery-1.11.1.min.js
new file mode 100644
index 0000000..ab28a24
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/js/jquery-1.11.1.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b [...]
+if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&& [...]
+},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.prop [...]
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/js/login.js b/porter_lightweight/gateway-service/src/main/resources/ui/js/login.js
new file mode 100644
index 0000000..c7e7c8e
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/js/login.js
@@ -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.
+ */
+
+function loginAction() {
+     var username = document.getElementById("username").value;
+     var password = document.getElementById("paasword").value;
+     var formData = {};
+     formData.userName = username;
+     formData.password = password;
+
+     $.ajax({
+        type: 'POST',
+        url: "/api/user-service/v1/user/login",
+        data: formData,
+        success: function (data) {
+            console.log(data);
+            setCookie("session-id", data.sessiondId, 1);
+            window.location = "/ui/upload.html";
+        },
+        error: function(data) {
+            console.log(data);
+            var error = document.getElementById("error");
+            error.textContent="Login failed";
+            error.hidden=false;
+        },
+        async: true
+    });
+}
+
+function setCookie(name,value,days) {
+    var expires = "";
+    if (days) {
+        var date = new Date();
+        date.setTime(date.getTime() + (days*24*60*60*1000));
+        expires = "; expires=" + date.toUTCString();
+    }
+    document.cookie = name + "=" + (value || "")  + expires + "; path=/";
+}
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/js/upload.js b/porter_lightweight/gateway-service/src/main/resources/ui/js/upload.js
new file mode 100644
index 0000000..7d66555
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/js/upload.js
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+function uploadAction() {
+     var formData = new FormData(document.getElementById("upload_form"));
+
+     $.ajax({
+        type: 'POST',
+        url: "/api/file-service/upload",
+        data: formData,
+        processData:false,
+        contentType:false,
+        success: function (data) {
+            console.log(data);
+            var error = document.getElementById("error");
+            error.textContent="Upload Successfully";
+            error.hidden=false;
+        },
+        error: function(data) {
+            console.log(data);
+            var error = document.getElementById("error");
+            error.textContent="Upload failed";
+            error.hidden=false;
+        },
+        async: true
+    });
+}
+
+function deleteAction() {
+     var fileID = document.getElementById("fileID").value;
+     $.ajax({
+        type: 'DELETE',
+        url: "/api/file-service/delete?" + $.param({ id: fileID }),
+        data: {},
+        success: function (data) {
+            console.log(data);
+            var error = document.getElementById("error");
+            error.textContent="Delete successfully";
+            error.hidden=false;
+        },
+        error: function(data) {
+            console.log(data);
+            var error = document.getElementById("error");
+            error.textContent="Delete failed";
+            error.hidden=false;
+        },
+        async: true
+    });
+}
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/login.html b/porter_lightweight/gateway-service/src/main/resources/ui/login.html
new file mode 100644
index 0000000..c8b45fb
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/login.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+
+<!--
+  ~ 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.
+  -->
+
+<html>
+
+    <head>
+        <title>PORTER</title>
+        <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
+        <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
+        <script type="text/javascript" src="js/login.js"></script>
+    </head>
+
+    <body>
+    <div class="header">
+        <h2>Login</h2>
+    </div>
+    <div class="section">
+        <form method="POST" enctype="multipart/form-data">
+            <input id="username" type="text" placeholder="Username" required="true"/>
+            <input id="paasword" type="password" placeholder="Password" required="true"/>
+            <input type="button" value="Login" onclick="loginAction()">
+        </form>
+    </div>
+    <div class="footer">
+        <p id="error" hidden="true" class="error"/>
+    </div>
+    </body>
+
+</html>
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/resources/ui/upload.html b/porter_lightweight/gateway-service/src/main/resources/ui/upload.html
new file mode 100644
index 0000000..bd5eeff
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/ui/upload.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html>
+
+    <head>
+        <title>PORTER</title>
+        <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
+        <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
+        <script type="text/javascript" src="js/upload.js"></script>
+    </head>
+
+    <body>
+    <div class="header">
+        <h2>Upload</h2>
+    </div>
+    <div class="section">
+        <form id="upload_form" method="POST">
+            <p>
+                File Name: <input type="file" name="fileName"/>
+            </p>
+            <p>
+                <input type="button" value="Upload" onclick="uploadAction()">
+            </p>
+        </form>
+    </div>
+
+    <div class="header">
+        <h2>Delete file</h2>
+    </div>
+    <div class="section">
+        <form id="delete_form" method="DELETE">
+            <p>
+                File ID: <input id="fileID" type="text"/>
+            </p>
+            <p>
+                <input type="button" value="Delete" onclick="deleteAction()">
+            </p>
+        </form>
+    </div>
+    <div class="footer">
+        <p id="error" hidden="true" class="error"/>
+    </div>
+    </body>
+
+</html>
\ No newline at end of file
diff --git a/porter_lightweight/pom.xml b/porter_lightweight/pom.xml
new file mode 100644
index 0000000..5a7e539
--- /dev/null
+++ b/porter_lightweight/pom.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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>
+
+  <groupId>org.apache.servicecomb.samples.porter</groupId>
+  <artifactId>porter-application</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.mybatis</groupId>
+        <artifactId>mybatis</artifactId>
+        <version>3.4.5</version>
+      </dependency>
+      <dependency>
+        <groupId>org.mybatis</groupId>
+        <artifactId>mybatis-spring</artifactId>
+        <version>1.3.0</version>
+      </dependency>
+      <dependency>
+        <groupId>mysql</groupId>
+        <artifactId>mysql-connector-java</artifactId>
+        <version>5.1.46</version>
+      </dependency>
+      <!-- need to compile lastest java-chassis code -->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+    </dependency>
+  </dependencies>
+
+  <modules>
+    <module>common</module>
+    <module>file-service</module>
+    <module>user-service</module>
+    <module>gateway-service</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.1</version>
+          <configuration>
+            <source>1.8</source>
+            <target>1.8</target>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-deploy-plugin</artifactId>
+          <version>2.8.2</version>
+          <configuration>
+            <skip>true</skip>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-install-plugin</artifactId>
+          <version>2.5.2</version>
+          <configuration>
+            <skip>false</skip>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>2.6</version>
+          <configuration>
+            <outputDirectory>${project.build.directory}</outputDirectory>
+            <archive>
+              <manifestEntries>
+                <Class-Path>.</Class-Path>
+              </manifestEntries>
+            </archive>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-war-plugin</artifactId>
+          <version>2.6</version>
+          <configuration>
+            <outputDirectory>${project.build.directory}</outputDirectory>
+            <archive>
+              <manifest>
+                <addClasspath>true</addClasspath>
+                <classpathPrefix>./lib/</classpathPrefix>
+              </manifest>
+              <manifestEntries>
+                <Class-Path>.</Class-Path>
+              </manifestEntries>
+            </archive>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>2.10</version>
+          <executions>
+            <execution>
+              <id>copy-dependencies</id>
+              <phase>package</phase>
+              <goals>
+                <goal>copy-dependencies</goal>
+              </goals>
+              <configuration>
+                <outputDirectory>${project.build.directory}/lib</outputDirectory>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-maven-plugin</artifactId>
+          <version>2.1.2.RELEASE</version>
+          <executions>
+            <execution>
+              <goals>
+                <goal>repackage</goal>
+              </goals>
+              <configuration>
+                <mainClass>${main.class}</mainClass>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/.gitignore b/porter_lightweight/user-service/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/porter_lightweight/user-service/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/porter_lightweight/user-service/pom.xml b/porter_lightweight/user-service/pom.xml
new file mode 100644
index 0000000..04c50ae
--- /dev/null
+++ b/porter_lightweight/user-service/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.samples.porter</groupId>
+    <artifactId>porter-application</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>porter-user-service</artifactId>
+  <packaging>jar</packaging>
+
+  <properties>
+    <main.class>org.apache.servicecomb.samples.porter.user.UserMain</main.class>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>porter-common</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mybatis</groupId>
+      <artifactId>mybatis</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-dbcp2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mybatis</groupId>
+      <artifactId>mybatis-spring</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-jdbc</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aop</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-tx</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java
new file mode 100644
index 0000000..390b040
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java
@@ -0,0 +1,28 @@
+/*
+ * 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.samples.porter.user;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+public class UserMain {
+  public static void main(String[] args) throws Exception {
+    Log4jUtils.init();
+    BeanUtils.init();
+  }
+}
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java
new file mode 100644
index 0000000..f363af5
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java
@@ -0,0 +1,90 @@
+/*
+ * 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.samples.porter.user.dao;
+
+import samples.porter.user.api.SessionInfo;
+
+public class SessionInfoModel {
+  private int id;
+
+  private String sessiondId;
+
+  private String userName;
+
+  private String roleName;
+
+  private java.sql.Timestamp creationTime;
+
+  private java.sql.Timestamp activeTime;
+
+  public int getId() {
+    return id;
+  }
+
+  public void setId(int id) {
+    this.id = id;
+  }
+
+  public String getSessiondId() {
+    return sessiondId;
+  }
+
+  public void setSessiondId(String sessiondId) {
+    this.sessiondId = sessiondId;
+  }
+
+  public String getUserName() {
+    return userName;
+  }
+
+  public void setUserName(String userName) {
+    this.userName = userName;
+  }
+
+  public String getRoleName() {
+    return roleName;
+  }
+
+  public void setRoleName(String roleName) {
+    this.roleName = roleName;
+  }
+
+  public java.sql.Timestamp getCreationTime() {
+    return creationTime;
+  }
+
+  public void setCreationTime(java.sql.Timestamp creationTime) {
+    this.creationTime = creationTime;
+  }
+
+  public java.sql.Timestamp getActiveTime() {
+    return activeTime;
+  }
+
+  public void setActiveTime(java.sql.Timestamp activeTime) {
+    this.activeTime = activeTime;
+  }
+
+  public static SessionInfo toSessionInfo(SessionInfoModel entity) {
+    SessionInfo info = new SessionInfo();
+    info.setSessiondId(entity.getSessiondId());
+    info.setUserName(entity.getUserName());
+    info.setRoleName(entity.getRoleName());
+    return info;
+  }
+}
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java
new file mode 100644
index 0000000..fb3306b
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java
@@ -0,0 +1,28 @@
+/*
+ * 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.samples.porter.user.dao;
+
+import samples.porter.user.api.SessionInfo;
+
+public interface SessionMapper {
+    void createSession(SessionInfo sessionInfo);
+
+    SessionInfoModel getSessioinInfo(String sessionId);
+    
+    void updateSessionInfo(String sessionId);
+}
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserInfo.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserInfo.java
new file mode 100644
index 0000000..b0e2003
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserInfo.java
@@ -0,0 +1,61 @@
+/*
+ * 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.samples.porter.user.dao;
+
+public class UserInfo {
+    private int id;
+
+    private String userName;
+
+    private String password;
+
+    private String roleName;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+}
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserMapper.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserMapper.java
new file mode 100644
index 0000000..5c2d331
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/UserMapper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.samples.porter.user.dao;
+
+public interface UserMapper {
+    void createUser(UserInfo userInfo);
+
+    UserInfo getUserInfo(String userName);
+}
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
new file mode 100644
index 0000000..2633d57
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.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.samples.porter.user.service;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.servicecomb.samples.porter.user.dao.SessionInfoModel;
+import org.apache.servicecomb.samples.porter.user.dao.SessionMapper;
+import org.apache.servicecomb.samples.porter.user.dao.UserInfo;
+import org.apache.servicecomb.samples.porter.user.dao.UserMapper;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.netflix.config.DynamicPropertyFactory;
+
+import samples.porter.user.api.SessionInfo;
+import samples.porter.user.api.UserService;
+
+@Service
+public class UserServiceImpl implements UserService {
+  private static Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);
+
+  @Autowired
+  private UserMapper userMapper;
+
+  @Autowired
+  private SessionMapper sessionMapper;
+
+
+  public SessionInfo login(String userName,
+      String password) {
+    UserInfo userInfo = userMapper.getUserInfo(userName);
+    if (userInfo != null) {
+      if (validatePassword(password, userInfo.getPassword())) {
+        SessionInfo sessionInfo = new SessionInfo();
+        sessionInfo.setSessiondId(UUID.randomUUID().toString());
+        sessionInfo.setUserName(userInfo.getUserName());
+        sessionInfo.setRoleName(userInfo.getRoleName());
+        sessionMapper.createSession(sessionInfo);
+        return sessionInfo;
+      }
+    }
+    return null;
+  }
+
+  public SessionInfo getSession(String sessionId) {
+    if (sessionId == null) {
+      throw new InvocationException(405, "", "invalid session.");
+    }
+    SessionInfoModel sessionInfo = sessionMapper.getSessioinInfo(sessionId);
+    if (sessionInfo != null) {
+      if (System.currentTimeMillis() - sessionInfo.getActiveTime().getTime() > 10 * 60 * 1000) {
+        LOGGER.info("user session expired.");
+        return null;
+      } else {
+        sessionMapper.updateSessionInfo(sessionInfo.getSessiondId());
+        return SessionInfoModel.toSessionInfo(sessionInfo);
+      }
+    }
+    return null;
+  }
+
+  private boolean validatePassword(String plain, String encrypt) {
+    // 简单加密校验,开发者可以结合业务场景自行修改
+    try {
+      MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
+      messageDigest.update(plain.getBytes("UTF-8"));
+      byte byteBuffer[] = messageDigest.digest();
+      String encryptedText = Base64.encodeBase64String(byteBuffer);
+      return encryptedText.equals(encrypt);
+    } catch (NoSuchAlgorithmException e) {
+      LOGGER.error("", e);
+    } catch (UnsupportedEncodingException e) {
+      LOGGER.error("", e);
+    }
+    return false;
+  }
+
+
+  public String ping(String message) {
+    long delay = DynamicPropertyFactory.getInstance().getLongProperty("user.ping.delay", 0).get();
+    if (delay > 0) {
+      try {
+        TimeUnit.SECONDS.sleep(delay);
+      } catch (InterruptedException e) {
+        LOGGER.error("", e);
+      }
+    }
+    return message;
+  }
+}
diff --git a/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml b/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml
new file mode 100644
index 0000000..e1cdd94
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:util="http://www.springframework.org/schema/util"
+    xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:tx="http://www.springframework.org/schema/tx"
+    xsi:schemaLocation="
+		http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <context:component-scan base-package="samples.porter.user" >
+    </context:component-scan>
+
+    <bean id="dataSource"
+        class="org.apache.commons.dbcp2.BasicDataSource"
+        destroy-method="close">
+        <property name="driverClassName" value="${db.driverClassName:com.mysql.jdbc.Driver}" />
+        <property name="url"
+            value="${db.url:jdbc:mysql://localhost/porter_user_db}" />
+        <property name="username" value="${db.username:root}" />
+        <property name="password" value="${db.password:}" />
+    </bean>
+
+    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+        <property name="dataSource" ref="dataSource" />
+        <property name="configLocation" value="classpath:/config/mybatis-config.xml"></property>
+    </bean>
+
+    <bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
+        <property name="mapperInterface"
+            value="org.apache.servicecomb.samples.porter.user.dao.UserMapper" />
+        <property name="sqlSessionFactory" ref="sqlSessionFactory" />
+    </bean>
+    <bean id="sessionMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
+        <property name="mapperInterface"
+            value="org.apache.servicecomb.samples.porter.user.dao.SessionMapper" />
+        <property name="sqlSessionFactory" ref="sqlSessionFactory" />
+    </bean>
+</beans>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/resources/config/SessionMapper.xml b/porter_lightweight/user-service/src/main/resources/config/SessionMapper.xml
new file mode 100644
index 0000000..989e786
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/config/SessionMapper.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.servicecomb.samples.porter.user.dao.SessionMapper">
+    <resultMap id="sessionInfo" type="org.apache.servicecomb.samples.porter.user.dao.SessionInfoModel">
+        <result column="ID" jdbcType="INTEGER" property="id" />
+        <result column="SESSION_ID" jdbcType="VARCHAR" property="sessiondId" />
+        <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
+        <result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName" />
+        <result column="CREATION_TIME" jdbcType="TIMESTAMP" property="creationTime" />
+        <result column="ACTIVE_TIME" jdbcType="TIMESTAMP" property="activeTime" />
+    </resultMap>
+
+    <sql id="all_column">
+        ID, SESSION_ID, USER_NAME, ROLE_NAME, CREATION_TIME, ACTIVE_TIME
+    </sql>
+
+    <sql id="all_column_auto">
+        SESSION_ID, USER_NAME, ROLE_NAME
+    </sql>
+
+    <insert id="createSession" parameterType="org.apache.servicecomb.samples.porter.user.dao.SessionInfoModel">
+        insert into T_SESSION (
+        <include refid="all_column_auto" />
+        )
+        values (#{sessiondId,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR},
+        #{roleName,jdbcType=VARCHAR})
+    </insert>
+
+    <select id="getSessioinInfo" parameterType="java.lang.String"
+        resultMap="sessionInfo">
+        select
+        <include refid="all_column" />
+        from T_SESSION where SESSION_ID = #{0,jdbcType=VARCHAR}
+    </select>
+    
+    <update id="updateSessionInfo" parameterType="java.lang.String">
+        update T_SESSION
+        set CREATION_TIME = CREATION_TIME where SESSION_ID = #{0,jdbcType=VARCHAR};
+    </update>
+</mapper>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/resources/config/UserMapper.xml b/porter_lightweight/user-service/src/main/resources/config/UserMapper.xml
new file mode 100644
index 0000000..c02e60d
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/config/UserMapper.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.servicecomb.samples.porter.user.dao.UserMapper">
+    <resultMap id="userInfo" type="org.apache.servicecomb.samples.porter.user.dao.UserInfo">
+        <result column="ID" jdbcType="INTEGER" property="id" />
+        <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
+        <result column="PASSWORD" jdbcType="VARCHAR" property="password" />
+        <result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName" />
+    </resultMap>
+
+    <sql id="all_column">
+        ID, USER_NAME, PASSWORD, ROLE_NAME
+    </sql>
+
+    <insert id="createUser" parameterType="org.apache.servicecomb.samples.porter.user.dao.UserInfo">
+        insert into T_USER (
+        <include refid="all_column" />
+        )
+        values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR},
+        #{password,jdbcType=VARCHAR},#{roleName,jdbcType=VARCHAR})
+    </insert>
+
+    <select id="getUserInfo" parameterType="java.lang.String"
+        resultMap="userInfo">
+        select
+        <include refid="all_column" />
+        from T_USER where USER_NAME = #{0,jdbcType=VARCHAR}
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql b/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql
new file mode 100644
index 0000000..3505f3d
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+CREATE DATABASE IF NOT EXISTS porter_user_db;
+
+USE porter_user_db;
+
+DROP TABLE IF EXISTS T_USER;
+
+CREATE TABLE `T_USER` (
+  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
+  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT '用户名称',
+  `PASSWORD`  VARCHAR(64) NOT NULL COMMENT '用户密码',
+  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT '角色名称',
+  PRIMARY KEY (`ID`)
+);
+
+#### password is encrypted for test
+insert into T_USER(USER_NAME, PASSWORD, ROLE_NAME) values("admin", "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=", "admin");
+insert into T_USER(USER_NAME, PASSWORD, ROLE_NAME) values("guest", "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=", "guest");
+
+DROP TABLE IF EXISTS T_SESSION;
+
+CREATE TABLE `T_SESSION` (
+  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT '唯一标识',
+  `SESSION_ID`  VARCHAR(64) NOT NULL COMMENT '临时会话ID',
+  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT '用户名称',
+  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT '角色名称',
+  `CREATION_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `ACTIVE_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最近活跃时间',
+  PRIMARY KEY (`ID`)
+);
diff --git a/porter_lightweight/user-service/src/main/resources/config/mybatis-config.xml b/porter_lightweight/user-service/src/main/resources/config/mybatis-config.xml
new file mode 100644
index 0000000..894caac
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/config/mybatis-config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE configuration
+  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+  "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <mappers>
+        <mapper resource="config/UserMapper.xml"/>
+        <mapper resource="config/SessionMapper.xml"/>
+    </mappers>
+</configuration>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/resources/microservice.yaml b/porter_lightweight/user-service/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..81ef89e
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/microservice.yaml
@@ -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.
+## ---------------------------------------------------------------------------
+
+# override common configurations in common module
+servicecomb-config-order: 10
+
+service_description:
+  name: user-service
+
+servicecomb:
+  rest:
+    address: 0.0.0.0:9093
\ No newline at end of file


[servicecomb-samples] 07/11: spell

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 1bdcbdeb841c83ee6c0694511ab8738301447954
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Mar 8 16:15:25 2019 +0800

    spell
---
 porter_lightweight/user-service/.gitignore           |  1 -
 .../samples/porter/user/service/UserServiceImpl.java |  2 +-
 .../src/main/resources/config/create_db_user.sql     | 20 ++++++++++----------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/porter_lightweight/user-service/.gitignore b/porter_lightweight/user-service/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/porter_lightweight/user-service/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
index 2d49b46..5f69582 100644
--- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
@@ -83,7 +83,7 @@ public class UserServiceImpl implements UserService {
   }
 
   private boolean validatePassword(String plain, String encrypt) {
-    // 简单加密校验,开发者可以结合业务场景自行修改
+    // simple password encryption, please change it in product environment if necessary. e.g. add salts for each encryption.
     try {
       MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
       messageDigest.update(plain.getBytes("UTF-8"));
diff --git a/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql b/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql
index 3505f3d..a07c5d9 100644
--- a/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql
+++ b/porter_lightweight/user-service/src/main/resources/config/create_db_user.sql
@@ -22,10 +22,10 @@ USE porter_user_db;
 DROP TABLE IF EXISTS T_USER;
 
 CREATE TABLE `T_USER` (
-  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
-  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT '用户名称',
-  `PASSWORD`  VARCHAR(64) NOT NULL COMMENT '用户密码',
-  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT '角色名称',
+  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT 'user id',
+  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT 'user name',
+  `PASSWORD`  VARCHAR(64) NOT NULL COMMENT 'user password',
+  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT 'user role',
   PRIMARY KEY (`ID`)
 );
 
@@ -36,11 +36,11 @@ insert into T_USER(USER_NAME, PASSWORD, ROLE_NAME) values("guest", "n4bQgYhMfWWa
 DROP TABLE IF EXISTS T_SESSION;
 
 CREATE TABLE `T_SESSION` (
-  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT '唯一标识',
-  `SESSION_ID`  VARCHAR(64) NOT NULL COMMENT '临时会话ID',
-  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT '用户名称',
-  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT '角色名称',
-  `CREATION_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-  `ACTIVE_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最近活跃时间',
+  `ID`  INTEGER(8) NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `SESSION_ID`  VARCHAR(64) NOT NULL COMMENT 'session id',
+  `USER_NAME`  VARCHAR(64) NOT NULL COMMENT 'user name',
+  `ROLE_NAME`  VARCHAR(64) NOT NULL COMMENT 'user role',
+  `CREATION_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',
+  `ACTIVE_TIME`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'last active time',
   PRIMARY KEY (`ID`)
 );


[servicecomb-samples] 11/11: fix review comments and add internal access demo

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit f46f134e4e2d353fc2405eb7a34e757fd97c66e1
Author: liubao <ba...@huawei.com>
AuthorDate: Tue Apr 16 14:12:37 2019 +0800

    fix review comments and add internal access demo
---
 porter_lightweight/README.md                       |  4 +--
 .../porter/file/api/InternalAccessEndpoint.java    | 38 ++++++++++++++++++++++
 .../porter/file/api/InternalAccessService.java     |  5 +++
 .../file/service/InternalAccessServiceImpl.java    | 28 ++++++++++++++++
 .../porter/gateway/InternalAccessHandler.java      | 37 +++++++++++++++++++++
 .../src/main/resources/config/cse.handler.xml      |  6 ++--
 .../src/main/resources/microservice.yaml           |  2 +-
 7 files changed, 115 insertions(+), 5 deletions(-)

diff --git a/porter_lightweight/README.md b/porter_lightweight/README.md
index 93d7bd5..297dbb6 100644
--- a/porter_lightweight/README.md
+++ b/porter_lightweight/README.md
@@ -80,7 +80,7 @@ java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSH
 3. 删除文件:输入上一步的文件ID,点击删除。 如果是admin用户,上传成功;如果是guest用户,上传失败。
 
 # 接口使用说明
-ServiceComb推荐先定义接口,再定义实现的开发模式。将接口定义为一个独立项目,可以由设计者统一管控,对于接口的修改,需要设计者进行审核。先定义接口还可以让开发者培养良好的开发习惯,避免将对外接口采用内部实现数据结构(比如JsonObject)、运行平台有关的数据结构(比如HttpServletResponse)来定义,使得以后将项目改在为其他技术框架变得复杂。采用这种方式组织的项目,用户很容易在不同的开发框架上进行迁移,比如gRPC、Spring Cloud等。这里的接口定义代码,对于这些运行框架都是通用的,并且具备跨平台特性。
+ServiceComb推荐先定义接口,再定义实现的开发模式。将接口定义为一个独立项目,可以由设计者统一管控,对于接口的修改,需要设计者进行审核。先定义接口还可以让开发者培养良好的开发习惯,避免将对外接口采用内部实现数据结构(比如JsonObject)、运行平台有关的数据结构(比如HttpServletResponse、HttpServletRequest)来定义,使得以后将项目改造为其他技术框架变得复杂。采用这种方式组织的项目,用户很容易在不同的开发框架上进行迁移,比如gRPC、Spring Cloud等。这里的接口定义代码,对于这些运行框架都是通用的,并且具备跨平台特性。
 
 ## 对于接口实现者(provider)
   * 依赖api对应的jar包
@@ -112,7 +112,7 @@ public class UserServiceImpl implements UserService
   </dependencies>
 ```
 
-  * 采用RCP方式调用
+  * 采用RPC方式调用
 ```
   @RpcReference(microserviceName = "user-service", schemaId = "user")
   private static UserService sserService
diff --git a/porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java b/porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java
new file mode 100644
index 0000000..1a7d94d
--- /dev/null
+++ b/porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java
@@ -0,0 +1,38 @@
+/*
+ * 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.samples.porter.file.api;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import io.swagger.annotations.Api;
+
+@RestSchema(schemaId = "InternalAccessEndpoint")
+@RequestMapping(path = "/")
+@Api(tags = {"INTERNAL"})
+public class InternalAccessEndpoint {
+  @Autowired
+  private InternalAccessService internalAccessService;
+  
+  @GetMapping(path = "localAccess")
+  public String localAccess(String name) {
+    return internalAccessService.localAccess(name);
+  }
+}
diff --git a/porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java b/porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
new file mode 100644
index 0000000..7e627fb
--- /dev/null
+++ b/porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
@@ -0,0 +1,5 @@
+package org.apache.servicecomb.samples.porter.file.api;
+
+public interface InternalAccessService {
+  public String localAccess(String name);
+}
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/InternalAccessServiceImpl.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/InternalAccessServiceImpl.java
new file mode 100644
index 0000000..d723945
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/InternalAccessServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.samples.porter.file.service;
+
+import org.apache.servicecomb.samples.porter.file.api.InternalAccessService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class InternalAccessServiceImpl implements InternalAccessService {
+  public String localAccess(String name) {
+    return "Hello, " + name;
+  }
+}
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java
new file mode 100644
index 0000000..0b181d8
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java
@@ -0,0 +1,37 @@
+/*
+ * 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.samples.porter.gateway;
+
+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.exception.InvocationException;
+
+public class InternalAccessHandler implements Handler {
+
+  @Override
+  public void handle(Invocation invocation, AsyncResponse asyncReponse) throws Exception {
+    if (invocation.getOperationMeta().getSwaggerOperation().getTags() != null
+        && invocation.getOperationMeta().getSwaggerOperation().getTags().contains("INTERNAL")) {
+      asyncReponse.consumerFail(new InvocationException(403, "", "not allowed"));
+      return;
+    }
+    invocation.next(asyncReponse);
+  }
+
+}
diff --git a/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml b/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml
index 00295f8..e9dd306 100644
--- a/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml
+++ b/porter_lightweight/gateway-service/src/main/resources/config/cse.handler.xml
@@ -16,6 +16,8 @@
   -->
 
 <config>
-	<handler id="auth"
-			 class="org.apache.servicecomb.samples.porter.gateway.AuthHandler" />
+  <handler id="auth"
+    class="org.apache.servicecomb.samples.porter.gateway.AuthHandler" />
+  <handler id="internalAccess"
+    class="org.apache.servicecomb.samples.porter.gateway.InternalAccessHandler" />
 </config>
diff --git a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
index 3bb50fa..2462c7f 100644
--- a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
@@ -37,7 +37,7 @@ servicecomb:
   handler:
     chain:
       Consumer:
-        default: auth,qps-flowcontrol-consumer,loadbalance
+        default: internalAccess,auth,qps-flowcontrol-consumer,loadbalance
 
   uploads:
     directory: tmp_for_upload_gateway


[servicecomb-samples] 10/11: 项目升级到1.2.0,并且增加相关的说明

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 9c9b18d326223868083b5eae15810703824773e1
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Apr 12 12:01:36 2019 +0800

    项目升级到1.2.0,并且增加相关的说明
---
 README.md                                 |  14 +++-
 dependency_management/README.md           |  19 ++++++
 dependency_management/spring4/pom.xml     |   4 +-
 dependency_management/spring5/pom.xml     |   4 +-
 dependency_management/springboot1/pom.xml |  10 ++-
 dependency_management/springboot2/pom.xml |   3 +-
 porter_lightweight/README.md              | 109 ++++++++++++++++++++++++++++++
 porter_lightweight/pom.xml                |   2 +-
 8 files changed, 155 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 0c15baf..c1d8c06 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,17 @@
-# servicecomb samples
+# ServiceComb samples
 
 ## porter_lightweight
 A sample shows an application with basic login, download file, delete file functions. 
 
 ## dependency_management
-A sample shows how to use dependency management to create spring 4, spring 5, spring boot 1 or spring boot 2 application. 
\ No newline at end of file
+A sample shows how to use dependency management to create spring 4, spring 5, spring boot 1 or spring boot 2 application. 
+
+
+# 使用ServiceComb开发微服务的示例项目
+
+## porter_lightweight
+该项目演示了一个包括网关、文件下载、认证鉴权等功能的简单应用系统,同时演示了ServiceComb推荐的先写接口声明,再写业务代码的软件工程实践。
+
+## dependency_management
+该项目演示了ServiceComb如何依赖spring4, spring 5, spring boot1 和 spring boot 2。
+
diff --git a/dependency_management/README.md b/dependency_management/README.md
new file mode 100644
index 0000000..6caac86
--- /dev/null
+++ b/dependency_management/README.md
@@ -0,0 +1,19 @@
+## dependency_management
+
+A sample shows how to use dependency management to create spring 4, spring 5, spring boot 1 or spring boot 2 application. 
+
+Compile each project and run with IDE or command line. Each servcie provide a simple REST api. This api can be access using
+```
+http://localhost:9090/hello?name=jack
+```
+
+# dependency_management
+
+该项目演示了ServiceComb如何依赖spring4, spring 5, spring boot1 和 spring boot 2。
+
+启动项目后,可以通过:
+```
+http://localhost:9090/hello?name=jack
+```
+
+来访问微服务。
diff --git a/dependency_management/spring4/pom.xml b/dependency_management/spring4/pom.xml
index 9ee8710..cd5e946 100644
--- a/dependency_management/spring4/pom.xml
+++ b/dependency_management/spring4/pom.xml
@@ -29,11 +29,10 @@
 
   <dependencyManagement>
     <dependencies>
-      <!-- need to compile lastest java-chassis code -->
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-dependencies-spring4</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
+        <version>1.2.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
@@ -52,6 +51,7 @@
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.14.RELEASE</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/dependency_management/spring5/pom.xml b/dependency_management/spring5/pom.xml
index 375c070..343b60f 100644
--- a/dependency_management/spring5/pom.xml
+++ b/dependency_management/spring5/pom.xml
@@ -29,11 +29,10 @@
 
   <dependencyManagement>
     <dependencies>
-      <!-- need to compile lastest java-chassis code -->
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-dependencies-spring5</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
+        <version>1.2.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
@@ -52,6 +51,7 @@
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>2.1.2.RELEASE</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/dependency_management/springboot1/pom.xml b/dependency_management/springboot1/pom.xml
index da6b1a7..417164c 100644
--- a/dependency_management/springboot1/pom.xml
+++ b/dependency_management/springboot1/pom.xml
@@ -29,14 +29,19 @@
 
   <dependencyManagement>
     <dependencies>
-      <!-- need to compile lastest java-chassis code -->
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-dependencies-springboot1</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
+        <version>1.2.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
+      <!-- spring boot 1.5.14.RELEASE use a low version of validation-api, must override it -->
+      <dependency>
+        <groupId>javax.validation</groupId>
+        <artifactId>validation-api</artifactId>
+        <version>2.0.0.Final</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 
@@ -66,6 +71,7 @@
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.5.14.RELEASE</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/dependency_management/springboot2/pom.xml b/dependency_management/springboot2/pom.xml
index 8cb3bd9..215afd9 100644
--- a/dependency_management/springboot2/pom.xml
+++ b/dependency_management/springboot2/pom.xml
@@ -33,7 +33,7 @@
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-dependencies-springboot2</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
+        <version>1.2.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
@@ -62,6 +62,7 @@
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>2.1.2.RELEASE</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/porter_lightweight/README.md b/porter_lightweight/README.md
index 9870398..93d7bd5 100644
--- a/porter_lightweight/README.md
+++ b/porter_lightweight/README.md
@@ -79,4 +79,113 @@ java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSH
 2. 选择一个文件上传,上传成功,上传成功后的文件会保存在file-service的当前目录, 文件名称是一个随机的数字,这个数字就是文件ID。
 3. 删除文件:输入上一步的文件ID,点击删除。 如果是admin用户,上传成功;如果是guest用户,上传失败。
 
+# 接口使用说明
+ServiceComb推荐先定义接口,再定义实现的开发模式。将接口定义为一个独立项目,可以由设计者统一管控,对于接口的修改,需要设计者进行审核。先定义接口还可以让开发者培养良好的开发习惯,避免将对外接口采用内部实现数据结构(比如JsonObject)、运行平台有关的数据结构(比如HttpServletResponse)来定义,使得以后将项目改在为其他技术框架变得复杂。采用这种方式组织的项目,用户很容易在不同的开发框架上进行迁移,比如gRPC、Spring Cloud等。这里的接口定义代码,对于这些运行框架都是通用的,并且具备跨平台特性。
 
+## 对于接口实现者(provider)
+  * 依赖api对应的jar包
+
+```
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>user-service-api-endpoint</artifactId>
+    </dependency>
+  </dependencies>
+```
+
+  * 实现Service接口
+```
+@Service
+public class UserServiceImpl implements UserService
+```
+
+## 对于接口使用者(consumer)
+  * 依赖service对应的jar包(只包含model和接口)
+
+```
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>user-service-api-service</artifactId>
+    </dependency>
+  </dependencies>
+```
+
+  * 采用RCP方式调用
+```
+  @RpcReference(microserviceName = "user-service", schemaId = "user")
+  private static UserService sserService
+```
+
+# REST接口常见争议问题和处理
+
+## 查询接口参数很复杂
+
+比如:
+
+```
+public List<Goods> queryGoodsByTags(String orgId, List<GoodsTag> tags)
+```
+
+当查询参数很复杂的时候,不建议采用query参数或者path参数。主要有如下原因:
+
+* HTTP对于URL的长度有限制
+* 复杂参数可能包含特殊字符,需要客户端在拼接URL的时候,进行URL转码,客户端开发者通常会遗漏。
+* 对象无法和query参数进行合理的映射。
+* query参数或者path参数会被proxy、web server等记录到日志里面,导致日志过大,或者造成敏感信息泄露。
+
+对于复杂的查询操作,建议使用POST方法,相关复杂参数都封装为body。比如:
+
+```
+@PostMapping(path = "queryGoodsByTags")
+public List<Goods> queryGoodsByTags(@RequestParam(name = "orgId") String orgId, @RequestBody List<GoodsTag> tags)
+```
+
+一般的,通过query传递参数的场景,尽可能要保证参数个数少,参数类型为基础类型(字符串、数字等)。参数比较多的场景采用POST来传参。
+
+本项目的处理原则是“尽可能遵循HTTP REST语义,但是不盲目,以系统可靠优先”。
+
+对于DELETE请求,也有类似的情况。在设计GET和DELETE方法时,建议都不使用body参数,尽管HTTP协议并没有强制要求不能使用body,但是由于历史因素,很多WEB服务器支持上会有问题,接口设计应该尽可能避免不必要的麻烦和陷阱。只在POST、PUT、PATCH方法中使用body参数。
+
+## REST接口的Path是否包含操作
+
+比如:下面的接口定义path是否包含deleteGoodsUnitConvertor。 
+
+```
+  @DeleteMapping(path = "deleteGoodsUnitConvertor")
+  public ResponseBase deleteGoodsUnitConvertor(String goodsUnitConvertorId)
+```
+
+由于HTTP的方法POST/PUT/PATCH/GET/DELETE已经包含了增、改、查、删语义,path里面包含delete显得多余。不过由于项目的接口通常比较多,过多的思考接口语义反而增加了理解的难度。所以本项目path全部都包含了方法名字。包含名称有个好处,可以从URL中看出operation id,从而很简单的将URL和契约对应起来,方便查找。此外就是上面提到的原因,并不是所有的删除操作都一定对应于DELETE操作,出于系统可靠性、安全等方面考虑,可能使用POST/PATCH等代表查询或者删除操作。
+
+## 多个对象参数
+
+由于HTTP只能有一个body,所有多个对象参数需要包装为一个参数。 比如:
+
+```
+public ResponseBase inboundOrder(InboundOrder inboundOrder, Set<InboundOrderItem> inboundOrderItems)
+```
+
+封装为下面的REST接口定义:
+
+```
+  @PostMapping(path = "inboundOrder")
+  public ResponseBase inboundOrder(@RequestBody InboundOrderRequest inboundOrderRequest) {
+    return stockService.inboundOrder(inboundOrderRequest.getInboundOrder(), inboundOrderRequest.getInboundOrderItems());
+  }
+```
+
+## 敏感信息不能采用query参数
+
+Query参数可能被各种proxy、web server记录,因此对于用户敏感信息,不能使用query参数。 比如:
+
+```
+public ResponseBase rechargePrepaidCard(String cardId, double amount)
+```
+
+涉及到卡号和金额的数据,需要采用POST提交,参数存储在body。 虽然有些接口仅仅只是查询, 但也可能被设计为POST。 调整后的接口:
+
+```
+public ResponseBase rechargePrepaidCard(@RequestBody PrepaidAmountRequest prepaidAmountRequest)
+```
diff --git a/porter_lightweight/pom.xml b/porter_lightweight/pom.xml
index f891518..08a5500 100644
--- a/porter_lightweight/pom.xml
+++ b/porter_lightweight/pom.xml
@@ -50,7 +50,7 @@
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>java-chassis-dependencies</artifactId>
-        <version>1.2.0-SNAPSHOT</version>
+        <version>1.2.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>


[servicecomb-samples] 06/11: spell

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 06b60a5640e67cb49491a87d8003213ba9bd62e0
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Mar 8 16:07:03 2019 +0800

    spell
---
 .../org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
index c80f42a..3057c1f 100644
--- a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
@@ -47,10 +47,10 @@ public class ApiDispatcher extends AbstractEdgeDispatcher {
     String path = "/" + pathParams.get("param1");
 
     EdgeInvocation invoker = new EdgeInvocation() {
-      // 认证鉴权:构造Invocation的时候,设置会话信息。如果是认证请求,则添加Cookie。
+      // Authentication
       protected void createInvocation() {
         super.createInvocation();
-        // 既从cookie里面读取会话ID,也从header里面读取,方便各种独立的测试工具联调
+        // get session id from header and cookie for debug reasons
         String sessionId = context.request().getHeader("session-id");
         if (sessionId != null) {
           this.invocation.addContext("session-id", sessionId);


[servicecomb-samples] 09/11: [SCB-1193]upgread spring boot versions and add easy to use dependency - samples

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 015e63035ac4f162b9c33a0d3cc4e59060a4a835
Author: liubao <ba...@huawei.com>
AuthorDate: Tue Mar 12 20:24:50 2019 +0800

    [SCB-1193]upgread spring boot versions and add easy to use dependency - samples
---
 README.md                                          |  3 +
 dependency_management/spring4/pom.xml              | 67 ++++++++++++++++++
 .../samples/dependencyManagement/Application.java  | 26 +++++++
 .../dependencyManagement/HelloEndpoint.java        | 32 +++++++++
 .../spring4/src/main/resources/log4j2.xml          | 43 ++++++++++++
 .../spring4/src/main/resources/microservice.yaml   | 36 ++++++++++
 dependency_management/spring5/pom.xml              | 67 ++++++++++++++++++
 .../samples/dependencyManagement/Application.java  | 26 +++++++
 .../dependencyManagement/HelloEndpoint.java        | 32 +++++++++
 .../spring5/src/main/resources/log4j2.xml          | 43 ++++++++++++
 .../spring5/src/main/resources/microservice.yaml   | 36 ++++++++++
 dependency_management/springboot1/pom.xml          | 81 ++++++++++++++++++++++
 .../samples/dependencyManagement/Application.java  | 30 ++++++++
 .../dependencyManagement/HelloEndpoint.java        | 32 +++++++++
 .../springboot1/src/main/resources/application.yml | 35 ++++++++++
 dependency_management/springboot2/pom.xml          | 77 ++++++++++++++++++++
 .../samples/dependencyManagement/Application.java  | 30 ++++++++
 .../dependencyManagement/HelloEndpoint.java        | 32 +++++++++
 .../springboot2/src/main/resources/application.yml | 35 ++++++++++
 19 files changed, 763 insertions(+)

diff --git a/README.md b/README.md
index ac5abc5..0c15baf 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,6 @@
 
 ## porter_lightweight
 A sample shows an application with basic login, download file, delete file functions. 
+
+## dependency_management
+A sample shows how to use dependency management to create spring 4, spring 5, spring boot 1 or spring boot 2 application. 
\ No newline at end of file
diff --git a/dependency_management/spring4/pom.xml b/dependency_management/spring4/pom.xml
new file mode 100644
index 0000000..9ee8710
--- /dev/null
+++ b/dependency_management/spring4/pom.xml
@@ -0,0 +1,67 @@
+<!-- ~ 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>
+
+  <groupId>org.apache.servicecomb.samples.dependencyManagement</groupId>
+  <artifactId>spring4</artifactId>
+  <version>0.0.1</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java.version>1.8</java.version>
+    <argLine>-Dfile.encoding=UTF-8</argLine>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <main.class>org.apache.servicecomb.samples.dependencyManagement.Application</main.class>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- need to compile lastest java-chassis code -->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies-spring4</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java b/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
new file mode 100644
index 0000000..335c7a5
--- /dev/null
+++ b/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.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.samples.dependencyManagement;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+    public static void main(String[] args) throws Exception {
+        BeanUtils.init();
+    }
+}
diff --git a/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java b/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
new file mode 100644
index 0000000..51923d8
--- /dev/null
+++ b/dependency_management/spring4/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
@@ -0,0 +1,32 @@
+/*
+ * 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.samples.dependencyManagement;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "hello")
+@RequestMapping(path = "/")
+public class HelloEndpoint {
+  @GetMapping(path = "/hello")
+  public String hello(@RequestParam(name = "name") String name) {
+    return name;
+  }
+}
diff --git a/dependency_management/spring4/src/main/resources/log4j2.xml b/dependency_management/spring4/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..e3afdb6
--- /dev/null
+++ b/dependency_management/spring4/src/main/resources/log4j2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Properties>
+    <Property name="log_path">./file/log/</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+      <SizeBasedTriggeringPolicy size="10 MB"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/dependency_management/spring4/src/main/resources/microservice.yaml b/dependency_management/spring4/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..e5e3410
--- /dev/null
+++ b/dependency_management/spring4/src/main/resources/microservice.yaml
@@ -0,0 +1,36 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# override common configurations in common module
+servicecomb-config-order: 10
+
+APPLICATION_ID: dependency_management
+
+service_description:
+  version: 0.0.1
+  name: spring4
+
+servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
+
+  rest:
+    address: 0.0.0.0:9090
\ No newline at end of file
diff --git a/dependency_management/spring5/pom.xml b/dependency_management/spring5/pom.xml
new file mode 100644
index 0000000..375c070
--- /dev/null
+++ b/dependency_management/spring5/pom.xml
@@ -0,0 +1,67 @@
+<!-- ~ 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>
+
+  <groupId>org.apache.servicecomb.samples.dependencyManagement</groupId>
+  <artifactId>spring5</artifactId>
+  <version>0.0.1</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java.version>1.8</java.version>
+    <argLine>-Dfile.encoding=UTF-8</argLine>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <main.class>org.apache.servicecomb.samples.dependencyManagement.Application</main.class>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- need to compile lastest java-chassis code -->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies-spring5</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java b/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
new file mode 100644
index 0000000..335c7a5
--- /dev/null
+++ b/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.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.samples.dependencyManagement;
+
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+
+public class Application {
+    public static void main(String[] args) throws Exception {
+        BeanUtils.init();
+    }
+}
diff --git a/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java b/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
new file mode 100644
index 0000000..51923d8
--- /dev/null
+++ b/dependency_management/spring5/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
@@ -0,0 +1,32 @@
+/*
+ * 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.samples.dependencyManagement;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "hello")
+@RequestMapping(path = "/")
+public class HelloEndpoint {
+  @GetMapping(path = "/hello")
+  public String hello(@RequestParam(name = "name") String name) {
+    return name;
+  }
+}
diff --git a/dependency_management/spring5/src/main/resources/log4j2.xml b/dependency_management/spring5/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..e3afdb6
--- /dev/null
+++ b/dependency_management/spring5/src/main/resources/log4j2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Properties>
+    <Property name="log_path">./file/log/</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+      <SizeBasedTriggeringPolicy size="10 MB"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/dependency_management/spring5/src/main/resources/microservice.yaml b/dependency_management/spring5/src/main/resources/microservice.yaml
new file mode 100644
index 0000000..3efb2e2
--- /dev/null
+++ b/dependency_management/spring5/src/main/resources/microservice.yaml
@@ -0,0 +1,36 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# override common configurations in common module
+servicecomb-config-order: 10
+
+APPLICATION_ID: dependency_management
+
+service_description:
+  version: 0.0.1
+  name: spring5
+
+servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
+
+  rest:
+    address: 0.0.0.0:9090
\ No newline at end of file
diff --git a/dependency_management/springboot1/pom.xml b/dependency_management/springboot1/pom.xml
new file mode 100644
index 0000000..da6b1a7
--- /dev/null
+++ b/dependency_management/springboot1/pom.xml
@@ -0,0 +1,81 @@
+<!-- ~ 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>
+
+  <groupId>org.apache.servicecomb.samples.dependencyManagement</groupId>
+  <artifactId>springboot1</artifactId>
+  <version>0.0.1</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java.version>1.8</java.version>
+    <argLine>-Dfile.encoding=UTF-8</argLine>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <main.class>org.apache.servicecomb.samples.dependencyManagement.Application</main.class>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- need to compile lastest java-chassis code -->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies-springboot1</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>spring-boot-starter-transport</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java b/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
new file mode 100644
index 0000000..072a201
--- /dev/null
+++ b/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
@@ -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.
+ */
+
+package org.apache.servicecomb.samples.dependencyManagement;
+
+import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableServiceComb
+public class Application {
+  public static void main(String[] args) throws Exception {
+    SpringApplication.run(Application.class, args);
+  }
+}
diff --git a/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java b/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
new file mode 100644
index 0000000..51923d8
--- /dev/null
+++ b/dependency_management/springboot1/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
@@ -0,0 +1,32 @@
+/*
+ * 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.samples.dependencyManagement;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "hello")
+@RequestMapping(path = "/")
+public class HelloEndpoint {
+  @GetMapping(path = "/hello")
+  public String hello(@RequestParam(name = "name") String name) {
+    return name;
+  }
+}
diff --git a/dependency_management/springboot1/src/main/resources/application.yml b/dependency_management/springboot1/src/main/resources/application.yml
new file mode 100644
index 0000000..590d7b6
--- /dev/null
+++ b/dependency_management/springboot1/src/main/resources/application.yml
@@ -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.
+## ---------------------------------------------------------------------------
+server:
+  port: 9090
+
+APPLICATION_ID: dependency_management
+
+service_description:
+  version: 0.0.1
+  name: springboot1
+
+servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
+
+  rest:
+    address: 0.0.0.0:9090
\ No newline at end of file
diff --git a/dependency_management/springboot2/pom.xml b/dependency_management/springboot2/pom.xml
new file mode 100644
index 0000000..8cb3bd9
--- /dev/null
+++ b/dependency_management/springboot2/pom.xml
@@ -0,0 +1,77 @@
+<!-- ~ 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>
+
+  <groupId>org.apache.servicecomb.samples.dependencyManagement</groupId>
+  <artifactId>springboot2</artifactId>
+  <version>0.0.1</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <java.version>1.8</java.version>
+    <argLine>-Dfile.encoding=UTF-8</argLine>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <main.class>org.apache.servicecomb.samples.dependencyManagement.Application</main.class>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- need to compile lastest java-chassis code -->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>java-chassis-dependencies-springboot2</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>solution-basic</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>spring-boot2-starter-servlet</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java b/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
new file mode 100644
index 0000000..876b1a2
--- /dev/null
+++ b/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/Application.java
@@ -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.
+ */
+
+package org.apache.servicecomb.samples.dependencyManagement;
+
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.SpringApplication;
+
+@SpringBootApplication
+@EnableServiceComb
+public class Application {
+  public static void main(String[] args) throws Exception {
+    SpringApplication.run(Application.class, args);
+  }
+}
diff --git a/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java b/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
new file mode 100644
index 0000000..51923d8
--- /dev/null
+++ b/dependency_management/springboot2/src/main/java/org/apache/servicecomb/samples/dependencyManagement/HelloEndpoint.java
@@ -0,0 +1,32 @@
+/*
+ * 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.samples.dependencyManagement;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "hello")
+@RequestMapping(path = "/")
+public class HelloEndpoint {
+  @GetMapping(path = "/hello")
+  public String hello(@RequestParam(name = "name") String name) {
+    return name;
+  }
+}
diff --git a/dependency_management/springboot2/src/main/resources/application.yml b/dependency_management/springboot2/src/main/resources/application.yml
new file mode 100644
index 0000000..cab54c0
--- /dev/null
+++ b/dependency_management/springboot2/src/main/resources/application.yml
@@ -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.
+## ---------------------------------------------------------------------------
+server:
+  port: 9090
+
+APPLICATION_ID: dependency_management
+
+service_description:
+  version: 0.0.1
+  name: springboot2
+
+servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
+
+  rest:
+    address: 0.0.0.0:9090
\ No newline at end of file


[servicecomb-samples] 08/11: 默认使用log4j2

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit f83c17336ce98f57d6ff952c10ff80ed9a74d8c4
Author: liubao <ba...@huawei.com>
AuthorDate: Mon Mar 11 10:23:10 2019 +0800

    默认使用log4j2
---
 .../servicecomb/samples/porter/file/FileMain.java  |  2 -
 .../file-service/src/main/resources/log4j2.xml     | 43 ++++++++++++++++++++++
 .../samples/porter/gateway/GatewayMain.java        |  2 -
 .../gateway-service/src/main/resources/log4j2.xml  | 43 ++++++++++++++++++++++
 .../servicecomb/samples/porter/user/UserMain.java  |  2 -
 .../user-service/src/main/resources/log4j2.xml     | 43 ++++++++++++++++++++++
 6 files changed, 129 insertions(+), 6 deletions(-)

diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java
index 9b13142..ff57da5 100644
--- a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/FileMain.java
@@ -18,11 +18,9 @@
 package org.apache.servicecomb.samples.porter.file;
 
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 
 public class FileMain {
     public static void main(String[] args) throws Exception {
-        Log4jUtils.init();
         BeanUtils.init();
     }
 }
diff --git a/porter_lightweight/file-service/src/main/resources/log4j2.xml b/porter_lightweight/file-service/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..e3afdb6
--- /dev/null
+++ b/porter_lightweight/file-service/src/main/resources/log4j2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Properties>
+    <Property name="log_path">./file/log/</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+      <SizeBasedTriggeringPolicy size="10 MB"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java
index 48c1824..a219d2d 100644
--- a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/GatewayMain.java
@@ -18,11 +18,9 @@
 package org.apache.servicecomb.samples.porter.gateway;
 
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 
 public class GatewayMain {
     public static void main(String[] args) throws Exception {
-        Log4jUtils.init();
         BeanUtils.init();
     }
 }
diff --git a/porter_lightweight/gateway-service/src/main/resources/log4j2.xml b/porter_lightweight/gateway-service/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..b51f28e
--- /dev/null
+++ b/porter_lightweight/gateway-service/src/main/resources/log4j2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Properties>
+    <Property name="log_path">./gateway/log/</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+      <SizeBasedTriggeringPolicy size="10 MB"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java
index 390b040..dc7b3ed 100644
--- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/UserMain.java
@@ -18,11 +18,9 @@
 package org.apache.servicecomb.samples.porter.user;
 
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
 
 public class UserMain {
   public static void main(String[] args) throws Exception {
-    Log4jUtils.init();
     BeanUtils.init();
   }
 }
diff --git a/porter_lightweight/user-service/src/main/resources/log4j2.xml b/porter_lightweight/user-service/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..3c70391
--- /dev/null
+++ b/porter_lightweight/user-service/src/main/resources/log4j2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<!--this is sample configuration, please modify as your wish-->
+
+<configuration>
+  <Properties>
+    <Property name="log_path">./user/log/</Property>
+  </Properties>
+
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+    </Console>
+    <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
+      filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
+      <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
+      <TimeBasedTriggeringPolicy interval="1"/>
+      <SizeBasedTriggeringPolicy size="10 MB"/>
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+      <AppenderRef ref="DailyRollingFile"/>
+    </Root>
+  </Loggers>
+</configuration>
\ No newline at end of file


[servicecomb-samples] 03/11: separate api in different project

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 1370b2fd36b962b036be350bc208a23eb1490ab9
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Mar 8 15:14:10 2019 +0800

    separate api in different project
---
 .../{common => api/file-service/endpoint}/pom.xml  | 11 ++++++--
 .../samples/porter/file/api/FileEndpoint.java      |  3 ++-
 .../{common => api/file-service}/pom.xml           | 13 +++++++---
 .../{common => api/file-service/service}/pom.xml   |  4 +--
 .../samples/porter/file/api/FileService.java       |  2 +-
 porter_lightweight/{common => api}/pom.xml         | 11 +++++---
 .../{common => api/user-service/endpoint}/pom.xml  | 11 ++++++--
 .../samples/porter/user/api/UserEndpoint.java      |  4 ++-
 .../{common => api/user-service}/pom.xml           | 13 +++++++---
 .../{common => api/user-service/service}/pom.xml   |  4 +--
 .../samples/porter/user/api/SessionInfo.java       |  2 +-
 .../samples/porter/user/api/UserService.java       |  2 +-
 .../common/src/main/resources/microservice.yaml    | 30 ----------------------
 porter_lightweight/file-service/pom.xml            |  2 +-
 .../porter/file/service/FileServiceImpl.java       |  2 +-
 .../main/resources/META-INF/spring/file.bean.xml   |  2 --
 .../src/main/resources/microservice.yaml           |  9 +++++++
 porter_lightweight/gateway-service/pom.xml         |  2 +-
 .../samples/porter/gateway/AuthHandler.java        | 13 +++++-----
 .../src/main/resources/microservice.yaml           |  8 ++++++
 porter_lightweight/pom.xml                         |  2 +-
 porter_lightweight/user-service/pom.xml            |  2 +-
 .../samples/porter/user/dao/SessionInfoModel.java  |  2 +-
 .../samples/porter/user/dao/SessionMapper.java     |  2 +-
 .../porter/user/service/UserServiceImpl.java       |  5 ++--
 .../main/resources/META-INF/spring/user.bean.xml   |  3 ---
 .../src/main/resources/microservice.yaml           |  8 ++++++
 27 files changed, 96 insertions(+), 76 deletions(-)

diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/file-service/endpoint/pom.xml
similarity index 78%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/file-service/endpoint/pom.xml
index 772ec4e..f9ae57e 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/file-service/endpoint/pom.xml
@@ -21,11 +21,18 @@
 
   <parent>
     <groupId>org.apache.servicecomb.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>file-service-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
+  <artifactId>file-service-api-endpoint</artifactId>
   <packaging>jar</packaging>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>file-service-api-service</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+  </dependencies>
 </project>
diff --git a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java b/porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
similarity index 94%
rename from porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java
rename to porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
index e7c1f0c..8ff7dac 100644
--- a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileEndpoint.java
+++ b/porter_lightweight/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package samples.porter.file.api;
+package org.apache.servicecomb.samples.porter.file.api;
 
 import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.samples.porter.file.api.FileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.DeleteMapping;
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/file-service/pom.xml
similarity index 85%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/file-service/pom.xml
index 772ec4e..be4d84a 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/file-service/pom.xml
@@ -15,17 +15,22 @@
   ~ 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.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>porter-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
-  <packaging>jar</packaging>
+  <artifactId>file-service-api</artifactId>
+  <packaging>pom</packaging>
 
-</project>
+  <modules>
+    <module>service</module>
+    <module>endpoint</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/file-service/service/pom.xml
similarity index 92%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/file-service/service/pom.xml
index 772ec4e..a0a5dc9 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/file-service/service/pom.xml
@@ -21,11 +21,11 @@
 
   <parent>
     <groupId>org.apache.servicecomb.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>file-service-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
+  <artifactId>file-service-api-service</artifactId>
   <packaging>jar</packaging>
 
 </project>
diff --git a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.java b/porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
similarity index 94%
rename from porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.java
rename to porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
index 606e727..ff7777a 100644
--- a/porter_lightweight/common/src/main/java/samples/porter/file/api/FileService.java
+++ b/porter_lightweight/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package samples.porter.file.api;
+package org.apache.servicecomb.samples.porter.file.api;
 
 import org.springframework.web.multipart.MultipartFile;
 
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/pom.xml
similarity index 88%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/pom.xml
index 772ec4e..018a879 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/pom.xml
@@ -15,6 +15,7 @@
   ~ 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>
@@ -25,7 +26,11 @@
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
-  <packaging>jar</packaging>
+  <artifactId>porter-api</artifactId>
+  <packaging>pom</packaging>
 
-</project>
+  <modules>
+    <module>file-service</module>
+    <module>user-service</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/user-service/endpoint/pom.xml
similarity index 78%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/user-service/endpoint/pom.xml
index 772ec4e..5c96d3a 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/user-service/endpoint/pom.xml
@@ -21,11 +21,18 @@
 
   <parent>
     <groupId>org.apache.servicecomb.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>user-service-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
+  <artifactId>user-service-api-endpoint</artifactId>
   <packaging>jar</packaging>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>user-service-api-service</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+  </dependencies>
 </project>
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java b/porter_lightweight/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
similarity index 91%
rename from porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java
rename to porter_lightweight/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
index 8a248d3..40df5bb 100644
--- a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserEndpoint.java
+++ b/porter_lightweight/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 
-package samples.porter.user.api;
+package org.apache.servicecomb.samples.porter.user.api;
 
 import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
+import org.apache.servicecomb.samples.porter.user.api.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.GetMapping;
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/user-service/pom.xml
similarity index 85%
copy from porter_lightweight/common/pom.xml
copy to porter_lightweight/api/user-service/pom.xml
index 772ec4e..31e433d 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/user-service/pom.xml
@@ -15,17 +15,22 @@
   ~ 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.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>porter-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
-  <packaging>jar</packaging>
+  <artifactId>user-service-api</artifactId>
+  <packaging>pom</packaging>
 
-</project>
+  <modules>
+    <module>service</module>
+    <module>endpoint</module>
+  </modules>
+</project>
\ No newline at end of file
diff --git a/porter_lightweight/common/pom.xml b/porter_lightweight/api/user-service/service/pom.xml
similarity index 92%
rename from porter_lightweight/common/pom.xml
rename to porter_lightweight/api/user-service/service/pom.xml
index 772ec4e..083b309 100644
--- a/porter_lightweight/common/pom.xml
+++ b/porter_lightweight/api/user-service/service/pom.xml
@@ -21,11 +21,11 @@
 
   <parent>
     <groupId>org.apache.servicecomb.samples.porter</groupId>
-    <artifactId>porter-application</artifactId>
+    <artifactId>user-service-api</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>porter-common</artifactId>
+  <artifactId>user-service-api-service</artifactId>
   <packaging>jar</packaging>
 
 </project>
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java b/porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
similarity index 96%
rename from porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java
rename to porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
index 2aca62b..6358104 100644
--- a/porter_lightweight/common/src/main/java/samples/porter/user/api/SessionInfo.java
+++ b/porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package samples.porter.user.api;
+package org.apache.servicecomb.samples.porter.user.api;
 
 public class SessionInfo {
   private String sessiondId;
diff --git a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.java b/porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
similarity index 94%
rename from porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.java
rename to porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
index a37ffa3..aa882f9 100644
--- a/porter_lightweight/common/src/main/java/samples/porter/user/api/UserService.java
+++ b/porter_lightweight/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package samples.porter.user.api;
+package org.apache.servicecomb.samples.porter.user.api;
 
 public interface UserService {
   public SessionInfo login(String userName,
diff --git a/porter_lightweight/common/src/main/resources/microservice.yaml b/porter_lightweight/common/src/main/resources/microservice.yaml
deleted file mode 100644
index 9e3de6e..0000000
--- a/porter_lightweight/common/src/main/resources/microservice.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-servicecomb-config-order: 10
-
-APPLICATION_ID: porter-application
-service_description:
-  version: 0.0.1
-
-servicecomb:
-  service:
-    registry:
-      address: http://localhost:30100
-      instance:
-        watch: false
\ No newline at end of file
diff --git a/porter_lightweight/file-service/pom.xml b/porter_lightweight/file-service/pom.xml
index d42ed5c..6ae53d6 100644
--- a/porter_lightweight/file-service/pom.xml
+++ b/porter_lightweight/file-service/pom.xml
@@ -31,7 +31,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb.samples.porter</groupId>
-      <artifactId>porter-common</artifactId>
+      <artifactId>file-service-api-endpoint</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
   </dependencies>
diff --git a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java
index 78aea60..5053aee 100644
--- a/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java
+++ b/porter_lightweight/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/service/FileServiceImpl.java
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 @Service
-public class FileServiceImpl implements samples.porter.file.api.FileService {
+public class FileServiceImpl implements org.apache.servicecomb.samples.porter.file.api.FileService {
     @Autowired
     private FileStoreService fileService;
 
diff --git a/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml b/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml
index 4a3846c..c679960 100644
--- a/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml
+++ b/porter_lightweight/file-service/src/main/resources/META-INF/spring/file.bean.xml
@@ -24,6 +24,4 @@
         http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
 
-    <!-- Only scan file components. Other beans in common module like org.apache.servicecomb.samples.porter.user.api.UserEndpoint ignored. -->
-    <context:component-scan base-package="samples.porter.file" />
 </beans>
\ No newline at end of file
diff --git a/porter_lightweight/file-service/src/main/resources/microservice.yaml b/porter_lightweight/file-service/src/main/resources/microservice.yaml
index bb71959..44654c4 100644
--- a/porter_lightweight/file-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/file-service/src/main/resources/microservice.yaml
@@ -19,10 +19,19 @@
 # override common configurations in common module
 servicecomb-config-order: 10
 
+APPLICATION_ID: porter-application
+
 service_description:
+  version: 0.0.1
   name: file-service
 
 servicecomb:
+  service:
+    registry:
+      address: http://localhost:30120
+      instance:
+        watch: false
+
   rest:
     address: 0.0.0.0:9091
 
diff --git a/porter_lightweight/gateway-service/pom.xml b/porter_lightweight/gateway-service/pom.xml
index 427c75e..c0188fa 100644
--- a/porter_lightweight/gateway-service/pom.xml
+++ b/porter_lightweight/gateway-service/pom.xml
@@ -35,7 +35,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb.samples.porter</groupId>
-      <artifactId>porter-common</artifactId>
+      <artifactId>user-service-api-service</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
     <dependency>
diff --git a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
index 73cc06d..13a7e9a 100644
--- a/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
+++ b/porter_lightweight/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
@@ -23,6 +23,7 @@ import org.apache.servicecomb.core.Handler;
 import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import org.apache.servicecomb.provider.springmvc.reference.async.CseAsyncRestTemplate;
+import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
 import org.apache.servicecomb.swagger.invocation.AsyncResponse;
 import org.apache.servicecomb.swagger.invocation.Response;
 import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
@@ -33,13 +34,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 
-import samples.porter.user.api.SessionInfo;
-
 
 public class AuthHandler implements Handler {
   private CseAsyncRestTemplate restTemplate = new CseAsyncRestTemplate();
 
-  //服务端会话过期是10分钟,客户端缓存1分钟会话。
+  // session expires in 10 minutes, cache for 1 seconds to get rid of concurrent scenarios.
   private Cache<String, String> sessionCache = CacheBuilder.newBuilder()
       .expireAfterAccess(30, TimeUnit.SECONDS)
       .build();
@@ -49,7 +48,7 @@ public class AuthHandler implements Handler {
     if (invocation.getMicroserviceName().equals("user-service")
         && (invocation.getOperationName().equals("login")
             || (invocation.getOperationName().equals("getSession")))) {
-      // login: 直接返回认证结果。  开发者需要在JS里面设置cookie。 
+      // login:return session id, set cookie by javascript
       invocation.next(asyncResponse);
     } else {
       // check session
@@ -61,7 +60,7 @@ public class AuthHandler implements Handler {
       String sessionInfo = sessionCache.getIfPresent(sessionId);
       if (sessionInfo != null) {
         try {
-          // 将会话信息传递给后面的微服务。后面的微服务可以从context获取到会话信息,从而可以进行鉴权等。 
+          // session info stored in InvocationContext. Microservices can get it. 
           invocation.addContext("session-id", sessionId);
           invocation.addContext("session-info", sessionInfo);
           invocation.next(asyncResponse);
@@ -71,7 +70,7 @@ public class AuthHandler implements Handler {
         return;
       }
 
-      // 在网关执行的Hanlder逻辑,是reactive模式的,不能使用阻塞调用。
+      // In edge, handler is executed in reactively. Must have no blocking logic.
       ListenableFuture<ResponseEntity<SessionInfo>> sessionInfoFuture =
           restTemplate.getForEntity("cse://user-service/v1/user/session?sessionId=" + sessionId, SessionInfo.class);
       sessionInfoFuture.addCallback(
@@ -89,7 +88,7 @@ public class AuthHandler implements Handler {
                 return;
               }
               try {
-                // 将会话信息传递给后面的微服务。后面的微服务可以从context获取到会话信息,从而可以进行鉴权等。 
+                // session info stored in InvocationContext. Microservices can get it. 
                 invocation.addContext("session-id", sessionId);
                 String sessionInfoStr = JsonUtils.writeValueAsString(sessionInfo);
                 invocation.addContext("session-info", sessionInfoStr);
diff --git a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
index 5623c60..a3edac1 100644
--- a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
@@ -19,10 +19,18 @@
 # override common configurations in common module
 servicecomb-config-order: 100
 
+APPLICATION_ID: porter-application
 service_description:
+  version: 0.0.1
   name: gateway-service
 
 servicecomb:
+  service:
+    registry:
+      address: http://localhost:30100
+      instance:
+        watch: false
+
   rest:
     address: 0.0.0.0:9090?sslEnabled=false
 
diff --git a/porter_lightweight/pom.xml b/porter_lightweight/pom.xml
index 5a7e539..f891518 100644
--- a/porter_lightweight/pom.xml
+++ b/porter_lightweight/pom.xml
@@ -65,7 +65,7 @@
   </dependencies>
 
   <modules>
-    <module>common</module>
+    <module>api</module>
     <module>file-service</module>
     <module>user-service</module>
     <module>gateway-service</module>
diff --git a/porter_lightweight/user-service/pom.xml b/porter_lightweight/user-service/pom.xml
index 04c50ae..7e8c20f 100644
--- a/porter_lightweight/user-service/pom.xml
+++ b/porter_lightweight/user-service/pom.xml
@@ -36,7 +36,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.servicecomb.samples.porter</groupId>
-      <artifactId>porter-common</artifactId>
+      <artifactId>user-service-api-endpoint</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
     <dependency>
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java
index f363af5..fa60d33 100644
--- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionInfoModel.java
@@ -17,7 +17,7 @@
 
 package org.apache.servicecomb.samples.porter.user.dao;
 
-import samples.porter.user.api.SessionInfo;
+import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
 
 public class SessionInfoModel {
   private int id;
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java
index fb3306b..e09df8e 100644
--- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/dao/SessionMapper.java
@@ -17,7 +17,7 @@
 
 package org.apache.servicecomb.samples.porter.user.dao;
 
-import samples.porter.user.api.SessionInfo;
+import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
 
 public interface SessionMapper {
     void createSession(SessionInfo sessionInfo);
diff --git a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
index 2633d57..2d49b46 100644
--- a/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
+++ b/porter_lightweight/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/service/UserServiceImpl.java
@@ -24,6 +24,8 @@ import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
+import org.apache.servicecomb.samples.porter.user.api.UserService;
 import org.apache.servicecomb.samples.porter.user.dao.SessionInfoModel;
 import org.apache.servicecomb.samples.porter.user.dao.SessionMapper;
 import org.apache.servicecomb.samples.porter.user.dao.UserInfo;
@@ -36,9 +38,6 @@ import org.springframework.stereotype.Service;
 
 import com.netflix.config.DynamicPropertyFactory;
 
-import samples.porter.user.api.SessionInfo;
-import samples.porter.user.api.UserService;
-
 @Service
 public class UserServiceImpl implements UserService {
   private static Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);
diff --git a/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml b/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml
index e1cdd94..3cc2dd2 100644
--- a/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml
+++ b/porter_lightweight/user-service/src/main/resources/META-INF/spring/user.bean.xml
@@ -26,9 +26,6 @@
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
 		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
 
-    <context:component-scan base-package="samples.porter.user" >
-    </context:component-scan>
-
     <bean id="dataSource"
         class="org.apache.commons.dbcp2.BasicDataSource"
         destroy-method="close">
diff --git a/porter_lightweight/user-service/src/main/resources/microservice.yaml b/porter_lightweight/user-service/src/main/resources/microservice.yaml
index 81ef89e..9c25055 100644
--- a/porter_lightweight/user-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/user-service/src/main/resources/microservice.yaml
@@ -19,9 +19,17 @@
 # override common configurations in common module
 servicecomb-config-order: 10
 
+APPLICATION_ID: porter-application
 service_description:
+  version: 0.0.1
   name: user-service
 
 servicecomb:
+  service:
+    registry:
+      address: http://localhost:30120
+      instance:
+        watch: false
+
   rest:
     address: 0.0.0.0:9093
\ No newline at end of file


[servicecomb-samples] 05/11: fix config error

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 635f740ca47559b53a882b49a4990bd057b69607
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Mar 8 15:59:54 2019 +0800

    fix config error
---
 .../file-service/src/main/resources/microservice.yaml               | 2 +-
 porter_lightweight/gateway-service/pom.xml                          | 4 ----
 .../gateway-service/src/main/resources/microservice.yaml            | 6 ------
 .../user-service/src/main/resources/microservice.yaml               | 2 +-
 4 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/porter_lightweight/file-service/src/main/resources/microservice.yaml b/porter_lightweight/file-service/src/main/resources/microservice.yaml
index 44654c4..dc4a845 100644
--- a/porter_lightweight/file-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/file-service/src/main/resources/microservice.yaml
@@ -28,7 +28,7 @@ service_description:
 servicecomb:
   service:
     registry:
-      address: http://localhost:30120
+      address: http://localhost:30100
       instance:
         watch: false
 
diff --git a/porter_lightweight/gateway-service/pom.xml b/porter_lightweight/gateway-service/pom.xml
index c0188fa..252935e 100644
--- a/porter_lightweight/gateway-service/pom.xml
+++ b/porter_lightweight/gateway-service/pom.xml
@@ -42,10 +42,6 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>edge-core</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.servicecomb</groupId>
-      <artifactId>metrics-core</artifactId>
-    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
index a3edac1..3bb50fa 100644
--- a/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/gateway-service/src/main/resources/microservice.yaml
@@ -42,12 +42,6 @@ servicecomb:
   uploads:
     directory: tmp_for_upload_gateway
 
-  accesslog:
-    enabled: true
-  metrics:
-    window_time: 30000
-    publisher.defaultLog.enabled: true
-
 servicecomb.http.dispatcher.edge.default.enabled: false
 servicecomb.http.dispatcher.rest.enabled: false
 gateway.webroot: /code/servicecomb-samples/porter_lightweight/gateway-service/src/main/resources
diff --git a/porter_lightweight/user-service/src/main/resources/microservice.yaml b/porter_lightweight/user-service/src/main/resources/microservice.yaml
index 9c25055..5daaea5 100644
--- a/porter_lightweight/user-service/src/main/resources/microservice.yaml
+++ b/porter_lightweight/user-service/src/main/resources/microservice.yaml
@@ -27,7 +27,7 @@ service_description:
 servicecomb:
   service:
     registry:
-      address: http://localhost:30120
+      address: http://localhost:30100
       instance:
         watch: false
 


[servicecomb-samples] 04/11: spell and add license notice

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 1136c1fe13bb517b0c90888854faf50f8627f6a8
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Mar 8 15:27:47 2019 +0800

    spell and add license notice
---
 LICENSE                      | 217 +++++++++++++++++++++++++++++++++++++++++++
 NOTICE                       |   5 +
 porter_lightweight/README.md |   8 +-
 3 files changed, 226 insertions(+), 4 deletions(-)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..a22797d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,217 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed 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.
+
+=======================================================================
+Apache ServiceComb Java Chassis Subcomponents:
+
+The Apache ServiceComb Java Chassis project contains subcomponents with
+separate copyright notices and license terms. Your use of the source
+for these subcomponents is subject to the terms and conditions of the
+following licenses.
+
+
+================================================================
+For porter_lightweight/gateway-service/src/main/resources/ui/js/jquery-1.11.1.min.js
+================================================================
+This product bundles files from jquery which is licensed under the MIT License.
+For details, see https://github.com/jquery/jquery/blob/master/LICENSE.txt
+
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..d463439
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,5 @@
+Apache ServiceComb Samples
+Copyright 2017-2018 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/porter_lightweight/README.md b/porter_lightweight/README.md
index ef8c671..9870398 100644
--- a/porter_lightweight/README.md
+++ b/porter_lightweight/README.md
@@ -1,4 +1,4 @@
-This project shows how to using java-chassis and service-center to create a simple microservice application. It shows basic authentication and authorization, uploading files and delte files operations.
+This project shows how to using java-chassis and service-center to create a simple microservice application. It shows basic authentication and authorization, uploading files and delete files operations.
 
 ## build and run
 
@@ -24,9 +24,9 @@ java $JAVA_OPT -Ddb.url="jdbc:mysql://localhost/porter_user_db?useSSL=false" -Dd
 java $JAVA_OPT -jar porter-file-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
 ```
 
-* run gateway-serivce:
+* run gateway-service:
 
-gateway-service contains static webpages in resources/ui. First copy to web root folder,e.g webapp, which is relative to working directory. 
+gateway-service contains static web pages in resources/ui. First copy to web root folder,e.g webapp, which is relative to working directory. 
 
 ```
 java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
@@ -35,7 +35,7 @@ java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSH
 ## Try it
 
 1. Using browser: http://localhost:9090/ui/login.html with user admin or guest to login, password is test.
-2. Choose a file to upload. Uploaded file is stored in file-service workding directory. And name is random number generated. 
+2. Choose a file to upload. Uploaded file is stored in file-service working directory. And name is random number generated. 
 3. Delete file. Input the random number generated in step 2. 
 
 


[servicecomb-samples] 01/11: add a readme file

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git

commit 744217edf03b9d590975bf1084388d7389d75c0b
Author: liubao <ba...@huawei.com>
AuthorDate: Wed Mar 6 09:41:17 2019 +0800

    add a readme file
---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3cf272a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# servicecomb samples
+