Commit 3237fbdf authored by Noel Alonso's avatar Noel Alonso
Browse files

Elimina restos de sitemap

La funcionalidad se sacará de api y el fichero se servirá desde web
parent 39460a9e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ services:
      mode: replicated
      replicas: ${REPLICAS:-1}
      labels:
        traefik.sitemap.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/sitemap;AddPrefix:/${MICROSERVICE_NAME}
        traefik.microservice.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/${MICROSERVICE_NAME}
        traefik.mediastorage.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/${MICROSERVICE_NAME}/mediastorage/photobank/{animals|species|platforms|organisations}
        traefik.mediastorage.frontend.redirect.regex: ^.*/${MICROSERVICE_NAME}/mediastorage/(photobank)/(animals|species|platforms|organisations)/(.+\\.(?:gif|jpe?g|png))$$
+0 −8
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@
		<redmic.utils.version>0.10.0-feature-changeJtsVersion</redmic.utils.version>
		<redmic.models.version>0.13.0-feature-addInternalUrl</redmic.models.version>
		<redmic.mediastorage.version>0.7.0</redmic.mediastorage.version>
		<redmic.sitemapgen4j.version>0.6.0</redmic.sitemapgen4j.version>

		<redmic.test-utils.version>0.11.0</redmic.test-utils.version>

@@ -84,13 +83,6 @@
			<version>${redmic.mediastorage.version}</version>
		</dependency>

		<!-- Generate sitemap -->
		<dependency>
			<groupId>es.redmic.lib</groupId>
			<artifactId>sitemapgen4j</artifactId>
			<version>${redmic.sitemapgen4j.version}</version>
		</dependency>

		<!-- SpringBoot -->

		<dependency>
+0 −2
Original line number Diff line number Diff line
@@ -86,8 +86,6 @@ public class Oauth2SecurityConfiguration {

			http.authorizeRequests().antMatchers(HttpMethod.POST, "/**/utils/geo/convert2geojson").permitAll();

			http.authorizeRequests().antMatchers(HttpMethod.GET, "/sitemap.xml").permitAll();

			http.authorizeRequests().antMatchers(HttpMethod.GET, "/**/activitycategories").access(
					"#oauth2.hasScope('write') and "
					+ "hasAnyRole('ROLE_ADMINISTRATOR', 'ROLE_OAG', 'ROLE_COLLABORATOR')");
+0 −66
Original line number Diff line number Diff line
package es.redmic.api.utils.sitemap.controller;

/*-
 * #%L
 * API
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * 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.
 * #L%
 */

import java.io.File;
import java.io.FileInputStream;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import es.redmic.exception.mediastorage.MSFileNotFoundException;
import es.redmic.mediastorage.service.MediaStorageServiceItfc;

@Controller
public class GenerateSitemapController {

	@Autowired
	MediaStorageServiceItfc mediaStorageService;

	@Value("${property.SITEMAP_DESTINATION_DIR}")
	private String PATH;

	public GenerateSitemapController() {
		// TODO: eliminar servir sitemap desde la api
	}

	@GetMapping(value = "/sitemap.xml", produces = { "text/xml", "application/xml" })
	public void download(HttpServletResponse response) {

		String name = "sitemap.xml";

		File file = mediaStorageService.openTempFile(PATH, name);

		response.reset();
		response.setContentType("application/xml");
		response.setHeader("Content-Disposition", "inline;filename=\"" + name + "\"");

		try {

			IOUtils.copy(new FileInputStream(file), response.getOutputStream());
		} catch (Exception e) {
			throw new MSFileNotFoundException(file.getName(), PATH, e);
		}
	}
}
+0 −4
Original line number Diff line number Diff line
@@ -24,10 +24,6 @@ logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
#oauth
oauth.server=http://localhost:8081

#Sitemap properties
property.USER_API=http://localhost:8082
property.SITEMAP_BASE_URL=https://redmic.dev

#Mediastorage
#S3
property.path.media_storage.PRIVATE_BASE_PATH=/private
Loading