logout-Link

This commit is contained in:
Peter Hormanns 2011-05-17 14:56:34 +00:00
parent 84bc95ddd4
commit 3c1480dfaf
4 changed files with 75 additions and 9 deletions

View File

@ -0,0 +1,8 @@
<div style="width:100%; background-image:url(../../hs/icons/bg.png);">
<div style="margin: 0px; vertical-align:top; float:left; ">
<img src="../../hs/icons/logo.png" alt="Hostsharing Logo" / >
</div>
<div style="margin: 0px; height:70px; vertical-align:top; text-align:right; ">
<a href="/hsarweb/logout" style="margin-right:20px; text-decoration:none; font-family:Arial,Helvetica,sans-serif; color:white; " >logout</a>
</div>
</div>

View File

@ -7,7 +7,7 @@
<context-param>
<param-name>serverName</param-name>
<param-value>http://agnes.ostwall195.de:8080</param-value>
<param-value>https://@ADMIN_HOST@:@ADMIN_PORT@</param-value>
</context-param>
<context-param>
<param-name>backendURL</param-name>
@ -67,6 +67,15 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Logout Servlet</servlet-name>
<servlet-class>de.hsadmin.logout.LogoutServlet</servlet-class>
<init-param>
<param-name>redirect</param-name>
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/logout</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>HSAdmin Web</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
@ -76,10 +85,17 @@
<param-value>de.hsadmin.web.MainApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Logout Servlet</servlet-name>
<url-pattern>/logout</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HSAdmin Web</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>

View File

@ -0,0 +1,32 @@
package de.hsadmin.logout;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class LogoutServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private String redirectURL;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
HttpSession session = req.getSession();
session.invalidate();
resp.sendRedirect(redirectURL);
}
@Override
public void init(ServletConfig config) throws ServletException {
redirectURL = config.getInitParameter("redirect");
}
}

View File

@ -18,16 +18,20 @@ import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.terminal.gwt.server.HttpServletRequestListener;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Link;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.Window.Notification;
import com.vaadin.ui.themes.BaseTheme;
import de.hsadmin.web.config.LocaleConfig;
import de.hsadmin.web.config.ModuleConfig;
@ -44,6 +48,8 @@ public class MainApplication extends Application implements HttpServletRequestLi
private Map<String, Module> modules;
private Locale requestLocale;
private CustomLayout header;
@Override
public void init() {
@ -68,14 +74,18 @@ public class MainApplication extends Application implements HttpServletRequestLi
Window mainWindow = new Window(localeConfig.getText("applicationtitle"));
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeFull();
HorizontalLayout banner = new HorizontalLayout();
Embedded image = new Embedded(null, new ThemeResource("../hs/icons/logo.png"));
image.setMimeType("image/png");
Embedded bgImage = new Embedded(null, new ThemeResource("../hs/icons/bg.png"));
bgImage.setMimeType("image/png");
banner.addComponent(image);
banner.addComponent(bgImage);
banner.setExpandRatio(bgImage, 1.0f);
// HorizontalLayout banner = new HorizontalLayout();
// Embedded image = new Embedded(null, new ThemeResource("../hs/icons/logo.png"));
// image.setMimeType("image/png");
// Embedded bgImage = new Embedded(null, new ThemeResource("../hs/icons/bg.png"));
// bgImage.setMimeType("image/png");
// Link logout = new Link("logout", new ExternalResource(localeConfig.getText("logout.link")));
// banner.addComponent(image);
// banner.addComponent(bgImage);
// banner.addComponent(logout);
// banner.setExpandRatio(bgImage, 1.0f);
// verticalLayout.addComponent(banner);
CustomLayout banner = new CustomLayout("../../hs/layout/header");
verticalLayout.addComponent(banner);
TabSheet tabs = new TabSheet();
tabs.setSizeFull();