Coverage Report - org.apache.tapestry5.services.BaseURLSource
 
Classes in this File Line Coverage Branch Coverage Complexity
BaseURLSource
N/A
N/A
1
 
 1  
 // Copyright 2008 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.services;
 16  
 
 17  
 /**
 18  
  * Used when switching between normal/insecure (HTTP) and secure (HTTPS) mode.  When a switch occurs, it is no longer
 19  
  * possible to use relative URLs, instead absolute URLs must be generated. The default implementation of this is
 20  
  * simple-minded: it just tacks the correct scheme in front of {@link org.apache.tapestry5.services.Request#getServerName()}.
 21  
  * In production, behind a firewall, it is often necessary to do a bit more, since <code>getServerName()</code> will
 22  
  * often be the name of the internal server (not visible to the client web browser), and a hard-coded name of a server
 23  
  * that <em>is</em> visible to the web browser is needed.  Further, in testing, non-default ports are often used. In
 24  
  * those cases, an overriding contribution to the {@link org.apache.tapestry5.services.Alias} service will allow a custom
 25  
  * implementation to supercede the default version.
 26  
  */
 27  
 public interface BaseURLSource
 28  
 {
 29  
     /**
 30  
      * Returns the base portion of the URL, before the context path and servlet path are appended. The return value
 31  
      * should <em>not</em> end with a slash; it should end after the host name, or after the port number.  The context
 32  
      * path, servlet path, and path info will be appended to the returned value.
 33  
      *
 34  
      * @param secure whether a secure "https" or insecure "http" base URL should be returned
 35  
      * @return the base URL ready for additional extensions
 36  
      */
 37  
     String getBaseURL(boolean secure);
 38  
 }