Remove MagicHttpResource (#1390)

For ESH it made sense to use this but nowadays these UIs are no longer part of openhab-core and the demo app used for development is in openhab-distro.
Furthermore it provides links to UIs that are no longer part of OH3, uses ESH logos and the new Default UI is also using / so it throws exceptions.

See: https://github.com/openhab/openhab-distro/pull/1084#issuecomment-596226652

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2020-03-14 23:19:42 +01:00 committed by GitHub
parent 427e969ef9
commit 2681b5d90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 0 additions and 282 deletions

View File

@ -1,95 +0,0 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.magic.binding.internal.http;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
/**
* Registers itself under "/" and provides links to other web UIs
*
* @author Stefan Triller - Initial contribution
*/
@Component(immediate = true)
public class MagicHttpResource {
/** the root path of this web application */
private static final String WEBAPP_ALIAS = "/";
private static final String WEBAPP_NAME = "/";
protected HttpService httpService;
@Activate
protected void activate(Map<String, Object> configProps, BundleContext bundleContext) throws NamespaceException {
httpService.registerResources(WEBAPP_ALIAS, WEBAPP_NAME, new MagicHttpContext(bundleContext.getBundle()));
}
@Deactivate
protected void deactivate() {
httpService.unregister(WEBAPP_ALIAS);
}
@Reference
public void setHttpService(HttpService httpService) {
this.httpService = httpService;
}
public void unsetHttpService(HttpService httpService) {
this.httpService = null;
}
private class MagicHttpContext implements HttpContext {
private final Bundle bundle;
private MagicHttpContext(Bundle bundle) {
this.bundle = bundle;
}
@Override
public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
return true;
}
@Override
/**
* Return the main page with links if empty
*/
public URL getResource(String pName) {
String name = "";
if ("".equals(pName)) {
name = "web/index.html";
} else {
name = "web/" + pName;
}
return bundle.getResource(name);
}
@Override
public String getMimeType(String name) {
return null;
}
}
}

View File

@ -1,82 +0,0 @@
body {
padding-top: 60px;
}
.navbar-default .navbar-nav>li>a, .navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
color: white;
}
.navbar {
background-color: #01324D;
border: 0;
}
.center {
text-align: center;
}
#logo {
height: 60px;
}
/* Landing Page Targets */
body.landing section {
overflow-x: hidden;
}
body.landing section#references {
background-color: #8098a6;
color: white;
}
body.landing section#references h1 {
color: white;
}
body.landing section#references .reference {
margin-bottom: 20px;
position: relative;
}
body.landing section#references .logo {
background-color: white;
overflow: hidden;
position: relative;
}
body.landing section#references .logo:before {
content: "";
display: block;
padding-top: 75%;
}
body.landing section#references .logo img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
body.landing section#references .text {
background: white;
padding: 0px 10px 20px 10px;
height: 120px;
}
body.landing section#references .text h3 {
margin: 0px;
font-weight: 300;
color: #222;
text-transform: none;
font-size: 20px !important;
line-height: 60px !important;
}
body.landing section#references .text p {
margin: 0px;
color: #222;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,105 +0,0 @@
<html>
<head>
<title>openHAB</title>
<!-- CSS -->
<link href="http://localhost:8080/paperui/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen,projection" />
<link href="./css/styles.css" rel="stylesheet" />
<script src="http://localhost:8080/paperui/js/jquery.min.js"></script>
<script src="http://localhost:8080/paperui/js/bootstrap.min.js"></script>
</head>
<body class="landing">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="./index.html">
<img id="logo" src="img/eclipse_logo.png" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://openhab.org/getting-started.html">Getting Started</a>
</li>
<li>
<a href="https://openhab.org/documentation/index.html">Documentation</a>
</li>
<li>
<a href="https://openhab.org/blog">Blog</a>
</li>
<li>
<a href="https://github.com/eclipse/smarthome">GitHub</a>
</li>
</ul>
</div>
</div>
</nav>
<section id="references" class="z-depth-1">
<div class="container">
<h2>Welcome to openHAB</h2>
<p>Here are a few useful links to start exploring your local instance:</p>
<div class="row scrollme animateme" data-when="enter" data-from="0.75" data-to="0" data-crop="false" data-opacity="0" data-scale="1.125">
<div class="col-lg-3 col-sm-12 col-md-6">
<a href="paperui/index.html">
<div class="reference z-depth-1">
<div class="logo center valign-wrapper">
<img src="img/paperui.jpg" />
</div>
<div class="text center">
<h3>Paper UI</h3>
<p>Administrative Web Interface</p>
</div>
</div>
</a>
</div>
</a>
<div class="col-lg-3 col-sm-12 col-md-6">
<a href="basicui/app">
<div class="reference z-depth-1">
<div class="logo center valign-wrapper">
<img src="img/basicui.jpg" />
</div>
<div class="text center">
<h3>Basic UI</h3>
<p>New Web Control Interface</p>
</div>
</div>
</a>
</div>
<div class="col-lg-3 col-sm-12 col-md-6">
<a href="classicui/app">
<div class="reference z-depth-1">
<div class="logo center valign-wrapper">
<img src="img/classicui.jpg" />
</div>
<div class="text center">
<h3>Classic UI</h3>
<p>Legacy Web Control Interface</p>
</div>
</div>
</a>
</div>
<div class="col-lg-3 col-sm-12 col-md-6">
<a href="rest">
<div class="reference z-depth-1">
<div class="logo center valign-wrapper">
<img src="img/rest.jpg" />
</div>
<div class="text center">
<h3>REST Interface</h3>
<p>REST access to ressources</p>
</div>
</div>
</a>
</div>
</div>
</div>
</section>
</body>
</html>