Line data Source code
1 : // Copyright (C) 2015 The Android Open Source Project 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 com.google.gerrit.httpd.raw; 16 : 17 : import com.google.common.cache.Cache; 18 : import com.google.gerrit.server.experiments.ExperimentFeatures; 19 : import com.google.gerrit.server.util.time.TimeUtil; 20 : import java.nio.file.FileSystem; 21 : import java.nio.file.Path; 22 : import java.nio.file.attribute.FileTime; 23 : 24 : class WarDocServlet extends DocServlet { 25 : private static final long serialVersionUID = 1L; 26 : 27 0 : private static final FileTime NOW = FileTime.fromMillis(TimeUtil.nowMs()); 28 : 29 : private final FileSystem warFs; 30 : 31 : WarDocServlet( 32 : Cache<Path, Resource> cache, FileSystem warFs, ExperimentFeatures experimentFeatures) { 33 0 : super(cache, false, experimentFeatures); 34 0 : this.warFs = warFs; 35 0 : } 36 : 37 : @Override 38 : protected Path getResourcePath(String pathInfo) { 39 0 : return warFs.getPath("/Documentation/" + pathInfo); 40 : } 41 : 42 : @Override 43 : protected FileTime getLastModifiedTime(Path p) { 44 : // Return initialization time of this class, since the WAR outputs from the build process all 45 : // have mtimes of 1980/1/1. 46 0 : return NOW; 47 : } 48 : }