2017-05-19 1 views
0

我々は、Apache CXFは、私が試したは、我々は、Apache CXFは、HTMLページ

HTMLページを生成上書きすることができますを生成上書きでき

<init-param>   
     <param-name>hide-service-list-page</param-name> 
     <param-value>true</param-value>   
    </init-param> 

が、それは我々が異なって表示することができますどのように代わりにこれを示すの「いいえサービスが見つかりませんでした」と表示htmlページ。 ありがとう

+0

を1よりも優先されます、あなたはさらに説明できますか?あなたはいつサービス記述HTMLページを保存するのですか? –

+0

例のURLはhttp:// localhost:8080/UserDetailsで、「利用可能なSOAPサービス:」と「利用可能なRESTfulサービス:」の一覧が表示されますので、これらのリストの代わりに他のメッセージを表示します。 –

答えて

1

Apache cxfはFormattedServiceListWriterというクラスを使用して、あなたが話しているhtmlページを生成します。コードhereを見ることができます。

このページをパーソナライズするには、同じパッケージに同名のクラスを作成する(プロジェクト内にそのパッケージを作成する必要があります)writeServiceListメソッドを変更してください独自の実装、そのクラスはCXFジャーに

新しいFormattedServiceListWriterクラス

package org.apache.cxf.transport.servlet.servicelist; 

    /*--imports--*/ 

    public class FormattedServiceListWriter implements ServiceListWriter { 

     /*... this remains the same as in the original class*/ 

     public void writeServiceList(PrintWriter writer, 
            String basePath, 
            AbstractDestination[] soapDestinations, 
            AbstractDestination[] restDestinations) throws IOException { 

      /*this is the method you should change*/ 

      writer.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" " 
         + "\"http://www.w3.org/TR/html4/loose.dtd\">"); 
      writer.write("<HTML><HEAD>"); 
      writer.write("<LINK type=\"text/css\" rel=\"stylesheet\" href=\"" + styleSheetPath + "\">"); 
      writer.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">"); 
      if (title != null) { 
       writer.write("<title>" + title + "</title>"); 
      } else { 
       writer.write("<title>CXF - Service list</title>"); 
      } 
      writer.write("</head><body>"); 


      writer.write("<span class=\"heading\">WHATEVER YOU WANT TO PUT HERE</span>"); 

      writer.write("</body></html>"); 
     } 

     /*... this remains the same as in the original class*/ 

    }