%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> <%@ page import="at.gv.egiz.pdfas.web.helper.LocalRequestHelper" %> <%@ page import="java.net.URL" %> <%@ page import="java.net.URLConnection" %> <%@ page import="java.io.InputStream" %> <%@ page import="java.io.InputStreamReader" %> <%@ page import="java.io.BufferedReader" %> <%@ page import="net.htmlparser.jericho.Source" %> <%@ page import="net.htmlparser.jericho.Element" %> <%@ page import="net.htmlparser.jericho.Attributes" %> <%@ page import="net.htmlparser.jericho.Attribute" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Locale" %> <%@ page import="at.gv.egiz.pdfas.web.i18n.LocaleParamFilter" %> <%@ page import="java.nio.charset.Charset" %> <%@ page import="at.gv.egiz.pdfas.web.session.SessionAttributes" %> <%@page import="java.nio.charset.Charset"%>
<% String headerUrl="http://www.buergerkarte.at/header.php?lang="; //String headerUrl="http://www.buergerkarte.at/header.php"; String serverUrl=LocalRequestHelper.getLocalServerAddress(request,response); String requestLang = (String)request.getParameter("lang"); String language = ""; URL urlHeader = new URL(headerUrl); if (requestLang!=null) { if (requestLang.equals("de")) { urlHeader = new URL(headerUrl+"de"); language="de"; } else { urlHeader = new URL(headerUrl+"en"); language="en"; } } else { urlHeader = new URL(headerUrl+"de"); language="de"; } URLConnection ucHeader = urlHeader.openConnection(); InputStream isHeader = ucHeader.getInputStream(); //Read the header php files from the server BufferedReader brHeader = new BufferedReader(new InputStreamReader(isHeader, Charset.forName("UTF-8"))); String phpLine=""; String phpHeader=""; while ((phpLine=brHeader.readLine())!=null) { phpHeader += phpLine; } phpHeader = phpHeader.substring(phpHeader.indexOf(""), phpHeader.length()); Source source = new Source(phpHeader); List list = source.getAllElements(); Iterator it = list.iterator(); while (it.hasNext()) { Element element = (Element)it.next(); //Set the absolute path for each element with src or href String attributeValueSrc = element.getAttributeValue("src"); String attributeValueHref = element.getAttributeValue("href"); if ((attributeValueSrc!=null) || (attributeValueHref!=null)) { String attribute = ""; if ((attributeValueSrc!=null) && (attributeValueHref!=null)) { phpHeader = phpHeader.replace(attributeValueSrc, serverUrl+attributeValueSrc); phpHeader = phpHeader.replace(attributeValueHref, serverUrl+attributeValueHref); } else { if (attributeValueSrc!=null) { phpHeader = phpHeader.replace(attributeValueSrc, serverUrl+attributeValueSrc); } if (attributeValueHref!=null) { phpHeader = phpHeader.replace(attributeValueHref, serverUrl+attributeValueHref); } } } } //Insert a hidden language fake link, that is shown when the change of language is disabled int positionToInsertLangLink = 0; source = new Source(phpHeader); list = source.getAllElements("ul"); it = list.iterator(); while (it.hasNext()) { Element element = (Element)it.next(); positionToInsertLangLink = element.getEnd(); } String languagelink; if (!language.equals("de")) { languagelink = ""; languagelink += "