@@ -382,19 +382,19 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse
382382 * @throws Exception if the test fails
383383 */
384384 @ Test
385- public void wildcardContentType () throws Exception {
385+ public void wildcardContentTypeHtml () throws Exception {
386386 final Map <String , Class <? extends Servlet >> servlets = new HashMap <>();
387- servlets .put ("/test" , WildcardContentTypeServlet .class );
387+ servlets .put ("/test" , WildcardContentTypeHtmlServlet .class );
388388 startWebServer ("./" , servlets );
389389
390390 final WebClient client = getWebClient ();
391391 assertTrue (client .getPage (URL_FIRST + "test" ) instanceof HtmlPage );
392392 }
393393
394394 /**
395- * Servlet for {@link #wildcardContentType ()}.
395+ * Servlet for {@link #wildcardContentTypeHtml ()}.
396396 */
397- public static class WildcardContentTypeServlet extends HttpServlet {
397+ public static class WildcardContentTypeHtmlServlet extends HttpServlet {
398398 /** {@inheritDoc} */
399399 @ Override
400400 protected void doGet (final HttpServletRequest request , final HttpServletResponse response ) throws IOException {
@@ -404,6 +404,58 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse
404404 }
405405 }
406406
407+ /**
408+ * @throws Exception if the test fails
409+ */
410+ @ Test
411+ public void wildcardContentTypeXml () throws Exception {
412+ final Map <String , Class <? extends Servlet >> servlets = new HashMap <>();
413+ servlets .put ("/test" , WildcardContentTypeXmlServlet .class );
414+ startWebServer ("./" , servlets );
415+
416+ final WebClient client = getWebClient ();
417+ assertTrue (client .getPage (URL_FIRST + "test" ) instanceof XmlPage );
418+ }
419+
420+ /**
421+ * Servlet for {@link #wildcardContentTypeXml()}.
422+ */
423+ public static class WildcardContentTypeXmlServlet extends HttpServlet {
424+ /** {@inheritDoc} */
425+ @ Override
426+ protected void doGet (final HttpServletRequest request , final HttpServletResponse response ) throws IOException {
427+ response .setContentType ("*/*" );
428+ final Writer writer = response .getWriter ();
429+ writer .write ("<?xml version=\" 1.0\" encoding=\" utf-8\" ?><root>Hello World</root>" );
430+ }
431+ }
432+
433+ /**
434+ * @throws Exception if the test fails
435+ */
436+ @ Test
437+ public void wildcardContentTypeBom () throws Exception {
438+ final Map <String , Class <? extends Servlet >> servlets = new HashMap <>();
439+ servlets .put ("/test" , WildcardContentTypeBomServlet .class );
440+ startWebServer ("./" , servlets );
441+
442+ final WebClient client = getWebClient ();
443+ assertTrue (client .getPage (URL_FIRST + "test" ) instanceof TextPage );
444+ }
445+
446+ /**
447+ * Servlet for {@link #wildcardContentTypeBom()}.
448+ */
449+ public static class WildcardContentTypeBomServlet extends HttpServlet {
450+ /** {@inheritDoc} */
451+ @ Override
452+ protected void doGet (final HttpServletRequest request , final HttpServletResponse response ) throws IOException {
453+ response .setContentType ("*/*" );
454+ final Writer writer = response .getWriter ();
455+ writer .write ("\u00ef \u00bb \u00bf <html><head></head><body></body></html>" );
456+ }
457+ }
458+
407459 /**
408460 * @throws Exception if the test fails
409461 */
0 commit comments