Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Landing page for the Series REST-API #382

Merged
merged 15 commits into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<!-- <dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>-->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
Expand Down
47 changes: 47 additions & 0 deletions rest/src/main/java/org/n52/web/ctrl/LandingPageController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2013-2017 52°North Initiative for Geospatial Open Source
* Software GmbH
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
* If the program is linked with libraries which are licensed under one of
* the following licenses, the combination of the program with the linked
* library is not considered a "derivative work" of the program:
*
* - Apache License, version 2.0
* - Apache Software License, version 1.0
* - GNU Lesser General Public License, version 3
* - Mozilla Public License, versions 1.0, 1.1 and 2.0
* - Common Development and Distribution License (CDDL), version 1.0
*
* Therefore the distribution of the program linked with libraries licensed
* under the aforementioned licenses, is permitted by the copyright holders
* if the distribution is compliant with both the GNU General Public License
* version 2 and the aforementioned licenses.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package org.n52.web.ctrl;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class LandingPageController {
@RequestMapping
public String redirectToLandingPage() {
return "redirect:/api/";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will break, if implementations choose different servlet contexts thant /api/* (see web.xml). You could configure the context, though, within the application.properties

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}

@RequestMapping("/")
public String showLandingPage() {
return "landing";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
by bean descriptions using the ref-ids associated below.
-->

<bean class="org.n52.web.ctrl.LandingPageController" />

<bean class="org.n52.web.ctrl.ResourcesController">
<property name="metadataService" ref="metadataService" />
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="viewResolvers">
<list>
<!-- <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" /> -->
<!-- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> -->
<!-- <property name="prefix" value="/WEB-INF/jsp/" /> -->
<!-- <property name="suffix" value=".jsp" /> -->
<!-- </bean> -->
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a prefix different from / just to separate API-related content from stuff the actual webapp ships.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to the landing directory

<property name="suffix" value=".html" />
</bean>
</list>
</property>
<property name="defaultViews">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@
<url-pattern>/api/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>landing.html</welcome-file>
</welcome-file-list>

</web-app>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions spi-impl/series/series-dao-webapp/src/main/webapp/landing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Series REST-API</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<div class="jumbotron">
<div class="container">
<h1>Series REST-API</h1>
<p>The 52°North Series API provides a thin access layer to series datasets via RESTful Web binding. It provides different output formats like json, pdf or png.</p>
<p><a class="btn btn-primary btn-lg" href="http://52north.github.io/series-rest-api/" role="button">Learn more &raquo;</a></p>
</div>
</div>

<div class="container">
<div class="row">
<div class="col-md-4">
<h2>JSON</h2>
<p>Query the sensor status and get all the metadata you want with a simple REST interface. It is lightweight and can be utilized in many workflows. For example you can get a list of platforms. </p>
<p><a class="btn btn-default" href="/api/v1/platforms/" role="button">Run example query &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Graphs</h2>
<p>Plot the highly customizable graphs and use it within your apps.</p>
<img style="max-width: 100%; max-height: 100%" src="chart.png">
</div>
<div class="col-md-4">
<h2>And more</h2>
<p>The all sorts of sensor data can be queried with a Sensor REST-API. See the docs for a complete reference.</p>
<p><a class="btn btn-default" href="http://52north.github.io/series-rest-api/" role="button">Explore the docs &raquo;</a></p>
</div>
</div>

<hr>

<footer>
<p>&copy; 2017 52&#176;North.</p>
</footer>
</div>
</body>
</html>