[GitHub] [servicecomb-java-chassis] wujimin merged pull request #1125: [SCB-1147] fix slow invocation log problem

2019-03-11 Thread GitBox
wujimin merged pull request #1125: [SCB-1147] fix slow invocation log problem
URL: https://github.com/apache/servicecomb-java-chassis/pull/1125
 
 
   


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


With regards,
Apache Git Services


[servicecomb-java-chassis] branch master updated: [SCB-1147] fix slow invocation log problem

2019-03-11 Thread wujimin
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4c42fb5  [SCB-1147] fix slow invocation log problem
4c42fb5 is described below

commit 4c42fb5c7350d5fe611bb21a3e4c2adf3b07acee
Author: yaohaishi 
AuthorDate: Mon Mar 11 23:02:14 2019 +0800

[SCB-1147] fix slow invocation log problem
---
 .../apache/servicecomb/metrics/core/publish/SlowInvocationLogger.java  | 1 -
 .../servicecomb/metrics/core/publish/TestSlowInvocationLogger.java | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/SlowInvocationLogger.java
 
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/SlowInvocationLogger.java
index e0c866a..f042120 100644
--- 
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/SlowInvocationLogger.java
+++ 
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/SlowInvocationLogger.java
@@ -79,7 +79,6 @@ public class SlowInvocationLogger {
 + "prepare: {} ms\n"
 + "threadPoolQueue: {} ms\n"
 + "server filters request : {} ms\n"
-+ "server filters request : {} ms\n"
 + "handlers request   : {} ms\n"
 + "business execute   : {} ms\n"
 + "handlers response  : {} ms\n"
diff --git 
a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java
 
b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java
index 921a5c8..fb7c5eb 100644
--- 
a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java
+++ 
b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java
@@ -208,12 +208,11 @@ public class TestSlowInvocationLogger {
 + "prepare: 0.0 ms\n"
 + "threadPoolQueue: 0.0 ms\n"
 + "server filters request : 0.0 ms\n"
-+ "server filters request : 0.0 ms\n"
 + "handlers request   : 0.0 ms\n"
 + "business execute   : 0.0 ms\n"
 + "handlers response  : 0.0 ms\n"
 + "server filters response: 0.0 ms\n"
-+ "send response  : {} ms",
++ "send response  : 0.0 ms",
 logCollector.getEvents().get(0).getMessage());
   }
 }



[GitHub] [servicecomb-java-chassis] coveralls commented on issue #1125: [SCB-1147] fix slow invocation log problem

2019-03-11 Thread GitBox
coveralls commented on issue #1125: [SCB-1147] fix slow invocation log problem
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1125#issuecomment-471611076
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/22108998/badge)](https://coveralls.io/builds/22108998)
   
   Coverage remained the same at 85.518% when pulling 
**60d174ac51b936a319d924dd4af9dde268422357 on yhs0092:fix_slow_invocation_log** 
into **f0dc08fc58bed4eec781b41e0679139710d24a7e on apache:master**.
   


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] yhs0092 opened a new pull request #1125: [SCB-1147] fix slow invocation log problem

2019-03-11 Thread GitBox
yhs0092 opened a new pull request #1125: [SCB-1147] fix slow invocation log 
problem
URL: https://github.com/apache/servicecomb-java-chassis/pull/1125
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
liubao68 merged pull request #1123: [SCB-1188] View convert download schemas
URL: https://github.com/apache/servicecomb-java-chassis/pull/1123
 
 
   


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


With regards,
Apache Git Services


[servicecomb-java-chassis] branch master updated (b110d7e -> f0dc08f)

2019-03-11 Thread liubao
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-java-chassis.git.


from b110d7e  [SCB-1179]Optimize the mainclass auto-discovery logic to 
cover more scenes.
 new ebd2f43  [SCB-1188] support return static resource as ServiceComb 
response
 new f7d3012  [SCB-1188] add http or https declare in swagger
 new 95d3520  [scb-1188] fix generated swagger to avoid convert to html 
problem
 new eaad1d1  [SCB-1188] add dependency for swagger to html
 new 5bf0f6d  [SCB-1188] add new module "inspector" to support 
view/download swagger or html convert from swagger
 new 860bb9d  [SCB-1188] fix by review comments
 new f0dc08f  [SCB-1188] integrate to basic solution

The 2153 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:
 .../resource/ClassPathStaticResourceHandler.java   |  22 +-
 .../rest/resource/StaticResourceHandler.java   |  73 ++
 .../TestClassPathStaticResourceHandler.java| 106 
 .../src/test/resources/config/test.properties  |  20 --
 .../src/test/resources/web-root/index.html |   6 +-
 .../provider/producer/ProducerProviderManager.java |  36 ++-
 coverage-reports/pom.xml   |   4 +
 demo/perf/pom.xml  |   4 +
 .../test/scaffolding/log/LogCollector.java |   8 +-
 {deployment => inspector}/pom.xml  |  49 ++--
 .../inspector/internal/InspectorBootListener.java  |  61 +
 .../inspector/internal/InspectorConfig.java|  38 ++-
 .../inspector/internal/InspectorImpl.java  | 203 +++
 .../internal/swagger/AppendStyleProcessor.java |  28 +-
 .../inspector/internal/swagger/SchemaFormat.java   |  21 +-
 inspector/src/main/resources/webroot/index.html|  66 +
 .../src/main/resources/webroot/static/css/main.css |  46 +++-
 .../webroot/static/images/ServiceComb-logo-3.jpg   | Bin 0 -> 8 bytes
 .../webroot/static/images/download-all.png | Bin 0 -> 208 bytes
 .../resources/webroot/static/images/download.png   | Bin 0 -> 178 bytes
 .../src/main/resources/webroot/static/js/main.js   |  33 +--
 .../resources/webroot/static/schemas/schemas.css   |  33 +--
 .../resources/webroot/static/schemas/schemas.js| 105 
 .../main/resources/webroot/static/tree/tree.css| 117 +
 .../src/main/resources/webroot/static/tree/tree.js | 110 
 .../src/main/resources/webroot/static/welcome.html |  11 +-
 .../internal/TestInspectorBootListener.java| 113 
 .../inspector/internal/TestInspectorImpl.java  | 290 +
 .../src/test/resources/schema1.yaml|  28 +-
 .../src/test/resources/schema2.yaml|  63 +++--
 integration-tests/it-common/pom.xml|   4 +
 java-chassis-dependencies/pom.xml  |  23 +-
 java-chassis-distribution/src/release/LICENSE  |   2 +
 pom.xml|   6 +
 solutions/solution-basic/pom.xml   |   6 +
 .../src/main/resources/microservice.yaml   |   6 +
 .../annotation/SwaggerDefinitionProcessor.java |  11 +-
 37 files changed, 1544 insertions(+), 208 deletions(-)
 copy 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/YAMLConfigLoader.java
 => 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 (64%)
 create mode 100644 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/StaticResourceHandler.java
 create mode 100644 
common/common-rest/src/test/java/org/apache/servicecomb/common/rest/resource/TestClassPathStaticResourceHandler.java
 delete mode 100644 common/common-rest/src/test/resources/config/test.properties
 copy handlers/handler-loadbalance/src/main/resources/config/cse.handler.xml => 
common/common-rest/src/test/resources/web-root/index.html (87%)
 copy {deployment => inspector}/pom.xml (70%)
 create mode 100644 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/InspectorBootListener.java
 copy 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/AbstractParamProcessor.java
 => 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/InspectorConfig.java
 (50%)
 create mode 100644 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/InspectorImpl.java
 copy 
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/event/AlarmEvent.java
 => 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/swagger/AppendStyleProcessor.java
 (61%)
 copy 

[GitHub] [servicecomb-java-chassis] coveralls edited a comment on issue #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
coveralls edited a comment on issue #1123: [SCB-1188] View convert download 
schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#issuecomment-471340273
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/22100300/badge)](https://coveralls.io/builds/22100300)
   
   Coverage increased (+0.06%) to 85.521% when pulling 
**12fb035e020df2cd06a2ee11769473ef58173776 on 
wujimin:view-convert-download-schemas** into 
**b110d7efbb38cbc958bc8b6a43a72ca90f8d6487 on apache:master**.
   


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] wujimin commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
wujimin commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264132622
 
 

 ##
 File path: 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/InspectorImpl.java
 ##
 @@ -0,0 +1,201 @@
+/*
+ * 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.inspector.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.http.Part;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
+
+import 
org.apache.servicecomb.common.rest.resource.ClassPathStaticResourceHandler;
+import org.apache.servicecomb.common.rest.resource.StaticResourceHandler;
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+import org.apache.servicecomb.inspector.internal.swagger.AppendStyleProcessor;
+import org.apache.servicecomb.inspector.internal.swagger.SchemaFormat;
+import org.apache.servicecomb.serviceregistry.RegistryUtils;
+import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.swagger.invocation.Response;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.Asciidoctor.Factory;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.AttributesBuilder;
+import org.asciidoctor.OptionsBuilder;
+import org.asciidoctor.SafeMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Ordering;
+
+import io.github.swagger2markup.Swagger2MarkupConfig;
+import io.github.swagger2markup.Swagger2MarkupConverter;
+import io.github.swagger2markup.Swagger2MarkupConverter.Builder;
+import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.models.parameters.Parameter;
+
+@Path("/inspector")
+public class InspectorImpl {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(InspectorImpl.class);
+
+  private InspectorConfig inspectorConfig;
+
+  private Map schemas;
+
+  private volatile Asciidoctor asciidoctor;
+
+  private StaticResourceHandler resourceHandler = new 
ClassPathStaticResourceHandler();
+
+  public InspectorImpl(InspectorConfig inspectorConfig, Map 
schemas) {
+this.inspectorConfig = inspectorConfig;
+this.schemas = schemas;
+  }
+
+  @Path("/schemas")
+  @GET
+  public Collection getSchemaIds() {
+return schemas.keySet();
+  }
+
+  @Path("/download/schemas")
+  @GET
+  @ApiResponse(code = 200, message = "", response = File.class)
+  public Response downloadSchemas(@QueryParam("format") SchemaFormat format) 
throws IOException {
+if (format == null) {
+  format = SchemaFormat.SWAGGER;
+}
+
+// normally, schema will not be too big, just save them in memory 
temporarily
+ByteArrayOutputStream os = new ByteArrayOutputStream();
+ZipOutputStream zos = new ZipOutputStream(os);
 
 Review comment:
   done
   add two new commit


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
liubao68 commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264115426
 
 

 ##
 File path: 
inspector/src/main/java/org/apache/servicecomb/inspector/internal/InspectorImpl.java
 ##
 @@ -0,0 +1,201 @@
+/*
+ * 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.inspector.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.http.Part;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
+
+import 
org.apache.servicecomb.common.rest.resource.ClassPathStaticResourceHandler;
+import org.apache.servicecomb.common.rest.resource.StaticResourceHandler;
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+import org.apache.servicecomb.inspector.internal.swagger.AppendStyleProcessor;
+import org.apache.servicecomb.inspector.internal.swagger.SchemaFormat;
+import org.apache.servicecomb.serviceregistry.RegistryUtils;
+import org.apache.servicecomb.swagger.SwaggerUtils;
+import org.apache.servicecomb.swagger.invocation.Response;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.Asciidoctor.Factory;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.AttributesBuilder;
+import org.asciidoctor.OptionsBuilder;
+import org.asciidoctor.SafeMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Ordering;
+
+import io.github.swagger2markup.Swagger2MarkupConfig;
+import io.github.swagger2markup.Swagger2MarkupConverter;
+import io.github.swagger2markup.Swagger2MarkupConverter.Builder;
+import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.models.parameters.Parameter;
+
+@Path("/inspector")
+public class InspectorImpl {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(InspectorImpl.class);
+
+  private InspectorConfig inspectorConfig;
+
+  private Map schemas;
+
+  private volatile Asciidoctor asciidoctor;
+
+  private StaticResourceHandler resourceHandler = new 
ClassPathStaticResourceHandler();
+
+  public InspectorImpl(InspectorConfig inspectorConfig, Map 
schemas) {
+this.inspectorConfig = inspectorConfig;
+this.schemas = schemas;
+  }
+
+  @Path("/schemas")
+  @GET
+  public Collection getSchemaIds() {
+return schemas.keySet();
+  }
+
+  @Path("/download/schemas")
+  @GET
+  @ApiResponse(code = 200, message = "", response = File.class)
+  public Response downloadSchemas(@QueryParam("format") SchemaFormat format) 
throws IOException {
+if (format == null) {
+  format = SchemaFormat.SWAGGER;
+}
+
+// normally, schema will not be too big, just save them in memory 
temporarily
+ByteArrayOutputStream os = new ByteArrayOutputStream();
+ZipOutputStream zos = new ZipOutputStream(os);
 
 Review comment:
   It's better to use try with resouce clause to make resource properly closed. 
And not throw IOException in REST definition.


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] wujimin commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
wujimin commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264113380
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.common.rest.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.http.Part;
+
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+
+public class ClassPathStaticResourceHandler extends StaticResourceHandler {
+  protected Part findResource(String path) throws IOException {
+URL url = this.getClass().getClassLoader().getResource(path);
 
 Review comment:
   ResourceHandler is a reuseable class, it's not provide service directly
   if someone want to change the directory, can do it manually, eg: 
   in org.apache.servicecomb.inspector.internal.InspectorImpl, invoke: 
resourceHandler.setWebRoot("static/")


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
liubao68 commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264110340
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.common.rest.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.http.Part;
+
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+
+public class ClassPathStaticResourceHandler extends StaticResourceHandler {
+  protected Part findResource(String path) throws IOException {
+URL url = this.getClass().getClassLoader().getResource(path);
 
 Review comment:
   ok, is it better to rename webroot to static? So that we can migrate from 
spring boot. Or we can add a configuration for webroot.


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] wujimin commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
wujimin commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264107674
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.common.rest.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.http.Part;
+
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+
+public class ClassPathStaticResourceHandler extends StaticResourceHandler {
+  protected Part findResource(String path) throws IOException {
+URL url = this.getClass().getClassLoader().getResource(path);
 
 Review comment:
   already checked in:
   org.apache.servicecomb.common.rest.resource.StaticResourceHandler#handle
   
   findResource is a protected method


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
liubao68 commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264106882
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.common.rest.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.http.Part;
+
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+
+public class ClassPathStaticResourceHandler extends StaticResourceHandler {
+  protected Part findResource(String path) throws IOException {
+URL url = this.getClass().getClassLoader().getResource(path);
 
 Review comment:
   Is it better to constraint the static contents are located in $jar/static ? 
(just like spring boot did) Or we need to check the file suffix to make sure 
not download unexpected files. 


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


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1123: [SCB-1188] View convert download schemas

2019-03-11 Thread GitBox
liubao68 commented on a change in pull request #1123: [SCB-1188] View convert 
download schemas
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1123#discussion_r264106882
 
 

 ##
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/resource/ClassPathStaticResourceHandler.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.common.rest.resource;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.http.Part;
+
+import org.apache.servicecomb.foundation.common.part.InputStreamPart;
+
+public class ClassPathStaticResourceHandler extends StaticResourceHandler {
+  protected Part findResource(String path) throws IOException {
+URL url = this.getClass().getClassLoader().getResource(path);
 
 Review comment:
   Is it better to constraint the static contents are located in $jar/webapp ? 
Or we need to check the file suffix to make sure not download unexpected files. 


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


With regards,
Apache Git Services


[servicecomb-docs] branch master updated: [SCB-1162]document for PriorityProperty/InjectProperties/InjectProperty

2019-03-11 Thread liubao
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-docs.git


The following commit(s) were added to refs/heads/master by this push:
 new 81947e9  [SCB-1162]document for 
PriorityProperty/InjectProperties/InjectProperty
81947e9 is described below

commit 81947e959785567645bdd4fe35e78900e080
Author: yangshaoqin 
AuthorDate: Tue Mar 5 14:39:16 2019 +0800

[SCB-1162]document for PriorityProperty/InjectProperties/InjectProperty
---
 java-chassis-reference/en_US/SUMMARY.md|  1 +
 .../en_US/config/inject-config.md  | 91 ++
 java-chassis-reference/zh_CN/SUMMARY.md|  1 +
 .../zh_CN/config/inject-config.md  | 87 +
 4 files changed, 180 insertions(+)

diff --git a/java-chassis-reference/en_US/SUMMARY.md 
b/java-chassis-reference/en_US/SUMMARY.md
index 8ec9234..70a98b5 100644
--- a/java-chassis-reference/en_US/SUMMARY.md
+++ b/java-chassis-reference/en_US/SUMMARY.md
@@ -67,6 +67,7 @@
   * [Thread Model](general-development/thread-model.md)
 * [Configuration](catalog/config.md)
   * [General config](config/general-config.md)
+  * [Configuration injection](config/inject-config.md)
 * [Service Capability Open](edge/open-service.md)
   * [Using Edge Service](edge/by-servicecomb-sdk.md)
   * [Using confd and Nginx as edge services](edge/nginx.md)
diff --git a/java-chassis-reference/en_US/config/inject-config.md 
b/java-chassis-reference/en_US/config/inject-config.md
new file mode 100644
index 000..b44c547
--- /dev/null
+++ b/java-chassis-reference/en_US/config/inject-config.md
@@ -0,0 +1,91 @@
+# Configuration injection
+ServiceComb provides the ability to inject configuration attributes into Java 
object fields and wildcard support.
+
+A Java object can be a Java Bean or a class with a public field.
+
+## Configure injection objects
+
+We first design two Java classes to inject configuration attributes to 
demonstrate scenarios where annotations are not used and where annotations are 
used.
+
+```Java
+/*
+Use ServiceComb annotations
+*/
+@InjectProperties(prefix = "root") //Specify the prefix of the configuration 
attribute associated with the model
+public class ConfigWithAnnotation {
+
+  /*
+  The prefix attribute value "override" here overrides the prefix attribute 
value "root" labeled in the @InjectProperties annotation of the class 
definition. The keys attribute can be an array of strings and the lower the 
subscript of the array element, the higher the priority.
+
+  Configuration attributes are searched by the attribute names in the 
following order until the configuration attributes that have been configured 
are found, then the search is stopped:
+   1)override.high
+  2)override.low
+   */
+  @InjectProperty(prefix = "override", keys = {"high", "low"})
+  public String strValue;
+
+  //Keys support wildcards and specify wildcards'input objects when 
configuration attributes are injected.
+  @InjectProperty(keys = "${key}.value")
+  public int intValue;
+
+   //The wildcard's surrogate object can be a list of strings. Priority 
follows the strategy that the lower the subscript of array elements, the higher 
the priority.
+   @InjectProperty(keys = "${full-list}")
+  public float floatValue;
+
+  //The keys attribute also supports multiple wildcards, with priority as 
follows: first, the priority of wildcards decreases from left to right, and 
then, if wildcards are substituted into List, the lower the index of elements 
in List, the higher the priority strategy.
+  @InjectProperty(keys = "${low-list}.a.${high-list}.b")
+  public long longValue;
+
+   //Default values can be specified by the defaultValue attribute of the 
annotation. If the field is not associated with any configuration properties, 
the default values defined will take effect, otherwise the default values will 
be overwritten.
+  @InjectProperty(defaultValue = "abc")
+  public String strDef;
+
+}
+```
+
+```Java
+/*
+not use Service Comb annotations
+*/
+public class ConfigNoAnnotation {
+  /*
+  If the @InjectProperties and @InjectProperty annotations are not provided, 
the field name is used as the configuration property name by default. Note that 
class names do not function as prefixes.
+
+  Here, the configuration property strValue is bound to the field
+   */
+  public String strValue;
+}
+```
+
+## Execution injection
+We can execute injection with the following sample code:
+
+Inject configuration properties into objects without `InjectProperties` and 
`InjectProperty` annotations:
+
+```Java
+ConfigNoAnnotation config = new 
ConfigObjectFactory().create(ConfigNoAnnotation.class);
+```
+
+Inject configuration properties into objects annotated with `InjectProperties` 
and `InjectProperty`:
+
+* Inject the configuration property named `root.k.value` into the intValue 
field of a 

[GitHub] [servicecomb-docs] liubao68 merged pull request #88: [SCB-1162]document for PriorityProperty/InjectProperties/InjectProperty

2019-03-11 Thread GitBox
liubao68 merged pull request #88: [SCB-1162]document for 
PriorityProperty/InjectProperties/InjectProperty
URL: https://github.com/apache/servicecomb-docs/pull/88
 
 
   


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


With regards,
Apache Git Services


[servicecomb-docs] branch master updated: Update interface-constraints.md

2019-03-11 Thread liubao
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-docs.git


The following commit(s) were added to refs/heads/master by this push:
 new 98dda74  Update interface-constraints.md
98dda74 is described below

commit 98dda742622b60ee8e8dc5f108bdb42f4c3f9511
Author: wynejan 
AuthorDate: Thu Mar 7 12:03:23 2019 +0800

Update interface-constraints.md

BidDecimal拼写错误修改
---
 java-chassis-reference/zh_CN/build-provider/interface-constraints.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/java-chassis-reference/zh_CN/build-provider/interface-constraints.md 
b/java-chassis-reference/zh_CN/build-provider/interface-constraints.md
index 48a693d..a8e768a 100644
--- a/java-chassis-reference/zh_CN/build-provider/interface-constraints.md
+++ b/java-chassis-reference/zh_CN/build-provider/interface-constraints.md
@@ -41,7 +41,7 @@ ResponseType methodName(RequestType...)
 
 * 抽象的数据结构: java.lang.Object, net.sf.json.JsonObject等
 
-  **备注:** 
最新版本可以使用java.lang.Object作为参数和返回值。它的运行时类型可以是int、String、Map等。尽管如此,建议开发者不要使用抽象数据结构,以及第三方提供的非POJO类作为接口的参数和返回值。这些类型包括java.math.BigDecimal、org.joda.time.JodaTime等。这些类型会给开发者带来很大的困扰。比如开发者可能以为BidDecimal会以数字传输,实际不然,并且在某些内部状态没正确计算的情况下,得到的并不是用户预期的值。
+  **备注:** 
最新版本可以使用java.lang.Object作为参数和返回值。它的运行时类型可以是int、String、Map等。尽管如此,建议开发者不要使用抽象数据结构,以及第三方提供的非POJO类作为接口的参数和返回值。这些类型包括java.math.BigDecimal、org.joda.time.JodaTime等。这些类型会给开发者带来很大的困扰。比如开发者可能以为BigDecimal会以数字传输,实际不然,并且在某些内部状态没正确计算的情况下,得到的并不是用户预期的值。
 
 * 接口或者抽象类
   ```java
@@ -157,4 +157,4 @@ Person test(Person input)
   String personStr = JsonUtils.writeValueAsString(input);
   result = template.postForObject(cseUrlPrefix + "sayhello", personStr, 
Person.class);
 ```
-ServiceComb不推荐开发者这样使用,里面的处理逻辑存在大量歧义。如果必须使用,需要满足几个约束:Person必须包含带String类型的构造函数;provider/consumer都必须存在这个Person类型。
\ No newline at end of file
+ServiceComb不推荐开发者这样使用,里面的处理逻辑存在大量歧义。如果必须使用,需要满足几个约束:Person必须包含带String类型的构造函数;provider/consumer都必须存在这个Person类型。



[GitHub] [servicecomb-docs] liubao68 merged pull request #90: Update interface-constraints.md

2019-03-11 Thread GitBox
liubao68 merged pull request #90: Update interface-constraints.md
URL: https://github.com/apache/servicecomb-docs/pull/90
 
 
   


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


With regards,
Apache Git Services