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 2020/05/14 07:28:26 UTC

[servicecomb-fence] branch master updated: [SCB-1827] upgrade servicecomb-fence to use servicecomb 2.0.2

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-fence.git


The following commit(s) were added to refs/heads/master by this push:
     new 74bb155  [SCB-1827] upgrade servicecomb-fence to use servicecomb 2.0.2
74bb155 is described below

commit 74bb155b8b2e89043a72e5c28cf6cdc36e80bb66
Author: liubao <bi...@qq.com>
AuthorDate: Thu May 14 15:26:36 2020 +0800

    [SCB-1827] upgrade servicecomb-fence to use servicecomb 2.0.2
---
 .../authentication/server/GithubTokenGranter.java  |  23 +--
 .../servicecomb/authentication/token/Token.java    |   2 +
 .../edge/CustomVertxRestDispatcher.java            | 198 ---------------------
 ...cecomb.transport.rest.vertx.VertxHttpDispatcher |  18 --
 build_and_run.bat                                  |   4 +-
 pom.xml                                            |  19 +-
 .../authentication/GateRestTemplate.java           |  23 ++-
 .../authentication/ITUriTemplateHandler.java       |   6 +-
 .../authentication/gateway/ApiDispatcher.java      |  69 -------
 ...cecomb.transport.rest.vertx.VertxHttpDispatcher |   1 -
 .../src/main/resources/microservice.yaml           |  22 +--
 11 files changed, 45 insertions(+), 340 deletions(-)

diff --git a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
index d8ed4ac..24927db 100644
--- a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
+++ b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
@@ -17,8 +17,6 @@
 
 package org.apache.servicecomb.authentication.server;
 
-import java.io.UnsupportedEncodingException;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.authentication.token.AbstractOpenIDTokenStore;
 import org.apache.servicecomb.authentication.token.OpenIDToken;
@@ -118,20 +116,17 @@ public class GithubTokenGranter implements ThirdPartyTokenGranter {
     StringBuilder url = new StringBuilder();
     url.append(GithubDynamicPropertiesManager.getGithubConfiguration().getOauthAuthorizeURL() + "?");
     url.append("client_id=" + GithubDynamicPropertiesManager.getGithubConfiguration().getClientId() + "&");
-    try {
-      if (login != null) {
-        url.append("login=" + UriUtils.encode(login, "utf-8") + "&");
-        redirectURI = redirectURI + "&login=" + login;
-      }
-      if (scope != null) {
-        url.append("scope=" + UriUtils.encode(scope, "utf-8") + "&");
-      }
-      url.append("redirect_uri=" + UriUtils.encode(redirectURI, "utf-8") + "&");
-    } catch (UnsupportedEncodingException e) {
-      // will not happen, ignore
+
+    if (login != null) {
+      url.append("login=" + UriUtils.encode(login, "utf-8") + "&");
+      redirectURI = redirectURI + "&login=" + login;
     }
+    if (scope != null) {
+      url.append("scope=" + UriUtils.encode(scope, "utf-8") + "&");
+    }
+    url.append("redirect_uri=" + UriUtils.encode(redirectURI, "utf-8") + "&");
+
     url.append("state=" + initialState);
     return url.toString();
   }
-
 }
diff --git a/api/common/service/src/main/java/org/apache/servicecomb/authentication/token/Token.java b/api/common/service/src/main/java/org/apache/servicecomb/authentication/token/Token.java
index 55b1423..8f70398 100644
--- a/api/common/service/src/main/java/org/apache/servicecomb/authentication/token/Token.java
+++ b/api/common/service/src/main/java/org/apache/servicecomb/authentication/token/Token.java
@@ -23,6 +23,8 @@ import java.util.Map;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public interface Token extends Serializable {
+  long serialVersionUID = 8234764050908891544L;
+
   String getUsername();
 
   @JsonIgnore
diff --git a/api/edge-service/endpoint/src/main/java/org/apache/servicecomb/authentication/edge/CustomVertxRestDispatcher.java b/api/edge-service/endpoint/src/main/java/org/apache/servicecomb/authentication/edge/CustomVertxRestDispatcher.java
deleted file mode 100644
index 46fb804..0000000
--- a/api/edge-service/endpoint/src/main/java/org/apache/servicecomb/authentication/edge/CustomVertxRestDispatcher.java
+++ /dev/null
@@ -1,198 +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.
- */
-
-package org.apache.servicecomb.authentication.edge;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.servicecomb.common.rest.AbstractRestInvocation;
-import org.apache.servicecomb.common.rest.RestConst;
-import org.apache.servicecomb.common.rest.VertxRestInvocation;
-import org.apache.servicecomb.core.Const;
-import org.apache.servicecomb.core.CseContext;
-import org.apache.servicecomb.core.Transport;
-import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
-import org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx;
-import org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest;
-import org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse;
-import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
-import org.apache.servicecomb.transport.rest.vertx.AbstractVertxHttpDispatcher;
-import org.apache.servicecomb.transport.rest.vertx.VertxRestDispatcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.web.Router;
-import io.vertx.ext.web.RoutingContext;
-import io.vertx.ext.web.handler.CookieHandler;
-
-// copied from org.apache.servicecomb.transport.rest.vertx.VertxRestDispatcher 1.2.0
-// TODO: using 1.2.2+ to make it simpler
-public class CustomVertxRestDispatcher extends AbstractVertxHttpDispatcher {
-  private static final Logger LOGGER = LoggerFactory.getLogger(VertxRestDispatcher.class);
-
-  private Transport transport;
-
-  @Override
-  public int getOrder() {
-    return 10001;
-  }
-
-  @Override
-  public boolean enabled() {
-    return true;
-  }
-
-  @Override
-  public void init(Router router) {
-    // TODO: regex configuration
-    String regex = "(/v1/log|/inspector|/v1/token)(.*)";
-    router.routeWithRegex(regex).handler(CookieHandler.create());
-    router.routeWithRegex(regex).handler(createBodyHandler());
-    router.routeWithRegex(regex).failureHandler(this::failureHandler).handler(this::onRequest);
-  }
-
-  private void failureHandler(RoutingContext context) {
-    LOGGER.error("http server failed.", context.failure());
-
-    AbstractRestInvocation restProducerInvocation = context.get(RestConst.REST_PRODUCER_INVOCATION);
-    Throwable e = context.failure();
-    if (ErrorDataDecoderException.class.isInstance(e)) {
-      Throwable cause = e.getCause();
-      if (InvocationException.class.isInstance(cause)) {
-        e = cause;
-      }
-    }
-
-    // only when unexpected exception happens, it will run into here.
-    // the connection should be closed.
-    handleFailureAndClose(context, restProducerInvocation, e);
-  }
-
-  /**
-   * Try to find out the failure information and send it in response.
-   */
-  private void handleFailureAndClose(RoutingContext context, AbstractRestInvocation restProducerInvocation,
-      Throwable e) {
-    if (null != restProducerInvocation) {
-      // if there is restProducerInvocation, let it send exception in response. The exception is allowed to be null.
-      sendFailResponseByInvocation(context, restProducerInvocation, e);
-      return;
-    }
-
-    if (null != e) {
-      // if there exists exception, try to send this exception by RoutingContext
-      sendExceptionByRoutingContext(context, e);
-      return;
-    }
-
-    // if there is no exception, the response is determined by status code.
-    sendFailureRespDeterminedByStatus(context);
-  }
-
-  /**
-   * Try to determine response by status code, and send response.
-   */
-  private void sendFailureRespDeterminedByStatus(RoutingContext context) {
-    Family statusFamily = Family.familyOf(context.statusCode());
-    if (Family.CLIENT_ERROR.equals(statusFamily) || Family.SERVER_ERROR.equals(statusFamily) || Family.OTHER
-        .equals(statusFamily)) {
-      context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD)
-          .setStatusCode(context.statusCode()).end();
-    } else {
-      // it seems the status code is not set properly
-      context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD)
-          .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode())
-          .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())
-          .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()));
-    }
-    context.response().close();
-  }
-
-  /**
-   * Use routingContext to send failure information in throwable.
-   */
-  private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) {
-    if (InvocationException.class.isInstance(e)) {
-      InvocationException invocationException = (InvocationException) e;
-      context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD)
-          .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase())
-          .end(wrapResponseBody(invocationException.getReasonPhrase()));
-    } else {
-      context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD)
-          .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).end(wrapResponseBody(e.getMessage()));
-    }
-    context.response().close();
-  }
-
-  /**
-   * Consumer will treat the response body as json by default, so it's necessary to wrap response body as Json string
-   * to avoid deserialization error.
-   *
-   * @param message response body
-   * @return response body wrapped as Json string
-   */
-  String wrapResponseBody(String message) {
-    if (isValidJson(message)) {
-      return message;
-    }
-
-    JsonObject jsonObject = new JsonObject();
-    jsonObject.put("message", message);
-
-    return jsonObject.toString();
-  }
-
-  /**
-   * Check if the message is a valid Json string.
-   * @param message the message to be checked.
-   * @return true if message is a valid Json string, otherwise false.
-   */
-  private boolean isValidJson(String message) {
-    try {
-      new JsonObject(message);
-    } catch (Exception ignored) {
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   * Use restProducerInvocation to send failure message. The throwable is allowed to be null.
-   */
-  private void sendFailResponseByInvocation(RoutingContext context, AbstractRestInvocation restProducerInvocation,
-      Throwable e) {
-    restProducerInvocation.sendFailResponse(e);
-    context.response().close();
-  }
-
-  private void onRequest(RoutingContext context) {
-    if (transport == null) {
-      transport = CseContext.getInstance().getTransportManager().findTransport(Const.RESTFUL);
-    }
-    HttpServletRequestEx requestEx = new VertxServerRequestToHttpServletRequest(context);
-    HttpServletResponseEx responseEx = new VertxServerResponseToHttpServletResponse(context.response());
-
-    VertxRestInvocation vertxRestInvocation = new VertxRestInvocation();
-    context.put(RestConst.REST_PRODUCER_INVOCATION, vertxRestInvocation);
-    vertxRestInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
-  }
-}
diff --git a/api/edge-service/endpoint/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher b/api/edge-service/endpoint/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
deleted file mode 100644
index 53481f1..0000000
--- a/api/edge-service/endpoint/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
+++ /dev/null
@@ -1,18 +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.
-#
-
-org.apache.servicecomb.authentication.edge.CustomVertxRestDispatcher
\ No newline at end of file
diff --git a/build_and_run.bat b/build_and_run.bat
index 7d8ff86..979f8ce 100644
--- a/build_and_run.bat
+++ b/build_and_run.bat
@@ -15,4 +15,6 @@ cd %HOME%\samples\ResourceServer\target
 start java -jar resource-server-0.0.1-SNAPSHOT.jar
 
 cd %HOME%\samples\Client\target
-start java -jar client-0.0.1-SNAPSHOT.jar
\ No newline at end of file
+start java -jar client-0.0.1-SNAPSHOT.jar
+
+cd %HOME%
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ad944a2..f9c5beb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <java-chassis-version>1.3.0</java-chassis-version>
+    <java-chassis-version>2.0.2</java-chassis-version>
   </properties>
 
   <modules>
@@ -53,10 +53,6 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>solution-basic</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.servicecomb</groupId>
-      <artifactId>inspector</artifactId>
-    </dependency>
   </dependencies>
 
   <build>
@@ -67,14 +63,25 @@
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.1</version>
           <configuration>
+            <compilerArgument>-parameters</compilerArgument>
             <source>1.8</source>
             <target>1.8</target>
+            <showDeprecation>true</showDeprecation>
+            <showWarnings>true</showWarnings>
+            <compilerArgs>
+              <arg>-Werror</arg>
+              <arg>-Xlint:all</arg>
+              <!--not care for jdk8/jdk7 compatible problem-->
+              <arg>-Xlint:-classfile</arg>
+              <!--not care for annotations not processed-->
+              <arg>-Xlint:-processing</arg>
+            </compilerArgs>
           </configuration>
         </plugin>
         <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
-          <version>2.1.2.RELEASE</version>
+          <version>2.1.6.RELEASE</version>
           <executions>
             <execution>
               <goals>
diff --git a/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java b/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
index df981e5..69b0af1 100644
--- a/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
+++ b/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
@@ -18,8 +18,10 @@ package org.apache.servicecomb.authentication;
 
 import java.util.Arrays;
 
-import org.apache.servicecomb.core.definition.MicroserviceVersionMeta;
+import org.apache.servicecomb.core.SCBEngine;
+import org.apache.servicecomb.core.definition.MicroserviceMeta;
 import org.apache.servicecomb.core.definition.SchemaMeta;
+import org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig;
 import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
 import org.apache.servicecomb.serviceregistry.RegistryUtils;
 import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
@@ -68,7 +70,7 @@ public class GateRestTemplate extends RestTemplate {
   }
 
   private String getUrlPrefix(String gateName, String producerName, String schemaId) {
-    MicroserviceVersionRule microserviceVersionRule = RegistryUtils.getServiceRegistry()
+    MicroserviceVersionRule microserviceVersionRule = RegistryUtils
         .getAppManager()
         .getOrCreateMicroserviceVersionRule(RegistryUtils.getAppId(),
             gateName,
@@ -85,23 +87,20 @@ public class GateRestTemplate extends RestTemplate {
       urlSchema = "https";
     }
 
-    if(producerName == null) {
+    if (producerName == null) {
       return String
           .format("%s://%s:%d",
               urlSchema,
               edgeAddress.getHostOrIp(),
               edgeAddress.getPort());
     }
-    
-    microserviceVersionRule = RegistryUtils.getServiceRegistry()
-        .getAppManager()
-        .getOrCreateMicroserviceVersionRule(RegistryUtils.getAppId(),
-            producerName,
-            DefinitionConst.VERSION_RULE_ALL);
-    MicroserviceVersionMeta microserviceVersionMeta = microserviceVersionRule.getLatestMicroserviceVersion();
-    SchemaMeta schemaMeta = microserviceVersionMeta.getMicroserviceMeta().ensureFindSchemaMeta(schemaId);
 
-    if(producerName.equals(gateName)) {
+    MicroserviceReferenceConfig microserviceReferenceConfig = SCBEngine.getInstance()
+        .createMicroserviceReferenceConfig(producerName);
+    MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
+    SchemaMeta schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
+
+    if (producerName.equals(gateName)) {
       return String
           .format("%s://%s:%d/%s",
               urlSchema,
diff --git a/samples/Client/src/main/java/org/apache/servicecomb/authentication/ITUriTemplateHandler.java b/samples/Client/src/main/java/org/apache/servicecomb/authentication/ITUriTemplateHandler.java
index 8308599..198bc8d 100644
--- a/samples/Client/src/main/java/org/apache/servicecomb/authentication/ITUriTemplateHandler.java
+++ b/samples/Client/src/main/java/org/apache/servicecomb/authentication/ITUriTemplateHandler.java
@@ -19,9 +19,9 @@ package org.apache.servicecomb.authentication;
 import java.net.URI;
 import java.util.Map;
 
-import org.springframework.web.util.DefaultUriTemplateHandler;
-
-public class ITUriTemplateHandler extends DefaultUriTemplateHandler {
+@SuppressWarnings("deprecation")
+// TODO : upgrade to spring 5 will having warning's , we'll fix it later
+public class ITUriTemplateHandler extends org.springframework.web.util.DefaultUriTemplateHandler {
   private String urlPrefix;
 
   public ITUriTemplateHandler(String urlPrefix) {
diff --git a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/ApiDispatcher.java b/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/ApiDispatcher.java
deleted file mode 100644
index 7642268..0000000
--- a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/ApiDispatcher.java
+++ /dev/null
@@ -1,69 +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.
- */
-
-package org.apache.servicecomb.authentication.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;
-
-//TODO: using 1.2.2+ to make it simpler
-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() {
-      // 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) {
-          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/samples/EdgeService/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher b/samples/EdgeService/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
index cf4f35b..d3f7adc 100644
--- a/samples/EdgeService/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
+++ b/samples/EdgeService/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.servicecomb.authentication.gateway.ApiDispatcher
 org.apache.servicecomb.authentication.gateway.StaticWebpageDispatcher
\ No newline at end of file
diff --git a/samples/EdgeService/src/main/resources/microservice.yaml b/samples/EdgeService/src/main/resources/microservice.yaml
index c75034f..ba60751 100644
--- a/samples/EdgeService/src/main/resources/microservice.yaml
+++ b/samples/EdgeService/src/main/resources/microservice.yaml
@@ -43,28 +43,14 @@ servicecomb:
           authentication-server: internalAccess,qps-flowcontrol-consumer,loadbalance
           authentication-client: internalAccess,qps-flowcontrol-consumer,loadbalance
 
-  uploads:
-    directory: tmp_for_upload_gateway
-
-  samples:
-    logdir: D:\code\servicecomb-samples\porter_lightweight\gateway-service
-    
-  inspector:
-    enabled: false
-
-  executors:
-   Provider:
-     log: servicecomb.samples.executor.groupThreadPool
-     inspector: servicecomb.samples.executor.groupThreadPool
-
-# disable all servicecomb difault dispatchers, all of them are overriden
   http:
     dispatcher:
       edge:
         default:
-          enabled: false # overriden by ApiDispatcher
-      rest:
-        enabled: false # overriden by CustomVertxRestDispatcher
+          enabled: true
+          prefix: api
+          withVersion: false
+          prefixSegmentCount: 2
 
 # StaticWebpageDispatcher checking file exists is async, and will mark request status to ended, and VertxRestDispatcher read 
 # body will print exception.