Skip to content

Commit

Permalink
deegree#1102 (#8654) - add header with version if config option is set
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoltz authored and latlon-team committed Jan 12, 2023
1 parent 20be84d commit 830e5a3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public class OGCFrontController extends HttpServlet {

private transient String version;

private boolean isReportDeegreeVersion = false;

/**
* Returns the only instance of this class.
*
Expand Down Expand Up @@ -295,11 +297,13 @@ public static Collection<ModuleInfo> getModulesInfo() {
return getInstance().modulesInfo;
}

private static void addHeaders( HttpServletResponse response ) {
private void addHeaders( HttpServletResponse response ) {
// add cache control headers
response.addHeader( "Cache-Control", "no-cache, no-store" );
// add deegree header
response.addHeader( "deegree-version", getInstance().version );
if ( isReportDeegreeVersion ) {
response.addHeader( "deegree-version", getInstance().version );
}
}

/**
Expand Down Expand Up @@ -1110,6 +1114,9 @@ private void initWorkspace()
serviceConfiguration = workspace.getNewWorkspace().getResourceManager( OwsManager.class );
OwsGlobalConfigLoader loader = workspace.getNewWorkspace().getInitializable( OwsGlobalConfigLoader.class );
mainConfig = loader.getMainConfig();
if ( mainConfig != null && mainConfig.isReportDeegreeVersion() != null ) {
this.isReportDeegreeVersion = mainConfig.isReportDeegreeVersion();
}
if ( mainConfig != null ) {
initHardcodedUrls( mainConfig );
}
Expand Down

0 comments on commit 830e5a3

Please sign in to comment.