Commits

Sebastian Sdorra  committed 810d87a

added server port configuration for mod_jk and mod_proxy

  • Participants
  • Parent commits a1bf451

Comments (0)

Files changed (3)

File scm-core/src/main/java/sonia/scm/config/ScmConfiguration.java

    *
    * @return
    */
+  public int getPort()
+  {
+    return port;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
   public String getServername()
   {
     return servername;
    * Method description
    *
    *
+   * @param port
+   */
+  public void setPort(int port)
+  {
+    this.port = port;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @param servername
    */
   public void setServername(String servername)
   private String pluginUrl = DEFAULT_PLUGINURL;
 
   /** Field description */
+  private int port = -1;
+
+  /** Field description */
   private String servername = "localhost";
 
   /** Field description */

File scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java

       StringBuilder url = new StringBuilder(request.getScheme());
 
       url.append("://").append(configuration.getServername());
-      url.append(":").append(request.getLocalPort());
+      url.append(":").append(getPort(request));
 
       String ctxPath = request.getContextPath();
 
    * Method description
    *
    *
+   * @param request
+   *
+   * @return
+   */
+  private int getPort(HttpServletRequest request)
+  {
+    int port = 0;
+
+    if (configuration.isEnableSSL())
+    {
+      port = configuration.getSslPort();
+    }
+    else
+    {
+      port = configuration.getPort();
+    }
+
+    if (port <= 0)
+    {
+      port = request.getLocalPort();
+    }
+
+    return port;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @param repository
    *
    * @return

File scm-webapp/src/main/webapp/resources/js/sonia.config.js

           allowBlank: false
         },{
           xtype: 'textfield',
+          fieldLabel: 'Serverport',
+          name: 'port',
+          allowBlank: false
+        },{
+          xtype: 'textfield',
           fieldLabel: 'Plugin repository',
           name: 'plugin-url',
           vtype: 'url',