Commit d29224e4 authored by Maxym Borodenko's avatar Maxym Borodenko

Frontend URL

come back baseUrl of old filter info
parent 30284150
......@@ -34,7 +34,6 @@ import org.genesys2.server.service.UserService;
import org.genesys2.server.servlet.model.UserList;
import org.genesys2.spring.ResourceNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -56,9 +55,6 @@ public class UsersController extends ApiBaseController {
// Rest controller base URL
protected static final String CONTROLLER_URL = ApiBaseController.APIv0_BASE + "/users";
@Value("${base.url}")
private String baseUrl;
@Autowired
protected UserService userService;
......
......@@ -115,8 +115,8 @@ public class AccessionController {
private final ObjectMapper mapper = new ObjectMapper();
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
@Value("${cdn.servers}")
private String[] cdnServers;
......@@ -433,7 +433,7 @@ public class AccessionController {
writer.append("<description><![CDATA[\n");
writer.append("<p>").append(accession.getTaxonomy().getTaxonNameHtml()).append("</p>");
writer.append("<p>").append(accession.getInstitute().getCode()).append(" ").append(accession.getInstitute().getFullName()).append("</p>");
writer.append("<p><a href=\"").append(baseUrl).append("/acn/").append(accession.getUuid().toString()).append("\">Passport data</a></p>");
writer.append("<p><a href=\"").append(frontendUrl).append("/a/").append(accession.getUuid().toString()).append("\">Passport data</a></p>");
writer.append("\n]]></description>");
writer.append("<Point><coordinates>");
......
......@@ -44,8 +44,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class SitemapXMLController {
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
@Autowired
private GeoService geoService;
......@@ -95,7 +95,7 @@ public class SitemapXMLController {
sb.append("<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">");
for (final SitemapPage page : sitemaps) {
sb.append(" <sitemap>");
sb.append(" <loc>").append(baseUrl).append(response.encodeURL(page.url)).append("</loc>");
sb.append(" <loc>").append(frontendUrl).append(response.encodeURL(page.url)).append("</loc>");
sb.append(" </sitemap>");
}
sb.append("</sitemapindex>");
......@@ -176,7 +176,7 @@ public class SitemapXMLController {
private void writePage(HttpServletResponse response, final StringBuffer sb, final SitemapPage page) {
sb.append(" <url>");
sb.append(" <loc>").append(baseUrl).append(response.encodeURL(page.url)).append("</loc>");
sb.append(" <loc>").append(frontendUrl).append(response.encodeURL(page.url)).append("</loc>");
if (page.freq != null) {
sb.append(" <changefreq>").append(page.freq).append("</changefreq>");
}
......
......@@ -59,14 +59,14 @@ public abstract class RdfBaseController extends BaseController {
protected static final String GCDT = "Global Crop Diversity Trust";
protected static final String RDF_MODEL_VERSION = "Revision: 0.1";
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
protected String getBaseUri() {
if (baseUrl == null) {
throw new NullPointerException("Base URI not set in RdfBaseController?");
protected String getFrontendUri() {
if (frontendUrl == null) {
throw new NullPointerException("Frontend URI not set in RdfBaseController?");
}
return baseUrl;
return frontendUrl;
}
protected static String modelVersion() {
......@@ -84,7 +84,7 @@ public abstract class RdfBaseController extends BaseController {
model.setNsPrefix("dcterms", DublinCore.getURI());
model.setNsPrefix("dwc", DarwinCore.getURI());
model.setNsPrefix("skos", SKOS.getURI());
model.setNsPrefix("genesys", getBaseUri() + "/");
model.setNsPrefix("genesys", getFrontendUri() + "/");
return model;
}
......@@ -135,7 +135,7 @@ public abstract class RdfBaseController extends BaseController {
// SKOS:Collection
) {
final Resource subject = model.createResource(getBaseUri() + uri);
final Resource subject = model.createResource(getFrontendUri() + uri);
subject.addProperty(DC_11.publisher, GCDT);
if (isCollection) {
......
......@@ -160,6 +160,9 @@ public class DownloadServiceImpl implements DownloadService {
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
@Value("${genesys.catalog.url}")
private String genesysCatalogUrl;
......@@ -199,7 +202,7 @@ public class DownloadServiceImpl implements DownloadService {
POIXMLProperties.CustomProperties custProp = props.getCustomProperties();
custProp.addProperty("Filter", filters);
custProp.addProperty("Genesys URL", baseUrl);
custProp.addProperty("Genesys URL", frontendUrl);
// keep 50 rows in memory, exceeding rows will be flushed to disk
SuperSXSSFWorkbook wb = new SuperSXSSFWorkbook(template, 50);
......@@ -211,7 +214,7 @@ public class DownloadServiceImpl implements DownloadService {
Cell c;
r = legal.createRow(0);
r.createCell(0).setCellValue("Server URL");
r.createCell(1).setCellValue(baseUrl);
r.createCell(1).setCellValue(frontendUrl);
r = legal.createRow(1);
r.createCell(0).setCellValue("Filters");
r.createCell(1).setCellValue(filters);
......@@ -227,7 +230,7 @@ public class DownloadServiceImpl implements DownloadService {
c.setCellValue(new Date());
r = legal.createRow(4);
r.createCell(0).setCellValue("Attribution");
r.createCell(1).setCellValue(baseUrl + "/content/terms");
r.createCell(1).setCellValue(frontendUrl + "/content/terms");
// Register a streaming sheet
final SuperSXSSFSheet sheet = wb.getStreamingSheet("MCPD");
......@@ -680,7 +683,7 @@ public class DownloadServiceImpl implements DownloadService {
Cell c;
r = legal.createRow(0);
r.createCell(0).setCellValue("Server URL");
updateCellUrl(r, 1, baseUrl);
updateCellUrl(r, 1, frontendUrl);
r = legal.createRow(1);
r.createCell(0).setCellValue("Filters");
r.createCell(1).setCellValue(filter.toString());
......@@ -695,7 +698,7 @@ public class DownloadServiceImpl implements DownloadService {
c.setCellValue(new Date());
r = legal.createRow(4);
r.createCell(0).setCellValue("Attribution");
updateCellUrl(r, 1, baseUrl + "/content/terms");
updateCellUrl(r, 1, frontendUrl + "/content/terms");
final SuperSXSSFSheet pdciSheet = wb.getStreamingSheet("PDCI");
pdciSheet.setRowGenerator((sheet) -> {
......
......@@ -61,8 +61,8 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
@Autowired
private ContentService contentService;
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
@Value("${mail.user.from}")
private String defaultEmailFrom;
......@@ -76,7 +76,7 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
if (article != null) {
final String mailSubject = article.getTitle();
final String mailBody = MessageFormat.format(article.getBody(), baseUrl, verificationToken.getUuid(), user.getEmail(), verificationToken.getKey());
final String mailBody = MessageFormat.format(article.getBody(), frontendUrl, verificationToken.getUuid(), user.getEmail(), verificationToken.getKey());
emailService.sendMail(mailSubject, mailBody, user.getEmail());
} else {
......@@ -93,7 +93,7 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
final Article article = contentService.getGlobalArticle(ContentService.SMTP_EMAIL_PASSWORD, Locale.ENGLISH);
final String mailSubject = article.getTitle();
final String mailBody = MessageFormat.format(article.getBody(), baseUrl, verificationToken.getUuid(), user.getEmail(), verificationToken.getKey());
final String mailBody = MessageFormat.format(article.getBody(), frontendUrl, verificationToken.getUuid(), user.getEmail(), verificationToken.getKey());
emailService.sendMail(mailSubject, mailBody, user.getEmail());
}
......@@ -145,7 +145,7 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
final VerificationToken verificationToken = tokenVerificationService.generateToken("delete-account", user.getUuid());
final Article article = contentService.getGlobalArticle(ContentService.SMTP_DELETE_ACCOUNT, Locale.ENGLISH);
final String mailBody = MessageFormat.format(article.getBody(), baseUrl, verificationToken.getUuid(), verificationToken.getKey(), user.getFullName(), user.getEmail());
final String mailBody = MessageFormat.format(article.getBody(), frontendUrl, verificationToken.getUuid(), verificationToken.getKey(), user.getFullName(), user.getEmail());
emailService.sendMail(article.getTitle(), mailBody, user.getEmail());
}
......@@ -162,7 +162,7 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
final Article article = contentService.getGlobalArticle(ContentService.SMTP_DELETE_ACCOUNT_INPROGRESS, Locale.ENGLISH);
final String mailBody = MessageFormat.format(article.getBody(), baseUrl, currentUser.getFullName(), currentUser.getEmail());
final String mailBody = MessageFormat.format(article.getBody(), frontendUrl, currentUser.getFullName(), currentUser.getEmail());
emailService.sendMail(article.getTitle(), mailBody, defaultEmailFrom, currentUser.getEmail());
......
......@@ -90,8 +90,8 @@ public class RequestServiceImpl implements RequestService {
@Autowired
private MaterialSubRequestRepository subRequestRepository;
@Value("${base.url}")
private String baseUrl;
@Value("${frontend.url}")
private String frontendUrl;
@Value("${mail.requests.to}")
private String requestsEmail;
......@@ -173,7 +173,7 @@ public class RequestServiceImpl implements RequestService {
// Create the root hash
final Map<String, Object> root = new HashMap<String, Object>();
root.put("baseUrl", baseUrl);
root.put("baseUrl", frontendUrl);
root.put("verificationToken", verificationToken);
root.put("pid", rb.pid);
root.put("accessions", accessions.getContent());
......@@ -408,7 +408,7 @@ public class RequestServiceImpl implements RequestService {
// Create the root hash
final Map<String, Object> root = new HashMap<String, Object>();
root.put("baseUrl", baseUrl);
root.put("baseUrl", frontendUrl);
root.put("verificationToken", verificationToken);
root.put("pid", rb.pid);
root.put("requestInfo", rb.requestInfo);
......
......@@ -18,6 +18,7 @@
host.name=localhost
host.nameAndPort=${host.name}
base.url=http://${host.name}:8080
frontend.url=${base.url}
cdn.servers=${base.url}
base.cookie-domain=${host.name}
base.cookie-secure=false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment