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

[servicecomb-samples] 12/32: demo enable inspector and fix context error

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

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

commit 135b17a3b638839dd0f8a75d185318ca876ce2fd
Author: liubao <ba...@huawei.com>
AuthorDate: Fri Apr 19 14:58:04 2019 +0800

    demo enable inspector and fix context error
---
 .../apache/servicecomb/samples/porter/gateway/ApiDispatcher.java    | 6 +++---
 porter_lightweight/pom.xml                                          | 4 ++++
 2 files changed, 7 insertions(+), 3 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 3057c1f..e801ebd 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,9 +47,9 @@ public class ApiDispatcher extends AbstractEdgeDispatcher {
     String path = "/" + pathParams.get("param1");
 
     EdgeInvocation invoker = new EdgeInvocation() {
-      // Authentication
-      protected void createInvocation() {
-        super.createInvocation();
+      // Authentication. Notice: adding context must after setContext or will override by network
+      protected void setContext() throws Exception {
+        super.setContext();
         // get session id from header and cookie for debug reasons
         String sessionId = context.request().getHeader("session-id");
         if (sessionId != null) {
diff --git a/porter_lightweight/pom.xml b/porter_lightweight/pom.xml
index 08a5500..1892c79 100644
--- a/porter_lightweight/pom.xml
+++ b/porter_lightweight/pom.xml
@@ -62,6 +62,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>solution-basic</artifactId>
     </dependency>
+        <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>inspector</artifactId>
+    </dependency>
   </dependencies>
 
   <modules>