You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/25 04:46:46 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN opened a new pull request #1408: Improve trailing slash handling

TeslaCN opened a new pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408


   Ref #1284 
   
   Trailing slash is a slash at the end of uri, like "/app/job/".
   If trailing slash sensitive, "/app/job" and "/app/job/" are not equivalent. Otherwise, "/app/job" and "/app/job/" will be mapped to a same handler.
   Trailing slash in insensitive by default. Developers can enable trailing slash sensitive by configuring NettyResfulServiceConfiguration.
   
   Changes proposed in this pull request:
   - Add option "trailingSlashSensitive".
   - Complete testcases.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#issuecomment-679899971


   CI [https://travis-ci.org/github/apache/shardingsphere-elasticjob/builds/720907655](https://travis-ci.org/github/apache/shardingsphere-elasticjob/builds/720907655) failed because of #1405 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476238346



##########
File path: elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HttpClient.java
##########
@@ -66,8 +65,11 @@ protected void initChannel(final Channel ch) throws Exception {
                                 .addLast(new SimpleChannelInboundHandler<FullHttpResponse>() {
                                     @Override
                                     protected void channelRead0(final ChannelHandlerContext ctx, final FullHttpResponse httpResponse) throws Exception {
-                                        consumer.accept(httpResponse);
-                                        countDownLatch.countDown();
+                                        try {
+                                            consumer.accept(httpResponse);
+                                        } finally {
+                                            countDownLatch.countDown();

Review comment:
       > Why need CountDownLatch? Maybe I have to clone the branch for deeply reviewing .
   
   The HTTP client for unit test is implemented via Netty, which handle http response asynchronously. So I use CountDownLatch to wait for http response consumer finish.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476197994



##########
File path: elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HttpClient.java
##########
@@ -66,8 +65,11 @@ protected void initChannel(final Channel ch) throws Exception {
                                 .addLast(new SimpleChannelInboundHandler<FullHttpResponse>() {
                                     @Override
                                     protected void channelRead0(final ChannelHandlerContext ctx, final FullHttpResponse httpResponse) throws Exception {
-                                        consumer.accept(httpResponse);
-                                        countDownLatch.countDown();
+                                        try {
+                                            consumer.accept(httpResponse);
+                                        } finally {
+                                            countDownLatch.countDown();

Review comment:
       Why need CountDownLatch? Maybe I have to clone the branch for deeply reviewing .




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- merged pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
Technoboy- merged pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476198923



##########
File path: elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/controller/IndexController.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.shardingsphere.elasticjob.restful.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.elasticjob.restful.Http;
+import org.apache.shardingsphere.elasticjob.restful.RestfulController;
+import org.apache.shardingsphere.elasticjob.restful.annotation.Mapping;
+
+@Slf4j
+public class IndexController implements RestfulController {

Review comment:
       Add final ?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476199610



##########
File path: elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/pipeline/NettyRestfulServiceTest.java
##########
@@ -82,43 +84,59 @@ public void assertRequestWithParameters() {
             assertThat(jobPojo.getGroup(), is("myGroup"));
             assertThat(jobPojo.getName(), is("myJob"));
             assertThat(jobPojo.getDescription(), is(description));
-        }, 10000L);
+        }, TESTCASE_TIMEOUT);
     }
     
-    @Test(timeout = 10000L)
-    public void assertCustomExceptionHandler() {
+    @Test(timeout = TESTCASE_TIMEOUT)

Review comment:
       Recommend to use @SneakyThrows for clean code.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on a change in pull request #1408: Improve trailing slash handling

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #1408:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476197249



##########
File path: elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/serializer/CustomTextPlainResponseBodySerializer.java
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.shardingsphere.elasticjob.restful.serializer;
+
+import io.netty.handler.codec.http.HttpHeaderValues;
+
+import java.nio.charset.StandardCharsets;
+
+public final class CustomTextPlainResponseBodySerializer implements ResponseBodySerializer {

Review comment:
       Miss java doc




----------------------------------------------------------------
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:
users@infra.apache.org