You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/06/04 06:22:07 UTC

[GitHub] liubao68 closed pull request #746: [SCB-637] Enhance HttpServletRequestEx impl

liubao68 closed pull request #746: [SCB-637] Enhance HttpServletRequestEx impl
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/746
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java
index 6edcee4e2..ed94d7611 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/http/HttpUtils.java
@@ -81,4 +81,32 @@ public static String parseFileNameFromHeaderValue(String headerValue) {
     fileName = uriDecodePath(fileName);
     return new File(fileName).getName();
   }
+
+  /**
+   * Parse the character encoding from the specified content type header.
+   * If the content type is null, or there is no explicit character encoding,
+   * <code>null</code> is returned.
+   *
+   * @param contentType a content type header
+   */
+  public static String getCharsetFromContentType(String contentType) {
+    if (contentType == null) {
+      return null;
+    }
+    int start = contentType.indexOf("charset=");
+    if (start < 0) {
+      return null;
+    }
+    String encoding = contentType.substring(start + 8);
+    int end = encoding.indexOf(';');
+    if (end >= 0) {
+      encoding = encoding.substring(0, end);
+    }
+    encoding = encoding.trim();
+    if ((encoding.length() > 2) && (encoding.startsWith("\""))
+        && (encoding.endsWith("\""))) {
+      encoding = encoding.substring(1, encoding.length() - 1);
+    }
+    return encoding.trim();
+  }
 }
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/http/TestHttpUtils.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/http/TestHttpUtils.java
index 5fbd603c0..6fc0c8c75 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/http/TestHttpUtils.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/http/TestHttpUtils.java
@@ -18,6 +18,8 @@
 
 import java.net.URISyntaxException;
 
+import javax.ws.rs.core.MediaType;
+
 import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Rule;
@@ -111,4 +113,53 @@ public void parseFileNameFromHeaderValue_defaultName() {
   public void parseFileNameFromHeaderValue_ignorePath() {
     Assert.assertEquals("a.txt", HttpUtils.parseFileNameFromHeaderValue("xx;filename=../../a.txt"));
   }
+
+  @Test
+  public void getCharsetFromContentType_noContentType() {
+    String character = HttpUtils.getCharsetFromContentType(null);
+
+    Assert.assertNull(character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_noCharset() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON);
+
+    Assert.assertNull(character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_noSemicolonEnd() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON + ";charset=utf-8");
+
+    Assert.assertEquals("utf-8", character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_semicolonEnd() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON + ";charset=utf-8;");
+
+    Assert.assertEquals("utf-8", character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_needTrim() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON + ";charset= utf-8 ;");
+
+    Assert.assertEquals("utf-8", character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_quotationMarks() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON + ";charset=\"utf-8\";");
+
+    Assert.assertEquals("utf-8", character);
+  }
+
+  @Test
+  public void getCharsetFromContentType_quotationMarks_needTrim() {
+    String character = HttpUtils.getCharsetFromContentType(MediaType.APPLICATION_JSON + ";charset=\" utf-8 \";");
+
+    Assert.assertEquals("utf-8", character);
+  }
 }
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/StandardHttpServletRequestEx.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/StandardHttpServletRequestEx.java
index a6b142da7..f9b29cacb 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/StandardHttpServletRequestEx.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/StandardHttpServletRequestEx.java
@@ -18,12 +18,27 @@
 package org.apache.servicecomb.foundation.vertx.http;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.utils.URLEncodedUtils;
 import org.apache.servicecomb.foundation.vertx.stream.BufferInputStream;
 
 import io.netty.buffer.ByteBuf;
@@ -37,6 +52,11 @@
 
   private ServletInputStream inputStream;
 
+  // by servlet specification
+  // only parse application/x-www-form-urlencoded of post request automatically
+  // we will parse this even not post method
+  private Map<String, String[]> parameterMap;
+
   public StandardHttpServletRequestEx(HttpServletRequest request) {
     super(request);
   }
@@ -79,4 +99,74 @@ public Buffer getBodyBuffer() {
   public int getBodyBytesLength() {
     return bodyBuffer.getBodyBytesLength();
   }
+
+  private Map<String, String[]> parseParameterMap() {
+    // 1.post method already parsed by servlet
+    // 2.not APPLICATION_FORM_URLENCODED, no need to enhance
+    if (getMethod().equalsIgnoreCase(HttpMethod.POST)
+        || !StringUtils.startsWithIgnoreCase(getContentType(), MediaType.APPLICATION_FORM_URLENCODED)) {
+      return super.getParameterMap();
+    }
+
+    Map<String, List<String>> listMap = parseUrlEncodedBody();
+    mergeParameterMaptoListMap(listMap);
+    return convertListMapToArrayMap(listMap);
+  }
+
+  private Map<String, String[]> convertListMapToArrayMap(Map<String, List<String>> listMap) {
+    Map<String, String[]> arrayMap = new HashMap<>();
+    for (Entry<String, List<String>> entry : listMap.entrySet()) {
+      arrayMap.put(entry.getKey(), entry.getValue().toArray(new String[entry.getValue().size()]));
+    }
+    return arrayMap;
+  }
+
+  private void mergeParameterMaptoListMap(Map<String, List<String>> listMap) {
+    for (Entry<String, String[]> entry : super.getParameterMap().entrySet()) {
+      List<String> values = listMap.computeIfAbsent(entry.getKey(), k -> new ArrayList<>());
+      // follow servlet behavior, inherited value first, and then body value
+      values.addAll(0, Arrays.asList(entry.getValue()));
+    }
+  }
+
+  private Map<String, List<String>> parseUrlEncodedBody() {
+    try (InputStream inputStream = getInputStream()) {
+      Map<String, List<String>> listMap = new HashMap<>();
+      String body = IOUtils.toString(inputStream);
+      List<NameValuePair> pairs = URLEncodedUtils
+          .parse(body, getCharacterEncoding() == null ? null : Charset.forName(getCharacterEncoding()));
+      for (NameValuePair pair : pairs) {
+        List<String> values = listMap.computeIfAbsent(pair.getName(), k -> new ArrayList<>());
+        values.add(pair.getValue());
+      }
+      return listMap;
+    } catch (IOException e) {
+      throw new IllegalStateException("", e);
+    }
+  }
+
+  @Override
+  public String[] getParameterValues(String name) {
+    return getParameterMap().get(name);
+  }
+
+  @Override
+  public String getParameter(String name) {
+    String[] values = getParameterMap().get(name);
+    return values == null ? null : values[0];
+  }
+
+  @Override
+  public Enumeration<String> getParameterNames() {
+    return Collections.enumeration(getParameterMap().keySet());
+  }
+
+  @Override
+  public Map<String, String[]> getParameterMap() {
+    if (parameterMap == null) {
+      parameterMap = parseParameterMap();
+    }
+
+    return parameterMap;
+  }
 }
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxClientRequestToHttpServletRequest.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxClientRequestToHttpServletRequest.java
index 3563d4d3c..72fd366cb 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxClientRequestToHttpServletRequest.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxClientRequestToHttpServletRequest.java
@@ -20,12 +20,18 @@
 import java.util.Collections;
 import java.util.Enumeration;
 
+import javax.ws.rs.core.HttpHeaders;
+
+import org.apache.servicecomb.foundation.common.http.HttpUtils;
+
 import io.vertx.core.buffer.Buffer;
 import io.vertx.core.http.HttpClientRequest;
 
 public class VertxClientRequestToHttpServletRequest extends AbstractHttpServletRequest {
   private HttpClientRequest clientRequest;
 
+  private String characterEncoding;
+
   public VertxClientRequestToHttpServletRequest(HttpClientRequest clientRequest, Buffer bodyBuffer) {
     this.clientRequest = clientRequest;
     setBodyBuffer(bodyBuffer);
@@ -70,4 +76,23 @@ public void addHeader(String name, String value) {
   public String getContextPath() {
     return "";
   }
+
+  @Override
+  public String getMethod() {
+    return clientRequest.method().name();
+  }
+
+  @Override
+  public String getContentType() {
+    return clientRequest.headers().get(HttpHeaders.CONTENT_TYPE);
+  }
+
+  @Override
+  public String getCharacterEncoding() {
+    if (characterEncoding == null) {
+      characterEncoding = HttpUtils.getCharsetFromContentType(getContentType());
+    }
+
+    return characterEncoding;
+  }
 }
diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
index 47e9d4da2..f19858718 100644
--- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
+++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerRequestToHttpServletRequest.java
@@ -31,6 +31,7 @@
 import javax.servlet.http.Part;
 import javax.ws.rs.core.HttpHeaders;
 
+import org.apache.servicecomb.foundation.common.http.HttpUtils;
 import org.apache.servicecomb.foundation.vertx.stream.BufferInputStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,6 +61,11 @@
 
   private SocketAddress socketAddress;
 
+  // cache from convert vertx parameters to servlet parameters
+  private Map<String, String[]> parameterMap;
+
+  private String characterEncoding;
+
   public VertxServerRequestToHttpServletRequest(RoutingContext context, String path) {
     this(context);
     this.path = path;
@@ -106,19 +112,27 @@ public String getParameter(String name) {
 
   @Override
   public String[] getParameterValues(String name) {
+    if (parameterMap != null) {
+      return parameterMap.get(name);
+    }
+
     List<String> paramList = this.vertxRequest.params().getAll(name);
-    return (String[]) paramList.toArray(new String[paramList.size()]);
+    return paramList.toArray(new String[paramList.size()]);
   }
 
   @Override
   public Map<String, String[]> getParameterMap() {
-    Map<String, String[]> paramMap = new HashMap<>();
-    MultiMap map = this.vertxRequest.params();
-    for (String name : map.names()) {
-      List<String> valueList = map.getAll(name);
-      paramMap.put(name, (String[]) map.getAll(name).toArray(new String[valueList.size()]));
+    if (parameterMap == null) {
+      Map<String, String[]> paramMap = new HashMap<>();
+      MultiMap map = this.vertxRequest.params();
+      for (String name : map.names()) {
+        List<String> valueList = map.getAll(name);
+        paramMap.put(name, map.getAll(name).toArray(new String[valueList.size()]));
+      }
+      parameterMap = paramMap;
     }
-    return paramMap;
+
+    return parameterMap;
   }
 
   @Override
@@ -240,4 +254,13 @@ public Part getPart(String name) {
   public RoutingContext getContext() {
     return context;
   }
+
+  @Override
+  public String getCharacterEncoding() {
+    if (characterEncoding == null) {
+      characterEncoding = HttpUtils.getCharsetFromContentType(getContentType());
+    }
+
+    return characterEncoding;
+  }
 }
diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestStandardHttpServletRequestEx.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestStandardHttpServletRequestEx.java
index ed5a884f6..f87e83c81 100644
--- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestStandardHttpServletRequestEx.java
+++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestStandardHttpServletRequestEx.java
@@ -19,11 +19,19 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.servicecomb.foundation.vertx.stream.BufferInputStream;
+import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -78,4 +86,50 @@ public void getInputStreamCache() throws IOException {
     // do not create another one
     Assert.assertSame(cachedInputStream, requestEx.getInputStream());
   }
+
+  @Test
+  public void parameterMap_inherited() {
+    Map<String, String[]> inherited = new HashMap<>();
+    String[] v1 = new String[] {"v1-1", "v1-2"};
+    inherited.put("p1", v1);
+    new Expectations() {
+      {
+        request.getParameterMap();
+        result = inherited;
+        request.getMethod();
+        result = HttpMethod.POST;
+      }
+    };
+
+    Assert.assertSame(inherited, requestEx.getParameterMap());
+    Assert.assertThat(Collections.list(requestEx.getParameterNames()), Matchers.contains("p1"));
+    Assert.assertSame(v1, requestEx.getParameterValues("p1"));
+    Assert.assertEquals("v1-1", requestEx.getParameter("p1"));
+  }
+
+  @Test
+  public void parameterMap_merge() throws IOException {
+    Map<String, String[]> inherited = new HashMap<>();
+    String[] v1 = new String[] {"v1-1", "v1-2"};
+    inherited.put("p1", v1);
+
+    Buffer buffer = Buffer.buffer("p1=v1-3;p2=v2");
+    BufferInputStream inputStream = new BufferInputStream(buffer.getByteBuf());
+    new Expectations() {
+      {
+        request.getParameterMap();
+        result = inherited;
+        request.getMethod();
+        result = HttpMethod.PUT;
+        request.getContentType();
+        result = MediaType.APPLICATION_FORM_URLENCODED.toUpperCase(Locale.US) + ";abc";
+        request.getInputStream();
+        result = inputStream;
+      }
+    };
+
+    Assert.assertThat(Collections.list(requestEx.getParameterNames()), Matchers.contains("p1", "p2"));
+    Assert.assertThat(requestEx.getParameterValues("p1"), Matchers.arrayContaining("v1-1", "v1-2", "v1-3"));
+    Assert.assertEquals("v1-1", requestEx.getParameter("p1"));
+  }
 }
diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxClientRequestToHttpServletRequest.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxClientRequestToHttpServletRequest.java
index 71908f15b..271a0c087 100644
--- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxClientRequestToHttpServletRequest.java
+++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxClientRequestToHttpServletRequest.java
@@ -19,6 +19,9 @@
 
 import java.util.Collections;
 
+import javax.ws.rs.core.HttpHeaders;
+
+import org.apache.servicecomb.foundation.common.http.HttpUtils;
 import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Before;
@@ -27,6 +30,7 @@
 import io.vertx.core.MultiMap;
 import io.vertx.core.buffer.Buffer;
 import io.vertx.core.http.HttpClientRequest;
+import io.vertx.core.http.HttpMethod;
 import mockit.Expectations;
 import mockit.Mocked;
 
@@ -143,4 +147,51 @@ public void testAddHeader() {
   public void testGetContextPath() {
     Assert.assertEquals("", request.getContextPath());
   }
+
+  @Test
+  public void getMethod() {
+    new Expectations() {
+      {
+        clientRequest.method();
+        result = HttpMethod.GET;
+      }
+    };
+
+    Assert.assertEquals("GET", request.getMethod());
+  }
+
+  @Test
+  public void getContentType() {
+    MultiMap headers = MultiMap.caseInsensitiveMultiMap();
+    new Expectations() {
+      {
+        clientRequest.headers();
+        result = headers;
+      }
+    };
+
+    request.addHeader(HttpHeaders.CONTENT_TYPE, "ct");
+
+    Assert.assertEquals("ct", request.getContentType());
+  }
+
+  @Test
+  public void getCharacterEncoding() {
+    String contentType = "ct";
+    String characterEncoding = "ce";
+
+    MultiMap headers = MultiMap.caseInsensitiveMultiMap();
+    new Expectations(HttpUtils.class) {
+      {
+        HttpUtils.getCharsetFromContentType(contentType);
+        result = characterEncoding;
+        clientRequest.headers();
+        result = headers;
+      }
+    };
+
+    request.addHeader(HttpHeaders.CONTENT_TYPE, contentType);
+
+    Assert.assertEquals("ce", request.getCharacterEncoding());
+  }
 }
diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerRequestToHttpServletRequest.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerRequestToHttpServletRequest.java
index 2e2f0f88b..df7221551 100644
--- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerRequestToHttpServletRequest.java
+++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerRequestToHttpServletRequest.java
@@ -29,6 +29,7 @@
 import javax.ws.rs.core.HttpHeaders;
 import javax.xml.ws.Holder;
 
+import org.apache.servicecomb.foundation.common.http.HttpUtils;
 import org.hamcrest.Matchers;
 import org.junit.Assert;
 import org.junit.Before;
@@ -182,6 +183,7 @@ public void testGetParameterMap() {
     Map<String, String[]> result = request.getParameterMap();
     Assert.assertThat(result.keySet(), Matchers.contains("name"));
     Assert.assertThat(result.get("name"), Matchers.arrayContaining("value"));
+    Assert.assertSame(result, request.getParameterMap());
   }
 
   @Test
@@ -436,4 +438,18 @@ public void testGetAsyncContext() {
 
     Assert.assertSame(asyncContext, request.getAsyncContext());
   }
+
+  @Test
+  public void getCharacterEncoding() {
+    new Expectations(HttpUtils.class) {
+      {
+        vertxRequest.getHeader(HttpHeaders.CONTENT_TYPE);
+        result = "ct";
+        HttpUtils.getCharsetFromContentType("ct");
+        result = "ce";
+      }
+    };
+
+    Assert.assertEquals("ce", request.getCharacterEncoding());
+  }
 }
diff --git a/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/InvocationToHttpServletRequest.java b/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/InvocationToHttpServletRequest.java
index c3585bb45..eb126d4c8 100644
--- a/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/InvocationToHttpServletRequest.java
+++ b/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/InvocationToHttpServletRequest.java
@@ -30,6 +30,9 @@
 
 import io.vertx.core.net.SocketAddress;
 
+/**
+ * when transport is not over http, mock a HttpServletRequest from Invocation
+ */
 public class InvocationToHttpServletRequest extends AbstractHttpServletRequest {
   private RestOperationMeta swaggerOperation;
 
@@ -126,4 +129,22 @@ public int getRemotePort() {
   public String getContextPath() {
     return "";
   }
+
+  /**
+   * it's a mock httpServletRequest, contentType is unknown
+   * @return contentType
+   */
+  @Override
+  public String getContentType() {
+    return null;
+  }
+
+  /**
+   * it's a mock httpServletRequest, characterEncoding is unknown
+   * @return characterEncoding
+   */
+  @Override
+  public String getCharacterEncoding() {
+    return null;
+  }
 }
diff --git a/providers/provider-rest-common/src/test/java/org/apache/servicecomb/provider/rest/common/TestInvocationToHttpServletRequest.java b/providers/provider-rest-common/src/test/java/org/apache/servicecomb/provider/rest/common/TestInvocationToHttpServletRequest.java
index b29f329cd..79c1c9030 100644
--- a/providers/provider-rest-common/src/test/java/org/apache/servicecomb/provider/rest/common/TestInvocationToHttpServletRequest.java
+++ b/providers/provider-rest-common/src/test/java/org/apache/servicecomb/provider/rest/common/TestInvocationToHttpServletRequest.java
@@ -322,4 +322,14 @@ public void testGetContextPath(@Mocked Invocation invocation) throws Exception {
     InvocationToHttpServletRequest request = new InvocationToHttpServletRequest(invocation);
     Assert.assertEquals("", request.getContextPath());
   }
+
+  @Test
+  public void getContentType() {
+    Assert.assertNull(request.getContentType());
+  }
+
+  @Test
+  public void getCharacterEncoding() {
+    Assert.assertNull(request.getCharacterEncoding());
+  }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services