protected String getSourcesMappingEpilogue ( ) { String root = "" ; //$NON-NLS-1$ String contextPath = request . getRequestURI ( ) ; if ( contextPath != null ) { // We may be re-building a layer for a source map request where the layer // has been flushed from the cache. If that's the case, then the context // path will already include the source map path component, so just remove it. if ( contextPath . endsWith ( ILayer . SOURCEMAP_RESOURCE_PATH ) ) { contextPath = contextPath . substring ( 0 , contextPath . length ( ) - ( ILayer . SOURCEMAP_RESOURCE_PATHCOMP . length ( ) + 1 ) ) ; } // Because we're specifying a relative URL that is relative to the request for the // layer and aggregator paths are assumed to NOT include a trailing '/', then we // need to start the relative path with the last path component of the context // path so that the relative URL will be resolved correctly by the browser. For // more details, see refer to the behavior of URI.resolve(); int idx = contextPath . lastIndexOf ( "/" ) ; //$NON-NLS-1$ root = contextPath . substring ( idx != - 1 ? idx + 1 : 0 ) ; if ( root . length ( ) > 0 && ! root . endsWith ( "/" ) ) { //$NON-NLS-1$ root += "/" ; //$NON-NLS-1$ } } StringBuffer sb = new StringBuffer ( ) ; sb . append ( "//# sourceMappingURL=" ) //$NON-NLS-1$ . append ( root ) . append ( ILayer . SOURCEMAP_RESOURCE_PATHCOMP ) ; String queryString = request . getQueryString ( ) ; if ( queryString != null ) { sb . append ( "?" ) . append ( queryString ) ; //$NON-NLS-1$ } return sb . toString ( ) ; }
Returns the source mapping epilogue for the layer that gets added to the end of the response .