jvz commented on a change in pull request #253: Log4 j2 913 - Add support for HTTP/S configuration monitoring. Support Spring Cloud Config URL: https://github.com/apache/logging-log4j2/pull/253#discussion_r251125731
########## File path: log4j-spring-cloud-config/log4j-spring-cloud-config-server/src/main/java/org/apache/logging/log4j/spring/cloud/config/server/controller/Log4jResourceController.java ########## @@ -0,0 +1,200 @@ +/* + * Copyright 2015-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.logging.log4j.spring.cloud.config.server.controller; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.config.environment.Environment; +import org.springframework.cloud.config.server.environment.EnvironmentRepository; +import org.springframework.cloud.config.server.resource.NoSuchResourceException; +import org.springframework.cloud.config.server.resource.ResourceRepository; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.util.StreamUtils; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.ServletWebRequest; +import org.springframework.web.util.UrlPathHelper; + +import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.prepareEnvironment; +import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.resolvePlaceholders; + +/** + * Modified version of Spring Cloud Config's ResourceController to support If-Modified-Since. + * Should be dropeed when Spring implements this. + * + * An HTTP endpoint for serving up templated plain text resources from an underlying + * repository. Can be used to supply config files for consumption by a wide variety of + * applications and services. A {@link ResourceRepository} is used to locate a + * {@link Resource}, specific to an application, and the contents are transformed to text. + * Then an {@link EnvironmentRepository} is used to supply key-value pairs which are used + * to replace placeholders in the resource text. + * + * @author Dave Syer + * @author Daniel Lavoie + * + */ +@RestController +@RequestMapping(method = RequestMethod.GET, path = "${spring.cloud.config.server.prefix:}/resource") +public class Log4jResourceController { + + @Autowired + private ResourceRepository resourceRepository; Review comment: Seems like this file has a mix of tabs and spaces. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services