diff options
| author | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-07-14 15:22:56 +0000 | 
|---|---|---|
| committer | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-07-14 15:22:56 +0000 | 
| commit | 5e10b6b575993c78ac22191849c464b618c4fa8a (patch) | |
| tree | 55911c2b6d69e787dd408d63c1e641d6db39c5dc | |
| parent | dc95c76a126b4f3135645d3e20b152134d201244 (diff) | |
| download | mocca-5e10b6b575993c78ac22191849c464b618c4fa8a.tar.gz mocca-5e10b6b575993c78ac22191849c464b618c4fa8a.tar.bz2 mocca-5e10b6b575993c78ac22191849c464b618c4fa8a.zip | |
MOCCA Online HTTP binding refactored.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@762 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
31 files changed, 1082 insertions, 1825 deletions
| diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index 6fa9d45f..ee1deae8 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -183,7 +183,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {        }      } -    applet.sendRedirect(sessionId); +    applet.sendRedirect();    }    /** diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java index 9344181a..b7b72b5d 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -181,7 +181,7 @@ public class BKUApplet extends JApplet {      URL backgroundImgURL = null;      try { -      backgroundImgURL = getURLParameter(BACKGROUND_IMG, null); +      backgroundImgURL = getURLParameter(BACKGROUND_IMG);        log.debug("Setting background: {}.", backgroundImgURL);      } catch (MalformedURLException ex) {        log.warn("Cannot load applet background image. {}", ex.getMessage()); @@ -287,7 +287,7 @@ public class BKUApplet extends JApplet {     * @throws java.net.MalformedURLException     */    public STALPortType getSTALPort() throws MalformedURLException { -    URL wsdlURL = getURLParameter(WSDL_URL, null); +    URL wsdlURL = getURLParameter(WSDL_URL);      log.debug("Setting STAL WSDL: {}.", wsdlURL);      QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE);      STALService stal = new STALService(wsdlURL, endpointName); @@ -311,14 +311,14 @@ public class BKUApplet extends JApplet {     * @return     * @throws java.net.MalformedURLException     */ -  protected void sendRedirect(String sessionId) { +  protected void sendRedirect() {      try {        AppletContext ctx = getAppletContext();        if (ctx == null) {          log.error("No applet context (applet might already have been destroyed).");          return;        } -      URL redirectURL = getURLParameter(REDIRECT_URL, sessionId); +      URL redirectURL = getURLParameter(REDIRECT_URL);        String redirectTarget = getParameter(REDIRECT_TARGET);        if (redirectTarget == null) {          log.info("Done. Redirecting to {}.", redirectURL); @@ -342,23 +342,12 @@ public class BKUApplet extends JApplet {    // ///////////////////////////////////////////////////////////////////////////    // utility methods    // /////////////////////////////////////////////////////////////////////////// -  protected URL getURLParameter(String paramKey, String sessionId) +  protected URL getURLParameter(String paramKey)            throws MalformedURLException {      String urlParam = getParameter(paramKey); -    if (urlParam != null && !"".equals(urlParam)) { -      URL codebase = getCodeBase(); +    if (urlParam != null && !urlParam.isEmpty()) {        try { -        URL url; -        if (codebase.getProtocol().equalsIgnoreCase("file")) { -          // for debugging in appletrunner -          url = new URL(urlParam); -        } else { -          if (sessionId != null) { -            urlParam = urlParam + ";jsessionid=" + sessionId; -          } -          url = new URL(codebase, urlParam); -        } -        return url; +        return new URL(getCodeBase(), urlParam);        } catch (MalformedURLException ex) {          log.error("Applet paremeter {} ist not a valid URL. {}", urlParam, ex.getMessage());          throw ex; diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index b8526730..0dd0a441 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -65,7 +65,7 @@ public class ActivationApplet extends BKUApplet {     */    @Override    public STALPortType getSTALPort() throws MalformedURLException { -    URL wsdlURL = getURLParameter(WSDL_URL, null); +    URL wsdlURL = getURLParameter(WSDL_URL);      log.debug("Setting STAL WSDL: {}.", wsdlURL);      QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE);      log.info("Creating STAL-X enabled webservice port."); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index b9f31f42..65704064 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -88,7 +88,7 @@ public class PINManagementBKUWorker extends AppletBKUWorker {        }      } -    applet.sendRedirect(sessionId); +    applet.sendRedirect();    }    } diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 5c754f07..2a73d984 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -146,6 +146,13 @@        <classifier>single</classifier>        <scope>provided</scope>      </dependency> +    <dependency> +    	<groupId>javax.servlet</groupId> +    	<artifactId>jstl</artifactId> +    	<version>1.2</version> +    	<type>jar</type> +    	<scope>compile</scope> +    </dependency>    </dependencies>    <description>MOCCA Online</description>    <build> diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java deleted file mode 100644 index 3cd6dd85..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java +++ /dev/null @@ -1,327 +0,0 @@ -/* -* Copyright 2009 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -*     http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package at.gv.egiz.bku.online.webapp; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.regex.Pattern; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; - -import at.gv.egiz.bku.binding.HTTPBindingProcessor; -import at.gv.egiz.bku.binding.HttpUtil; -import at.gv.egiz.bku.binding.Id; -import at.gv.egiz.bku.binding.IdFactory; -import at.gv.egiz.bku.binding.InputDecoderFactory; -import at.gv.egiz.bku.utils.StreamUtil; -import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; - -public abstract class AbstractWebRequestHandler extends SpringBKUServlet { - -  private static final long serialVersionUID = 1L; -   -  public static final String APPLET_PAGE_P = "appletPage"; -  public static final String APPLET_PAGE_DEFAULT = "applet.jsp"; -   -  public static final String PARAM_APPLET_WIDTH = "appletWidth"; -  public static final String ATTR_APPLET_WIDTH = "appletWidth"; -   -  public static final String PARAM_APPLET_HEIGHT = "appletHeight"; -  public static final String ATTR_APPLET_HEIGHT = "appletHeight"; -   -  public static final String PARAM_APPLET_BACKGROUND = "appletBackground"; -  public static final String ATTR_APPLET_BACKGROUND = "appletBackground"; -   -  public static final String PARAM_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; -  public static final String ATTR_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; -   -  public static final Pattern PATTERM_APPLET_BACKGROUND_COLOR = Pattern.compile("\\#[0-9a-fA-F]{6}"); -  public static final String PARAM_APPLET_GUI_STYLE = "appletGuiStyle"; -  public static final String ATTR_APPLET_GUI_STYLE = "appletGuiStyle"; -   -  public static final String[] VALUES_APPLET_GUI_STYLE = new String[] {"tiny", "simple", "advanced"}; -  public static final String PARAM_APPLET_EXTENSION = "appletExtension"; -  public static final String ATTR_APPLET_EXTENSION = "appletExtension"; -   -  public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation"}; -  public static final String PARAM_LOCALE = "locale"; -  public static final String ATTR_LOCALE = "locale"; -   -  public static final Pattern PATTERN_LOCALE = Pattern.compile("[a-zA-Z][a-zA-Z](_[a-zA-Z][a-zA-Z]){0,2}"); -  public static final String REDIRECT_URL_SESSION_ATTRIBUTE = "redirectUrl"; -   -  private final Logger log = LoggerFactory.getLogger(BKURequestHandler.class); - -  protected static String getStringFromStream(InputStream is, String encoding) -      throws IOException { -    if (is == null) { -      return null; -    } -    if (encoding == null) { -      encoding = HttpUtil.DEFAULT_CHARSET; -    } -    ByteArrayOutputStream os = new ByteArrayOutputStream(); -    StreamUtil.copyStream(is, os); -    return new String(os.toByteArray(), encoding); -  } -   -  protected abstract String getRequestProtocol(HttpServletRequest req); -   -  protected HTTPBindingProcessor getBindingProcessor(Id id, HttpServletRequest req, Locale locale) { -     -    // remove existing binding processor if present -    getBindingProcessorManager().removeBindingProcessor(id); -     -    // create new binding processor -    return (HTTPBindingProcessor) getBindingProcessorManager().createBindingProcessor(getRequestProtocol(req), locale); -     -  } -   -  @Override -  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, -      java.io.IOException { - -    String msg = (req.getSession(false) == null) ? "New session created." -        : "Session already established."; -     -    Id id = IdFactory.getInstance().createId(req.getSession().getId()); -    MDC.put("id", id.toString()); -     -    String acceptLanguage = req.getHeader("Accept-Language"); -    Locale locale = AcceptLanguage.getLocale(acceptLanguage); -     -    if (log.isInfoEnabled()) { -      log.info("Recieved request (Accept-Language locale: {}). {}", locale, msg); -    } -         -    try { -     -      HTTPBindingProcessor bindingProcessor = getBindingProcessor(id, req, locale); -       -      Map<String, String> headerMap = new HashMap<String, String>(); -      for (Enumeration<?> headerName = req.getHeaderNames(); headerName -          .hasMoreElements();) { -        String header = (String) headerName.nextElement(); -        if (header != null) { -          headerMap.put(header, req.getHeader(header)); -        } -      } -           -      InputStream inputStream; -      String charset; -      if (req.getMethod().equals("POST")) { -        charset = req.getCharacterEncoding(); -        String contentType = req.getContentType(); -        if (charset != null) { -          contentType += ";" + charset; -        } -        headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); -        inputStream = req.getInputStream(); -      } else { -        charset = "UTF-8"; -        headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, -            InputDecoderFactory.URL_ENCODED); -        String queryString = req.getQueryString(); -        if (queryString != null) { -          inputStream = new ByteArrayInputStream(queryString.getBytes(charset)); -        } else { -          inputStream = new ByteArrayInputStream(new byte[] {}); -        } -      } -      bindingProcessor.setHTTPHeaders(headerMap); -      bindingProcessor.consumeRequestStream(req.getRequestURL().toString(), -          inputStream); -   -      req.getInputStream().close(); -      getBindingProcessorManager().process(id, bindingProcessor); -   -      HttpSession session = req.getSession(); -   -      log.trace("Looking for applet parameters in request."); -   -      // appletWidth -      String width = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_WIDTH), charset); -      if (width != null && !width.isEmpty()) { -        try { -          // must be a valid integer -          session.setAttribute(ATTR_APPLET_WIDTH, Integer.parseInt(width)); -          log.debug("Found parameter " + PARAM_APPLET_WIDTH + "='{}'.", width); -        } catch (NumberFormatException nfe) { -          log.warn("Parameter " + PARAM_APPLET_WIDTH -              + " does not contain a valid value.", nfe); -        } -      } -   -      // appletHeight -      String height = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_HEIGHT), charset); -      if (height != null && !height.isEmpty()) { -        try { -          // must be a valid integer -          session.setAttribute(ATTR_APPLET_HEIGHT, Integer.parseInt(height)); -          log.debug("Found parameter " + PARAM_APPLET_HEIGHT + "='{}'.", height); -        } catch (NumberFormatException nfe) { -          log.warn("Parameter " + PARAM_APPLET_HEIGHT -              + " does not contain a valid value.", nfe); -        } -      } -   -      // appletBackground -      String background = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_BACKGROUND), charset); -      if (background != null && !background.isEmpty()) { -        session.setAttribute(ATTR_APPLET_BACKGROUND, background); -        try { -          // must be a valid http or https URL -          URI backgroundURL = new URI(background); -          if ("http".equals(backgroundURL.getScheme()) -              || "https".equals(backgroundURL.getScheme())) { -            session.setAttribute(ATTR_APPLET_BACKGROUND, backgroundURL -                .toASCIIString()); -            log.debug("Found parameter " + PARAM_APPLET_BACKGROUND + "='{}'.", -                backgroundURL.toASCIIString()); -          } else { -            log.warn("Parameter " + PARAM_APPLET_BACKGROUND -                + "='{}' is not a valid http/https URL.", background); -          } -        } catch (URISyntaxException e) { -          log.warn("Parameter " + PARAM_APPLET_BACKGROUND -              + "='{}' is not a valid http/https URL.", background, e); -        } -      } -   -      // appletBackgroundColor -      String backgroundColor = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_BACKGROUND_COLOR), charset); -      if (backgroundColor != null && !backgroundColor.isEmpty()) { -        // must be a valid color definition -        if (PATTERM_APPLET_BACKGROUND_COLOR.matcher(backgroundColor).matches()) { -          session.setAttribute(ATTR_APPLET_BACKGROUND_COLOR, backgroundColor); -          log.debug("Faund parameter " + PARAM_APPLET_BACKGROUND_COLOR -              + "='{}'.", backgroundColor); -        } else { -          log.warn("Parameter " + PARAM_APPLET_BACKGROUND_COLOR -              + "='{}' is not a valid color definition " -              + "(must be of form '#hhhhhh').", backgroundColor); -        } -      } -   -      // appletGuiStyle -      String guiStyle = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_GUI_STYLE), charset); -      if (guiStyle != null && !guiStyle.isEmpty()) { -        // must be one of VALUES_APPLET_GUI_STYLE -        String style = guiStyle.toLowerCase(); -        if (Arrays.asList(VALUES_APPLET_GUI_STYLE).contains(style)) { -          session.setAttribute(ATTR_APPLET_GUI_STYLE, style); -          log.debug("Found parameter " + PARAM_APPLET_GUI_STYLE + "='{}'.", style); -        } else { -          StringBuilder sb = new StringBuilder(); -          sb.append("Parameter ").append(PARAM_APPLET_GUI_STYLE).append( -              "='").append(guiStyle).append("' is not valid (must be one of ") -              .append(Arrays.toString(VALUES_APPLET_GUI_STYLE)).append(")."); -          log.warn(sb.toString()); -        } -      } -   -      // appletExtension -      String extension = getStringFromStream(bindingProcessor -          .getFormData(PARAM_APPLET_EXTENSION), charset); -      if (extension != null && !extension.isEmpty()) { -        // must be one of VALUES_APPLET_EXTENSION -        String ext = extension.toLowerCase(); -        if (Arrays.asList(VALUES_APPLET_EXTENSION).contains(ext)) { -          session.setAttribute(ATTR_APPLET_EXTENSION, ext); -          log.debug("Found parameter " + PARAM_APPLET_EXTENSION + "='{}'.", ext); -        } else { -          StringBuilder sb = new StringBuilder(); -          sb.append("Parameter ").append(PARAM_APPLET_EXTENSION).append( -              "='").append(extension).append("' is not valid (must be one of ") -              .append(Arrays.toString(VALUES_APPLET_EXTENSION)).append(")."); -          log.warn(sb.toString()); -        } -      } -   -      // locale -      String localeFormParam = getStringFromStream(bindingProcessor -          .getFormData(PARAM_LOCALE), charset); -      if (localeFormParam != null && !localeFormParam.isEmpty()) { -        // must be a valid locale  -        if (PATTERN_LOCALE.matcher(localeFormParam).matches()) { -          locale = new Locale(localeFormParam); -          log.debug("Override accept-language header locale {} " -              + "with form param {}.", locale, localeFormParam); -        } else { -          log.warn("Parameter " + PARAM_LOCALE -              + "='{}' is not a valid locale definition.", localeFormParam); -        } -      } -      if (locale != null) { -        log.debug("Using locale {}.", locale); -        session.setAttribute(ATTR_LOCALE, locale.toString()); -      } -           -      beforeAppletPage(req, bindingProcessor); -           -      String appletPage = getStringFromStream(bindingProcessor -          .getFormData(APPLET_PAGE_P), charset); -      if (appletPage == null || appletPage.isEmpty()) { -        appletPage = APPLET_PAGE_DEFAULT; -      } -      log.debug("Sending redirect to UI page '{}'.", appletPage + ";jsessionid=" + id); -      resp.sendRedirect(appletPage + ";jsessionid=" + id); -       -    } finally { -      MDC.remove("id"); -    } -  } - -  @Override -  protected void doGet(HttpServletRequest req, HttpServletResponse resp) -      throws ServletException, java.io.IOException { -    doPost(req, resp); -  } - -  /** -   * Called before the request is forwarded or redirected to the Applet page. -   *  -   * @param req -   * @param bindingProcessor -   */ -  protected void beforeAppletPage(HttpServletRequest req, -      HTTPBindingProcessor bindingProcessor) { -  } -   -} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java deleted file mode 100644 index 9e455621..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - *     http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.online.webapp; - -import java.io.IOException; -import java.util.regex.Pattern; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * prevent applet caching,  - * could be removed once applet is loaded via jnlp - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -public class AppletDispatcher extends HttpServlet { - -  private static final long serialVersionUID = 1L; - -  private final Logger log = LoggerFactory.getLogger(AppletDispatcher.class); - -  public static final String DISPATCH_CTX = "dispatch/"; -  public static final String RAND_PREFIX = "__"; -  public static final String RAND_ATTRIBUTE = "rand"; -  public static final Pattern ctxPattern = Pattern.compile(DISPATCH_CTX); -  public static final Pattern archivePattern = Pattern.compile(RAND_PREFIX + "[a-zA-Z0-9]*\\.jar$"); - -    /**  -     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. -     * @param request servlet request -     * @param response servlet response -     * @throws ServletException if a servlet-specific error occurs -     * @throws IOException if an I/O error occurs -     */ -    protected void processRequest(HttpServletRequest request, HttpServletResponse response) -    throws ServletException, IOException { - -      String uri = request.getRequestURI(); -//      log.trace("request URI " + uri); - -      uri = uri.substring(request.getContextPath().length()); -//      log.trace("removing contextPath " + uri); - -      uri = ctxPattern.matcher(uri).replaceAll(""); -//      log.trace("removing dispatch context " + uri); - -      uri = archivePattern.matcher(uri).replaceAll(".jar"); -//      log.trace("removing random suffix " + uri); -       -      log.trace("Dispatching request URI {} to {}.", request.getRequestURI(), uri); -       -      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(uri); -      dispatcher.forward(request, response); -    }  - -    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> -    /**  -     * Handles the HTTP <code>GET</code> method. -     * @param request servlet request -     * @param response servlet response -     * @throws ServletException if a servlet-specific error occurs -     * @throws IOException if an I/O error occurs -     */ -    @Override -    protected void doGet(HttpServletRequest request, HttpServletResponse response) -    throws ServletException, IOException { -        processRequest(request, response); -    }  - -    /**  -     * Handles the HTTP <code>POST</code> method. -     * @param request servlet request -     * @param response servlet response -     * @throws ServletException if a servlet-specific error occurs -     * @throws IOException if an I/O error occurs -     */ -    @Override -    protected void doPost(HttpServletRequest request, HttpServletResponse response) -    throws ServletException, IOException { -        processRequest(request, response); -    } - -    /**  -     * Returns a short description of the servlet. -     * @return a String containing servlet description -     */ -    @Override -    public String getServletInfo() { -        return "Short description"; -    }// </editor-fold> - -} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java deleted file mode 100644 index d42f911c..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - *     http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.online.webapp; - -import javax.servlet.http.HttpServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.bku.binding.HTTPBindingProcessor; -import at.gv.egiz.bku.binding.HTTPBindingProcessorImpl; - -/** - * Handles SL requests and instantiates BindingProcessors - *  - */ -public class BKURequestHandler extends AbstractWebRequestHandler { -   -  private static final long serialVersionUID = 1L; -   -  private final Logger log = LoggerFactory.getLogger(BKURequestHandler.class); -   -  @Override -  protected void beforeAppletPage(HttpServletRequest req, HTTPBindingProcessor bindingProcessor) { -    // handle server side redirect url after processing -    String redirectUrl = ((HTTPBindingProcessorImpl) bindingProcessor).getRedirectURL();  -    if ( redirectUrl != null) { -      log.info("Got redirect URL '{}'. Deferring browser redirect.", redirectUrl); -      req.getSession().setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); -    } -  } - -  @Override -  protected String getRequestProtocol(HttpServletRequest req) { -    return "HTTP"; -  } - -} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java new file mode 100644 index 00000000..0d2f847e --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java @@ -0,0 +1,210 @@ +/* + * Copyright 2009 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *     http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.webapp; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringWriter; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.Charset; +import java.util.Arrays; +import java.util.Locale; +import java.util.regex.Pattern; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.utils.StreamUtil; + +public class MoccaParameterBean { + +  private final Logger log = LoggerFactory.getLogger(MoccaParameterBean.class); +   +  public static final String PARAM_UI_PAGE_P = "appletPage"; + +  public static final String PARAM_APPLET_WIDTH = "appletWidth"; + +  public static final String PARAM_APPLET_HEIGHT = "appletHeight"; + +  public static final String PARAM_APPLET_BACKGROUND = "appletBackground"; +   +  public static final String PARAM_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; +  public static final Pattern PATTERM_APPLET_BACKGROUND_COLOR = Pattern.compile("\\#[0-9a-fA-F]{6}"); +   +  public static final String PARAM_APPLET_GUI_STYLE = "appletGuiStyle"; +  public static final String[] VALUES_APPLET_GUI_STYLE = new String[] {"tiny", "simple", "advanced"}; + +  public static final String PARAM_APPLET_EXTENSION = "appletExtension"; +  public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation"}; + +  public static final String PARAM_LOCALE = "locale"; +  public static final Pattern PATTERN_LOCALE = Pattern.compile("[a-zA-Z][a-zA-Z](_[a-zA-Z][a-zA-Z]){0,2}"); + +  private Charset charset = Charset.forName("ISO-8859-1"); +   +  private HTTPBindingProcessor bindingProcessor; +   +  public MoccaParameterBean(HTTPBindingProcessor bindingProcessor) { +    this.bindingProcessor = bindingProcessor; +  } + +  public Charset getCharset() { +    return charset; +  } + +  public void setCharset(Charset charset) { +    this.charset = (charset != null) ? Charset.forName("ISO-8859-1") : charset; +  } + +  public String getUIPage(String defaultValue) { +    String uiPage = getString(PARAM_UI_PAGE_P); +    return (uiPage != null) ? uiPage : defaultValue; +  } +   +  public Integer getAppletWidth() { +    return getInteger(PARAM_APPLET_WIDTH); +  } + +  public Integer getAppletHeight() { +    return getInteger(PARAM_APPLET_HEIGHT); +  } + +  public String getAppletBackground() { +    String background = getString(PARAM_APPLET_BACKGROUND); +    if (background != null && !background.isEmpty()) { +      try { +        // must be a valid http or https URL +        URI backgroundURL = new URI(background); +        if ("http".equals(backgroundURL.getScheme()) +            || "https".equals(backgroundURL.getScheme())) { +          return background.toString(); +        } else { +          log.warn("Parameter " + PARAM_APPLET_BACKGROUND +              + "='{}' is not a valid http/https URL.", background); +        } +      } catch (URISyntaxException e) { +        log.warn("Parameter " + PARAM_APPLET_BACKGROUND +            + "='{}' is not a valid http/https URL.", background, e); +      } +    } +    return null; +  } + +  public String getAppletBackgroundColor() { +    String backgroundColor = getString(PARAM_APPLET_BACKGROUND_COLOR); +    if (backgroundColor != null && !backgroundColor.isEmpty()) { +      // must be a valid color definition +      if (PATTERM_APPLET_BACKGROUND_COLOR.matcher(backgroundColor).matches()) { +        return backgroundColor; +      } else { +        log.warn("Parameter " + PARAM_APPLET_BACKGROUND_COLOR +            + "='{}' is not a valid color definition " +            + "(must be of form '#hhhhhh').", backgroundColor); +      } +    } +    return null; +  } + +  public String getGuiStyle() { +    String guiStyle = getString(PARAM_APPLET_GUI_STYLE); +    if (guiStyle != null && !guiStyle.isEmpty()) { +      // must be one of VALUES_APPLET_GUI_STYLE +      String style = guiStyle.toLowerCase(); +      if (Arrays.asList(VALUES_APPLET_GUI_STYLE).contains(style)) { +        return style; +      } else { +        StringBuilder sb = new StringBuilder(); +        sb.append("Parameter ").append(PARAM_APPLET_GUI_STYLE).append( +            "='").append(guiStyle).append("' is not valid (must be one of ") +            .append(Arrays.toString(VALUES_APPLET_GUI_STYLE)).append(")."); +        log.warn(sb.toString()); +      } +    } +    return null; +  } +   +  public String getExtension() { +    String extension = getString(PARAM_APPLET_EXTENSION); +    if (extension != null && !extension.isEmpty()) { +      // must be one of VALUES_APPLET_EXTENSION +      String ext = extension.toLowerCase(); +      if (Arrays.asList(VALUES_APPLET_EXTENSION).contains(ext)) { +        log.debug("Found parameter " + PARAM_APPLET_EXTENSION + "='{}'.", ext); +        return ext; +      } else { +        StringBuilder sb = new StringBuilder(); +        sb.append("Parameter ").append(PARAM_APPLET_EXTENSION).append( +            "='").append(extension).append("' is not valid (must be one of ") +            .append(Arrays.toString(VALUES_APPLET_EXTENSION)).append(")."); +        log.warn(sb.toString()); +      } +    } +    return null; +  } +   +  public Locale getLocale() { +    String locale = getString(PARAM_LOCALE); +    if (locale != null && !locale.isEmpty()) { +      // must be a valid locale  +      if (PATTERN_LOCALE.matcher(locale).matches()) { +        log.debug("Found parameter " + PARAM_LOCALE + "='{}'.", locale); +        return new Locale(locale); +      } else { +        log.warn("Parameter " + PARAM_LOCALE +            + "='{}' is not a valid locale definition.", locale); +      } +    } +    return null; +  } +   +  public Integer getInteger(String parameterName) { +    String string = getString(parameterName); +    if (string == null || string.isEmpty()) { +      return null; +    } else { +      try { +        return Integer.parseInt(string); +      } catch (NumberFormatException e) { +        log.warn("Parameter {} does not contain a valid value.", parameterName, +            e); +        return null; +      } +    } +  } + +  public String getString(String parameterName) { +    if (bindingProcessor != null) { +      InputStream formData = bindingProcessor.getFormData(parameterName); +      if (formData != null) { +        InputStreamReader reader = new InputStreamReader(formData, charset); +        StringWriter writer = new StringWriter(); +        try { +          StreamUtil.copyStream(reader, writer); +        } catch (IOException e) { +          log.warn("Failed to get parameter {}.", parameterName, e); +        } +        return writer.toString(); +      } +    } +    return null; +  } +   +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/RequestIdFilter.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/RequestIdFilter.java new file mode 100644 index 00000000..210f482f --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/RequestIdFilter.java @@ -0,0 +1,58 @@ +package at.gv.egiz.bku.online.webapp; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.slf4j.MDC; + +import at.gv.egiz.bku.binding.Id; +import at.gv.egiz.bku.binding.IdFactory; + +/** + * Servlet Filter implementation class BindingProcessorFilter + */ +public class RequestIdFilter implements Filter { +   +  /** +   * @see Filter#destroy() +   */ +  public void destroy() { +  } + +  /** +   * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) +   */ +  public void doFilter(ServletRequest request, ServletResponse response, +      FilterChain chain) throws IOException, ServletException { + +    if (request instanceof HttpServletRequest) { +      HttpSession session = ((HttpServletRequest) request).getSession(); +      Id id = IdFactory.getInstance().createId(session.getId()); +      MDC.put("id", id.toString()); +      request.setAttribute("id", id); +    } + +    // pass the request along the filter chain +    try { +      chain.doFilter(request, response); +    } finally { +      MDC.remove("id"); +    } +     +  } + +  /** +   * @see Filter#init(FilterConfig) +   */ +  public void init(FilterConfig fConfig) throws ServletException { +  } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java index 5fd01775..cdc5a3ef 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -17,63 +17,56 @@  package at.gv.egiz.bku.online.webapp;  import java.io.IOException; -import java.util.Iterator; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; +import java.util.Map.Entry; -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;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; -import org.slf4j.MDC;  import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorManager;  import at.gv.egiz.bku.binding.HTTPBindingProcessor;  import at.gv.egiz.bku.binding.Id; -import at.gv.egiz.bku.binding.IdFactory;  import at.gv.egiz.bku.utils.NullOutputStream;  /**   * Delivers the result to the browser   *    */ -public class ResultServlet extends SpringBKUServlet { +public class ResultServlet extends HttpServlet {    private static final long serialVersionUID = 1L;    private final Logger log = LoggerFactory.getLogger(ResultServlet.class); -  private String encoding = "UTF-8"; -  private String expiredPage = "./expiredError.jsp"; - -  public ResultServlet() { -  } - -  private void myInit() { -    String enc = getServletContext().getInitParameter("responseEncoding"); -    if (enc != null) { -      log.trace("Init default encoding to: {}.", enc); -      encoding = enc; -    } -    String expP = getServletConfig().getInitParameter("expiredPage"); -    if (expP != null) { -      log.trace("Init expired page to: {}.", expP); -      expiredPage = expP; -    } -  } +  private String responseEncoding = "UTF-8"; +   +  private String expiredPageUrl = "expired.jsp";    @Override    public void init() throws ServletException { -    super.init(); -    myInit(); -  } - -  @Override -  public void init(ServletConfig config) throws ServletException { -    super.init(config); -    myInit(); +    String encoding = getServletConfig().getInitParameter("responseEncoding"); +    if (encoding != null) { +      log.info("Init default responseEncoding to: {}.", encoding); +      responseEncoding = encoding; +    } +    String url = getServletConfig().getInitParameter("expiredPageUrl"); +    if (url != null) { +      try { +        expiredPageUrl = new URL(url).toString(); +        log.info("Init expiredPageUrl to: {}.", expiredPageUrl); +      } catch (MalformedURLException e) { +        log.error("Failed to set expiredUrlPage {}.", url, e); +      } +    }    }    protected void doPost(HttpServletRequest req, HttpServletResponse resp) @@ -84,64 +77,55 @@ public class ResultServlet extends SpringBKUServlet {    protected void doGet(HttpServletRequest req, HttpServletResponse resp)        throws ServletException, java.io.IOException {  -    HttpSession session = req.getSession(false); -    if (session == null) { -      resp.sendRedirect(expiredPage); +    BindingProcessorManager bindingProcessorManager = (BindingProcessorManager) getServletContext() +        .getAttribute("bindingProcessorManager"); +    if (bindingProcessorManager == null) { +      String msg = "Configuration error: BindingProcessorManager missing!"; +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);        return;      } -    Id id = IdFactory.getInstance().createId(session.getId()); - -    HTTPBindingProcessor bp; -    BindingProcessor bindingProcessor = getBindingProcessorManager().getBindingProcessor(id); -    if (bindingProcessor instanceof HTTPBindingProcessor) { -      bp = (HTTPBindingProcessor) bindingProcessor; -    } else { -      session.invalidate(); -      resp.sendRedirect(expiredPage); +    Id id = (Id) req.getAttribute("id"); +    BindingProcessor bindingProcessor = null; +    if (id == null +        || !((bindingProcessor = bindingProcessorManager +            .getBindingProcessor(id)) instanceof HTTPBindingProcessor)) { +      resp.sendRedirect(expiredPageUrl);        return;      } -    MDC.put("id", id.toString()); +     +    HTTPBindingProcessor bp = (HTTPBindingProcessor) bindingProcessor;      try { -      String redirectUrl = (String) session -          .getAttribute(AbstractWebRequestHandler.REDIRECT_URL_SESSION_ATTRIBUTE); -      if (redirectUrl == null) { -        redirectUrl = bp.getRedirectURL(); -      } -      if (redirectUrl != null) { -        try { -          bp.writeResultTo(new NullOutputStream(), encoding); -          getBindingProcessorManager().removeBindingProcessor(bp.getId()); -        } finally { -          log.info("Sending deferred redirect, RedirectURL={}.", redirectUrl); -          resp.sendRedirect(redirectUrl); -          session.invalidate(); +      OutputStream outputStream; +      String redirectUrl = bp.getRedirectURL(); +      if (redirectUrl != null && !redirectUrl.trim().isEmpty()) { +        log.info("Sending (deferred) redirect to {}.", redirectUrl); +        resp.sendRedirect(redirectUrl); +        // TODO Couldn't we simply discard the output? +        outputStream = new NullOutputStream(); +      } else { +        log.debug("Setting HTTP status code {}.", bp.getResponseCode()); +        resp.setStatus(bp.getResponseCode()); +        resp.setHeader("Cache-Control", "no-store"); // HTTP 1.1 +        resp.setHeader("Pragma", "no-cache"); // HTTP 1.0 +        resp.setDateHeader("Expires", 0); +        Map<String, String> responseHeaders = bp.getResponseHeaders(); +        for (Entry<String, String> header : responseHeaders.entrySet()) { +          String key = header.getKey(); +          String value = header.getValue(); +          log.debug("Setting response header {}: {}.", key, value); +          resp.setHeader(key, value);          } -        return; -      } -   -      log.trace("Setting response code: {}.", bp.getResponseCode()); -      resp.setStatus(bp.getResponseCode()); -      resp.setHeader("Cache-Control", "no-store"); // HTTP 1.1 -      resp.setHeader("Pragma", "no-cache"); // HTTP 1.0 -      resp.setDateHeader("Expires", 0); -      for (Iterator<String> it = bp.getResponseHeaders().keySet().iterator(); it -          .hasNext();) { -        String header = it.next(); -        log.trace("Setting response header {}: {}.", header, bp.getResponseHeaders().get(header)); -        resp.setHeader(header, bp.getResponseHeaders().get(header)); +        resp.setContentType(bp.getResultContentType()); +        log.info("Sending result."); +        outputStream = resp.getOutputStream();        } -      resp.setContentType(bp.getResultContentType()); -      resp.setCharacterEncoding(encoding); -      log.info("Sending result."); -      bp.writeResultTo(resp.getOutputStream(), encoding); -      resp.getOutputStream().flush(); -      session.invalidate(); -      getBindingProcessorManager().removeBindingProcessor(bp.getId()); -       +      bp.writeResultTo(outputStream, responseEncoding); +      outputStream.flush();      } finally { -      MDC.remove("id"); +      bindingProcessorManager.removeBindingProcessor(id);      }    }  } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java index 1bec31b6..e7f05862 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java @@ -35,11 +35,12 @@ public class SessionListener implements HttpSessionListener {    @Override    public void sessionCreated(HttpSessionEvent event) { +    log.info("Session {} created.", event.getSession().getId());    }    @Override    public void sessionDestroyed(HttpSessionEvent event) { -    BindingProcessorManager manager = (BindingProcessorManager) event.getSession().getServletContext().getAttribute(SpringBKUServlet.BEAN_NAME); +    BindingProcessorManager manager = (BindingProcessorManager) event.getSession().getServletContext().getAttribute("bindingProcessorManager");      manager.removeBindingProcessor(IdFactory.getInstance().createId(event.getSession().getId()));      log.info("Session {} destroyed.", event.getSession().getId());    } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java deleted file mode 100644 index 6a6f11e8..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -*     http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.online.webapp;
 -
 -import javax.servlet.http.HttpServlet; - -import at.gv.egiz.bku.binding.BindingProcessorManager; -
 -public abstract class SpringBKUServlet extends HttpServlet {
 -
 -  private static final long serialVersionUID = 1L; - -  public final static String BEAN_NAME="bindingProcessorManager"; -   -  protected BindingProcessorManager getBindingProcessorManager() {
 -    return (BindingProcessorManager) getServletContext().getAttribute(BEAN_NAME);
 -  } -   -}
 diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java new file mode 100644 index 00000000..9b9b9927 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java @@ -0,0 +1,106 @@ +/* + * Copyright 2009 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *     http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.webapp; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorManager; +import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.binding.Id; + +public class UIServlet extends HttpServlet { + +  private static final long serialVersionUID = 1L; + +  private final Logger log = LoggerFactory.getLogger(UIServlet.class); + +  private String expiredPageUrl = "expired.jsp"; + +  @Override +  public void init() throws ServletException { +    String url = getServletConfig().getInitParameter("expiredPageUrl"); +    if (url != null) { +      try { +        expiredPageUrl = new URL(url).toString(); +        log.info("Init expiredPageUrl to: {}.", expiredPageUrl); +      } catch (MalformedURLException e) { +        log.error("Failed to set expiredUrlPage {}.", url, e); +      } +    } +  } + +  @Override +  protected void doGet(HttpServletRequest req, HttpServletResponse resp) +      throws ServletException, IOException { + +    BindingProcessorManager bindingProcessorManager = (BindingProcessorManager) getServletContext() +        .getAttribute("bindingProcessorManager"); +    if (bindingProcessorManager == null) { +      String msg = "Configuration error: BindingProcessorManager missing!"; +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); +      return; +    } + +    Id id = (Id) req.getAttribute("id"); +    BindingProcessor bindingProcessor = null; +    if (id == null +        || !((bindingProcessor = bindingProcessorManager +            .getBindingProcessor(id)) instanceof HTTPBindingProcessor)) { +      resp.sendRedirect(expiredPageUrl); +      return; +    } +     +    MoccaParameterBean parameterBean = new MoccaParameterBean((HTTPBindingProcessor) bindingProcessor); +    req.setAttribute("moccaParam", parameterBean); +     +    String uiPage = getServletConfig().getInitParameter("uiPage"); +    uiPage = parameterBean.getUIPage(uiPage); +    if (uiPage == null) { +      uiPage = "applet.jsp"; +    } + +    RequestDispatcher dispatcher = req.getRequestDispatcher(uiPage); +    if (dispatcher == null) { +      log.warn("Failed to get RequestDispatcher for page {}.", uiPage); +      resp.sendError(HttpServletResponse.SC_NOT_FOUND); +    } else { +      dispatcher.forward(req, resp); +    } + +  } + +  @Override +  protected void doPost(HttpServletRequest req, HttpServletResponse resp) +      throws ServletException, IOException { +    super.doPost(req, resp); +  } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java new file mode 100644 index 00000000..08b50699 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java @@ -0,0 +1,137 @@ +/* +* Copyright 2009 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +*     http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package at.gv.egiz.bku.online.webapp; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.LinkedHashMap; +import java.util.Locale; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.binding.BindingProcessorManager; +import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.binding.HttpUtil; +import at.gv.egiz.bku.binding.Id; +import at.gv.egiz.bku.binding.InputDecoderFactory; +import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; + +public class WebRequestHandler extends HttpServlet { + +  private static final long serialVersionUID = 1L; +   +  private final Logger log = LoggerFactory.getLogger(WebRequestHandler.class); + +  @Override +  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, +      java.io.IOException { + +    BindingProcessorManager bindingProcessorManager = (BindingProcessorManager) getServletContext() +        .getAttribute("bindingProcessorManager"); +    if (bindingProcessorManager == null) { +      String msg = "Configuration error: BindingProcessorManager missing!"; +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); +      return; +    } + +    Id id = (Id) req.getAttribute("id"); +    if (id == null) { +      String msg = "No request id! Configuration error: ServletFilter missing?";  +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); +      return; +    } +     +    // if binding processor with same id is present: remove +    bindingProcessorManager.removeBindingProcessor(id); +     +    Locale locale = AcceptLanguage.getLocale(req.getHeader("Accept-Language")); +    if (log.isInfoEnabled()) { +      log.info("Recieved request (Accept-Language locale: {}).", locale); +    } +     +    // create new binding processor +    String protocol = getServletConfig().getInitParameter("protocol"); +    if (protocol == null || protocol.isEmpty()) { +      protocol = req.getScheme(); +    } +    HTTPBindingProcessor bindingProcessor = (HTTPBindingProcessor) bindingProcessorManager +        .createBindingProcessor(protocol, locale);     + +    // set headers +    LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>(); +    if (req.getHeaderNames() != null) { +      for (Enumeration<?> headerName = req.getHeaderNames(); headerName +          .hasMoreElements();) { +        String name = (String) headerName.nextElement(); +        // Account for multiple headers with the same field-name, but +        // they are very rare, so we are not using a StringBuffer. +        Enumeration<?> headers = req.getHeaders(name); +        String value = null; +        while (headers.hasMoreElements()) { +          value = (value == null)  +              ? (String) headers.nextElement()  +              : value + ", " + headers.nextElement(); +        } +        headerMap.put(name, value); +      } +    } +    bindingProcessor.setHTTPHeaders(headerMap); +     +    // set request stream  +    InputStream inputStream; +    if (req.getMethod().equals("POST")) { +      inputStream = req.getInputStream(); +    } else { +      headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, InputDecoderFactory.URL_ENCODED); +      String queryString = req.getQueryString(); +      if (queryString != null) { +        inputStream = new ByteArrayInputStream(queryString.getBytes("UTF-8")); +      } else { +        inputStream = new ByteArrayInputStream(new byte[] {}); +      } +    } +    bindingProcessor.consumeRequestStream(req.getRequestURL().toString(), inputStream); +    inputStream.close(); + +    // process +    bindingProcessorManager.process(id, bindingProcessor); +   +    log.debug("Sending redirect to user interface."); +    // TODO: appending the jsessionid here breaks the separation of request +    // handling and request state tracking done in the servlet filter, but  +    // the servlet filter does not allow us to modify the redirect +    resp.sendRedirect("ui;jsessionid=" + id.toString()); +       +  } + +  @Override +  protected void doGet(HttpServletRequest req, HttpServletResponse resp) +      throws ServletException, java.io.IOException { +    doPost(req, resp); +  } +   +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java index b40fd35f..57140e13 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java @@ -20,8 +20,10 @@ package at.gv.egiz.mocca.id;  import java.io.IOException;  import java.io.InputStream;  import java.util.Iterator; +import java.util.Locale;  import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse;  import javax.xml.XMLConstants; @@ -38,12 +40,11 @@ import org.w3c.dom.Document;  import org.w3c.dom.Element;  import org.xml.sax.SAXException; -import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorManager;  import at.gv.egiz.bku.binding.FormParameter; -import at.gv.egiz.bku.binding.IdFactory; +import at.gv.egiz.bku.binding.Id;  import at.gv.egiz.bku.binding.InputDecoder;  import at.gv.egiz.bku.binding.InputDecoderFactory; -import at.gv.egiz.bku.online.webapp.SpringBKUServlet;  import at.gv.egiz.bku.slcommands.SLCommand;  import at.gv.egiz.bku.slcommands.SLMarshallerFactory;  import at.gv.egiz.bku.slcommands.SLResult; @@ -55,9 +56,10 @@ import at.gv.egiz.bku.slcommands.impl.SLCommandImpl;  import at.gv.egiz.bku.slexceptions.SLCommandException;  import at.gv.egiz.bku.utils.DebugInputStream;  import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;  import at.gv.egiz.slbinding.SLUnmarshaller; -public class DataURLServerServlet extends SpringBKUServlet { +public class DataURLServerServlet extends HttpServlet {    private static Logger log = LoggerFactory.getLogger(DataURLServerServlet.class); @@ -73,6 +75,26 @@ public class DataURLServerServlet extends SpringBKUServlet {    protected void doPost(HttpServletRequest req, HttpServletResponse resp)        throws ServletException, IOException { +    BindingProcessorManager bindingProcessorManager = (BindingProcessorManager) getServletContext() +        .getAttribute("bindingProcessorManager"); +    if (bindingProcessorManager == null) { +      String msg = "Configuration error: BindingProcessorManager missing!"; +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); +      return; +    } + +    Id id = (Id) req.getAttribute("id"); +    if (id == null) { +      String msg = "No request id! Configuration error: ServletFilter missing?";  +      log.error(msg); +      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); +      return; +    } +     +    // if binding processor with same id is present: remove +    bindingProcessorManager.removeBindingProcessor(id); +      String userAgent = req.getHeader("User-Agent");      String contentType = req.getContentType();      log.debug("Content-Type: " + contentType + " User-Agent: " + userAgent); @@ -148,12 +170,20 @@ public class DataURLServerServlet extends SpringBKUServlet {        }      } - -    SAMLBindingProcessorImpl bindingProcessor = null; -    if (sessionId != null) { -      bindingProcessor = getBindingProcessor(sessionId); +     +    Locale locale = AcceptLanguage.getLocale(req.getHeader("Accept-Language")); +    if (log.isInfoEnabled()) { +      log.info("Recieved request (Accept-Language locale: {}).", locale);      } +    // create new binding processor +    String protocol = getServletConfig().getInitParameter("protocol"); +    if (protocol == null || protocol.isEmpty()) { +      protocol = req.getScheme(); +    } +    SAMLBindingProcessorImpl bindingProcessor = (SAMLBindingProcessorImpl) bindingProcessorManager +        .createBindingProcessor(protocol, locale);     +      if (bindingProcessor != null && respElement != null) {        SLResult slResult = null; @@ -203,23 +233,8 @@ public class DataURLServerServlet extends SpringBKUServlet {      } -    resp.sendRedirect("bkuResult"); +    resp.sendRedirect("ui;jsessionid=" + id.toString());    }     -  protected SAMLBindingProcessorImpl getBindingProcessor(String sessionId) { -     -    BindingProcessor bp = getBindingProcessorManager().getBindingProcessor( -        IdFactory.getInstance().createId(sessionId)); -     -    if (bp instanceof SAMLBindingProcessorImpl) { -      log.debug("Found active BindingProcessor, using this one."); -      return (SAMLBindingProcessorImpl) bp; -    } -     -    return null; -     -  } - -  } diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java index ce4ac425..56513ee9 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java @@ -77,8 +77,6 @@ public class SAMLBindingProcessorImpl extends    private String keyBoxIdentifier = "SecureSignatureKeypair"; -  private String url = "www.egiz.gv.at"; -    private QESTemplates templates = new QESTemplates();    private IdLink idLink; diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java deleted file mode 100644 index 0209ca79..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright 2009 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -*     http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package at.gv.egiz.mocca.id; - -import javax.servlet.http.HttpServletRequest; - -import at.gv.egiz.bku.online.webapp.AbstractWebRequestHandler; - -public class SAMLRequestHandler extends AbstractWebRequestHandler { -   -  private static final long serialVersionUID = 1L; -   -  @Override -  protected String getRequestProtocol(HttpServletRequest req) { -    return "SAML"; -  } -   -} diff --git a/BKUOnline/src/main/resources/web.properties b/BKUOnline/src/main/resources/web.properties new file mode 100644 index 00000000..94651b70 --- /dev/null +++ b/BKUOnline/src/main/resources/web.properties @@ -0,0 +1,26 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#     http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title=MOCCA +javaPluginRequired=Java™ plug-in, version 6 update 4 or higher is required. +installJava=Install Java™ +incTextSize=increase text size +decTextSize=decrease text size +help=help + +local=Send request to local citizen card environment + +expiredTitle=Session Expired +expiredMessage=Your session has expired.
\ No newline at end of file diff --git a/BKUOnline/src/main/resources/web_de.properties b/BKUOnline/src/main/resources/web_de.properties new file mode 100644 index 00000000..cb7d3d33 --- /dev/null +++ b/BKUOnline/src/main/resources/web_de.properties @@ -0,0 +1,26 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#     http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title=MOCCA +javaPluginRequired=Java™ Plug-In, Version 6 Update 4 oder höher wird benötigt. +installJava=Java™ installieren +incTextSize=Text vergrößern +decTextSize=Text verkleinern +help=Hilfe + +local=Anfrage an lokale Bürgerkartenumgebung senden + +expiredTitle=Sitzung Abgelaufen +expiredMessage=Ihre Sitzung ist abgelaufen.
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index 13ed30ee..3a318844 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,5 @@  <?xml version="1.0" encoding="UTF-8"?> -<!-- +	<!--  		Copyright 2008 Federal Chancellery Austria and Graz University of  		Technology Licensed under the Apache License, Version 2.0 (the  		"License"); you may not use this file except in compliance with the @@ -12,138 +12,159 @@  		the specific language governing permissions and limitations under the  		License.  	--> -<web-app id="bkuonline" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> -  <display-name>http-security-layer-request</display-name> - -  <listener> -    <listener-class>at.gv.egiz.bku.online.webapp.MoccaContextListener</listener-class> -  </listener> - -	<!--  Begin Spring Config --> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" +	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" +	id="bkuonline" version="2.5"> +	<display-name>MOCCA Online</display-name> +	<listener> +		<listener-class>at.gv.egiz.bku.online.webapp.MoccaContextListener</listener-class> +	</listener>  	<listener>  		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  	</listener>  	<context-param> +		<!-- +			You may specify your configuration resource below. Please do not +			remove the the configurationResource parameter if not used, but set +			it to an empty value. +		-->  		<param-name>configurationResource</param-name>  		<param-value></param-value>  	</context-param> -	<!--  End Spring Config --> - -	<!--  Begin BKU Config --> -  <listener> -    <listener-class>at.gv.egiz.bku.online.webapp.SessionListener</listener-class> -  </listener> -  <listener> -    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> -  </listener> -  <servlet> -    <servlet-name>BKUServlet</servlet-name> -    <servlet-class>at.gv.egiz.bku.online.webapp.BKURequestHandler</servlet-class> -  </servlet> -  <servlet> -    <servlet-name>SAMLServlet</servlet-name> -    <servlet-class>at.gv.egiz.mocca.id.SAMLRequestHandler</servlet-class> -  </servlet> -  <servlet> -    <servlet-name>DataURLServlet</servlet-name> -    <servlet-class>at.gv.egiz.mocca.id.DataURLServerServlet</servlet-class> -  </servlet> -  <servlet> -    <servlet-name>ResultServlet</servlet-name> -    <servlet-class>at.gv.egiz.bku.online.webapp.ResultServlet</servlet-class> -    <init-param> -      <param-name>responseEncoding</param-name> -      <param-value>UTF-8</param-value> -    </init-param> -    <init-param> -      <param-name>expiredPage</param-name> -      <param-value>expired.html</param-value> -    </init-param> -  </servlet> +	<listener> +		<listener-class>at.gv.egiz.bku.online.webapp.SessionListener</listener-class> +	</listener> +	<listener> +		<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> +	</listener> +	<servlet> +		<!-- +			This servlet accepts HTTP(S) Security Layer requests and redirects to +			UIServlet. +		--> +		<servlet-name>HTTPSecurityLayerServlet</servlet-name> +		<servlet-class>at.gv.egiz.bku.online.webapp.WebRequestHandler</servlet-class> +		<init-param> +			<param-name>protocol</param-name> +			<param-value>HTTP</param-value> +		</init-param> +	</servlet> +	<servlet> +		<!-- +			This Servlet handles user interaction. In fact it merely sets some +			request attributes and hands over (forwards) to the requested uiPage +			(e.g. applet.jsp). +		--> +		<servlet-name>UIServlet</servlet-name> +		<servlet-class>at.gv.egiz.bku.online.webapp.UIServlet</servlet-class> +		<init-param> +			<!-- +				The uiPage parameter below specifies the default uiPage, which is +				used if no specific page was requested. +			--> +			<param-name>uiPage</param-name> +			<param-value>applet.jsp</param-value> +		</init-param> +		<init-param> +			<!-- +				If no protocol specific request (e.g. http security layer request) +				is associated with the request to this servlet, a temporary redirect +				to the URL given below is sent to the browser. +			--> +			<param-name>expiredPageUrl</param-name> +			<param-value>expired.jsp</param-value> +		</init-param> +	</servlet> +	<servlet> +		<servlet-name>ResultServlet</servlet-name> +		<servlet-class>at.gv.egiz.bku.online.webapp.ResultServlet</servlet-class> +		<init-param> +			<param-name>responseEncoding</param-name> +			<param-value>UTF-8</param-value> +		</init-param> +		<init-param> +			<!-- +				If no protocol specific request (e.g. http security layer request) +				is associated with the request to this servlet, a temporary redirect +				to the URL given below is sent to the browser. +			--> +			<param-name>expiredPageUrl</param-name> +			<param-value>expired.jsp</param-value> +		</init-param> +	</servlet>  	<servlet> +		<!-- +		 STAL Web Service +		-->  		<servlet-name>STALService</servlet-name>  		<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>  		<load-on-startup>1</load-on-startup>  	</servlet> +	<!--	<servlet>--> +	<!--		<servlet-name>SAMLServlet</servlet-name>--> +	<!--		<servlet-class>at.gv.egiz.bku.online.webapp.WebRequestHandler</servlet-class>	--> +	<!--		<init-param>--> +	<!--			<param-name>protocol</param-name>--> +	<!--			<param-value>SAML</param-value>--> +	<!--		</init-param>--> +	<!--	</servlet>--> +	<!--	<servlet>--> +	<!--		<servlet-name>DataURLServlet</servlet-name>--> +	<!--		<servlet-class>at.gv.egiz.mocca.id.DataURLServerServlet</servlet-class>	--> +	<!--	</servlet>-->  	<servlet-mapping> -		<servlet-name>BKUServlet</servlet-name> +		<servlet-name>HTTPSecurityLayerServlet</servlet-name>  		<url-pattern>/http-security-layer-request</url-pattern>  	</servlet-mapping> -  <servlet-mapping> -    <servlet-name>BKUServlet</servlet-name> -    <url-pattern>/https-security-layer-request</url-pattern> -  </servlet-mapping> -  <servlet-mapping> -    <servlet-name>DataURLServlet</servlet-name> -    <url-pattern>/DataURLServer</url-pattern> -  </servlet-mapping> -  <servlet-mapping> -    <servlet-name>ResultServlet</servlet-name> -    <url-pattern>/bkuResult</url-pattern> -  </servlet-mapping> -  <servlet-mapping> -    <servlet-name>SAMLServlet</servlet-name> -    <url-pattern>/moccaid</url-pattern> -  </servlet-mapping> -  <servlet-mapping> -    <servlet-name>DataURLServlet</servlet-name> -    <url-pattern>/DataURLServer</url-pattern> -  </servlet-mapping> -   - -    <!-- -     |  Configure alternative applet pages that may be requested -     |  via the 'appletPage' form parameter (cf. SLRequestForm.html) -    <servlet> -        <servlet-name>BKUAppletAlternative</servlet-name> -        <jsp-file>/appletAlternative.jsp</jsp-file> -    </servlet--> - -    <!-- -     |  To disable applet caching load the applet via the AppletDispatcher -     |  (cf. applet.jsp) -    <servlet> -        <servlet-name>AppletDispatcher</servlet-name> -        <servlet-class>at.gv.egiz.bku.online.webapp.AppletDispatcher</servlet-class> -    </servlet> -    <servlet-mapping> -      <servlet-name>AppletDispatcher</servlet-name> -      <url-pattern>/applet/dispatch/*</url-pattern> -    </servlet-mapping--> - -	<!--  End BKU Config --> - -  <!-- Begin BKU Web Start Config -   |   (activate 'include-webstart' profile) -  <servlet> -    <servlet-name>JnlpDownloadServlet</servlet-name> -    <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class> -    <init-param> -      <param-name>logLevel</param-name> -      <param-value>DEBUG</param-value> -    </init-param> -    <init-param> -      <param-name>logPath</param-name> -      <param-value>logs/jnlpdownloadservlet.log</param-value> -    </init-param> -  </servlet> - -  <servlet-mapping> -    <servlet-name>JnlpDownloadServlet</servlet-name> -    <url-pattern>/webstart/*</url-pattern> -  </servlet-mapping> -  --> -  <!-- End BKU Web Start Config --> - -    <servlet-mapping> -      <servlet-name>STALService</servlet-name> -      <url-pattern>/stal</url-pattern> -    </servlet-mapping> -    <session-config> -    <session-timeout>5</session-timeout> -  </session-config> -  <welcome-file-list> -    <welcome-file>index.html</welcome-file> -    <welcome-file>index.jsp</welcome-file> -  </welcome-file-list> -</web-app> +	<servlet-mapping> +		<servlet-name>HTTPSecurityLayerServlet</servlet-name> +		<url-pattern>/https-security-layer-request</url-pattern> +	</servlet-mapping> +	<servlet-mapping> +		<servlet-name>UIServlet</servlet-name> +		<url-pattern>/ui</url-pattern> +	</servlet-mapping> +	<servlet-mapping> +		<servlet-name>ResultServlet</servlet-name> +		<url-pattern>/result</url-pattern> +	</servlet-mapping> +	<servlet-mapping> +		<servlet-name>STALService</servlet-name> +		<url-pattern>/stal</url-pattern> +	</servlet-mapping> +	<!--	<servlet-mapping>--> +	<!--		<servlet-name>SAMLServlet</servlet-name>--> +	<!--		<url-pattern>/moccaid</url-pattern>--> +	<!--	</servlet-mapping>--> +	<!--	<servlet-mapping>--> +	<!--		<servlet-name>DataURLServlet</servlet-name>--> +	<!--		<url-pattern>/DataURLServer</url-pattern>--> +	<!--	</servlet-mapping>--> +	<session-config> +		<session-timeout>5</session-timeout> +	</session-config> +	<welcome-file-list> +		<welcome-file>index.html</welcome-file> +		<welcome-file>index.jsp</welcome-file> +	</welcome-file-list> +	<!--  +	Servlet Filter for Request/Session tracking. +	 --> +	<filter> +		<filter-name>RequestIdFilter</filter-name> +		<filter-class>at.gv.egiz.bku.online.webapp.RequestIdFilter</filter-class> +	</filter> +	<filter-mapping> +		<filter-name>RequestIdFilter</filter-name> +		<servlet-name>HTTPSecurityLayerServlet</servlet-name> +	</filter-mapping> +	<filter-mapping> +		<filter-name>RequestIdFilter</filter-name> +		<servlet-name>UIServlet</servlet-name> +	</filter-mapping> +	<filter-mapping> +		<filter-name>RequestIdFilter</filter-name> +		<servlet-name>ResultServlet</servlet-name> +	</filter-mapping> +</web-app>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index eba0ed87..ee1cca2a 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -14,226 +14,199 @@    See the License for the specific language governing permissions and    limitations under the License.  --> -<%@ page language="java" contentType="text/html; charset=UTF-8" -  pageEncoding="UTF-8"  -  import="at.gv.egiz.bku.online.webapp.AppletDispatcher, org.apache.commons.lang.RandomStringUtils, org.apache.commons.lang.StringEscapeUtils" %> - -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%-- + +  This JSP page loads the MOCCA applet into the browser. It is not intended +  to by directly called by the browser, but the UIServlet should be called. +  The UIServlet sets some request attributes and forwards to this page. +   +  The look and behavior of this page and the embedded applet may be  +  customized by a number of parameters handed over in the request. If this +  does not provide enough flexibility you may choose to modify this page +  or provide an alternative customized page. The name of the customized page +  may be specified as parameter in the original request. The UIServlet will +  forward to the given page. +   + --%> +<%-- Applet --%> +<c:set var="defaultWidth" value="190"/> +<c:set var="defaultHeight" value="130"/> +<c:set var="minJavaVersion" value="1.6.0_04"/> +<%-- Images --%> +<c:set var="defaultButtonWidth" value="16"/> +<c:set var="defaultButtonHeight" value="22"/> +<%-- URLs --%> +<c:url value="/applet" var="codebaseUrl"/> +<c:url value="/help/" var="helpUrl"/> +<c:url value="/stal;jsessionid=${requestScope.id}?wsdl" var="wsdlUrl"/> +<c:url value="/result;jsessionid=${requestScope.id}" var="resultUrl"/> +<%-- Messages --%> +<fmt:bundle basename="web"> +<%-- Applet archive and class --%> +<%--  +  Uncomment the following line if you would like to prevent applet caching!  +--%> +<%-- jsp:useBean id="now" class="java.util.Date" scope="request"/ --%> +<c:choose> +  <c:when test="${requestScope.moccaParam.extension == 'activation'}"> +    <c:url var="appletArchive" value="BKUAppletExt-single.jar"> +      <c:if test="${! empty now}"> +        <c:param name="no-cache" value="${now.time}"/> +      </c:if> +    </c:url> +    <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.ActivationApplet.class"/> +  </c:when> +  <c:when test="${requestScope.moccaParam.extension == 'pin'}"> +    <c:url var="appletArchive" value="BKUAppletExt-single.jar"> +      <c:if test="${! empty now}"> +        <c:param name="no-cache" value="${now.time}"/> +      </c:if> +    </c:url> +    <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.PINManagementApplet.class"/> +  </c:when> +  <c:otherwise> +    <c:url var="appletArchive" value="BKUApplet-single.jar"> +      <c:if test="${! empty now}"> +        <c:param name="no-cache" value="${now.time}"/> +      </c:if> +    </c:url> +    <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.BKUApplet.class"/> +  </c:otherwise> +</c:choose> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  <html> -    <head> -        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -        <title>MOCCA Applet</title> -        <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> -        <script type="text/javascript" src="js/deployJava.js"></script> -        <style type="text/css" media="all">@import "css/applet.css";</style> - -        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> -        <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> -        <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> -    </head> -    <% -        String locale = StringEscapeUtils.escapeJavaScript( -            (String) session.getAttribute("locale")); - -        int width = session.getAttribute("appletWidth") == null ? 190 -                : (Integer) session.getAttribute("appletWidth");  -        int height = session.getAttribute("appletHeight") == null ? 130 -                : (Integer) session.getAttribute("appletHeight"); -        String backgroundImg = StringEscapeUtils.escapeJavaScript( -            session.getAttribute("appletBackground") == null  -                ? "../img/chip32.png" -                : (String) session.getAttribute("appletBackground")); -        String backgroundColor = StringEscapeUtils.escapeJavaScript( -            (String) session.getAttribute("appletBackgroundColor")); -        String guiStyle = StringEscapeUtils.escapeJavaScript( -            (String) session.getAttribute("appletGuiStyle")); -         -        String sessionId = StringEscapeUtils.escapeJavaScript(session.getId()); -         -        String extension = (String) session.getAttribute("appletExtension"); -        String appletClass, appletArchive; -        if ("activation".equalsIgnoreCase(extension)) { -            appletArchive = "BKUAppletExt-single"; -            appletClass = "at.gv.egiz.bku.online.applet.ActivationApplet.class"; -        } else if ("pin".equalsIgnoreCase(extension)) { -            appletArchive = "BKUAppletExt-single"; -            appletClass = "at.gv.egiz.bku.online.applet.PINManagementApplet.class"; -        } else { -            appletArchive = "BKUApplet-single"; -            appletClass = "at.gv.egiz.bku.online.applet.BKUApplet.class"; +  <head> +    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> +    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> +    <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> +    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> +    <title><fmt:message key="title"/></title> +    <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> +    <style type="text/css" media="all"> +      root { +        display: block; +      } +      body { +        background: #ffffff; +        padding: 0; +        margin: 0; +        border-style: none; +        width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px; +      } +      #container { +        padding: 0; +        margin: 0; +        width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px; +        background: <c:out value="${requestScope.moccaParam.appletBackgroundColor}" default="#eeeeee"/>; +      } +      #container applet{ +        padding: 0; +        margin: 0; +      } +      .button { +        width: <c:out value="${defaultButtonWidth}px"/>; +        height: <c:out value="${defaultButtonHeight}px"/>; +        text-decoration: none; +        border-style: none; +      } +      #message { +        margin: 0; +        padding: 0.25em 0 0.25em 0; +        clear: both; +      } +      #message p{ +        margin: 0; +        padding: 0.25em 0.5em 0.25em 0.5em; +      } +    </style> +    <script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script> +    <script type="text/javascript"> +      var iframe = (top.location.href != window.location.href); +      var fontSize = 100; +      var width = <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>; +      var height = <c:out value="${requestScope.moccaParam.appletHeight}" default="${defaultHeight}"/>; +      var buttonWidth = <c:out value="${defaultButtonWidth}"/>; +      var buttonHeight = <c:out value="${defaultButtonHeight}"/>; +      var buttons = ["incButton", "decButton", "helpButton"]; +      function focusToBrowser() { +        document.getElementById("focus").focus(); +      } +      function focusToApplet() { +        var applet = document.getElementById("moccaapplet"); +        if (applet != null) { +          applet.getFocusFromBrowser();          } -      -        // disable applet caching -        boolean disableAppletCaching = false; -        String codebase = "applet"; -         -        if (disableAppletCaching)  { -          // run in AppletDispatcher context and -          // append random alphanumeric string to avoid applet caching -          // TODO prepend ../ to all xxxURL applet paramaters  -          codebase += "/" + AppletDispatcher.DISPATCH_CTX; -          String rand = AppletDispatcher.RAND_PREFIX + -                  RandomStringUtils.randomAlphanumeric(16); -          appletArchive += rand; +      } +      function resize(factor) { +        width = Math.ceil(width * factor); +        height = Math.ceil(height * factor); +        var container = document.getElementById("container"); +        if (container != null) { +          container.style.width = width + "px";          } - -    %> -    <body id="appletpage" style="width:<%=width%>px"> - - -	<div id="container" style="float: left; width: <%= width %>"> -		 -		  <form name="increaseform" action="javascript:increaseSize()" method="get"> - -			<!-- increase font size image --> -			<input type="image" src="img/inc.png" alt="Text vergrößern" width="13px" height="18px" style="float: left;" id="increase_image"/> - -		  </form> - - -		  <form name="decreaseform" action="javascript:decreaseSize()" method="get"> - -			<!-- decrease font size image --> -			<input type="image" src="img/dec.png" alt="Text verkleinern" width="13px" height="18px" style="float: left;" id="decrease_image"/>		 - -		  </form> -		 - -		 -		  <form name="helpform" action="help/index.html" method="get" target="_new" -				onsubmit="this.action=document.moccaapplet.getHelpURL(); this.submit(); return false;"> - -			<!-- invisible input --> -			<input type="image" src="img/help.png" alt=" " width="0px" height="0px" style="float: left;" onFocus="focusToApplet()"/> - -			<!-- help image --> -			<input type="image" src="img/help.png" alt="Hilfe" width="13px" height="18px" style="float: right;" id="helpimage"/> -    	 -	   -	  </form> -	   -	 -	   -      <script type="text/javascript"> - -        if (!deployJava.versionCheck('1.6.0_04+')) { -          document.write('<p>Diese Anwendung benötigt Version 6 Update 4 oder höher der <a href="" onclick="deployJava.installLatestJRE();">Java™ Laufzeitumgebung</a>.</p>'); +        var applet = document.getElementById("moccaapplet"); +        if (applet != null) { +          applet.width = width; +          applet.height = height; +        } +        buttonWidth = Math.ceil(buttonWidth * factor); +        buttonHeight = Math.ceil(buttonHeight * factor); +        for (var b in buttons) { +          var button = document.getElementById(buttons[b]); +          if (button != null) { +            button.style.width = buttonWidth + "px"; +            button.style.height = buttonHeight + "px"; +          } +        } +        fontSize *= factor; +        document.body.style.fontSize = fontSize + "%"; +      } +    </script> +    </head> +    <body> +      <div id="container"> +        <a href="#" id="focus" onclick="resize(1.2); return false;" style="float: left;"><img alt="<fmt:message key="incTextSize"/>" src="img/inc.png" id="incButton" class="button"></a> +        <a href="#" onclick="resize(1/1.2); return false;" style="float: left;"><img alt="<fmt:message key="decTextSize"/>" src="img/dec.png" id="decButton" class="button"></a> +        <a href="<c:out value="${helpUrl}"/>" onclick="this.href = document.moccaapplet.getHelpURL(); return true;" target="_new" style="float: right;"><img alt="<fmt:message key="help"/>" src="img/help.png" id="helpButton" class="button"></a> +        <div id="message" style="display: none;"> +          <p><fmt:message key="javaPluginRequired"/></p> +          <p style="text-align: right;"> +            <a style="width: 90%; font-size: 100%" href="http://www.java.com" onclick="deployJava.installLatestJRE(); return false;"><fmt:message key="installJava"/></a> +          </p> +        </div><script type="text/javascript"> +        if (iframe) { +          document.getElementById("buttons").style.visibility = "hidden"; +        } +        if (!deployJava.versionCheck('<c:out value="${minJavaVersion}+"/>')) { +          document.getElementById("message").style.display = "block";          } else {            var attributes = { -            codebase :'<%=codebase%>', -            code : '<%=appletClass%>', -            archive : '<%=appletArchive +".jar"%>', -            width : <%=width%>, -            height :<%=height%>, +            codebase :'<c:out value="${codebaseUrl}"/>', +            code : '<c:out value="${appletClass}"/>', +            archive : '<c:out value="${appletArchive}"/>', +            width : <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>, +            height : <c:out value="${requestScope.moccaParam.appletHeight}" default="${defaultHeight}"/>,              name : 'moccaapplet',              id : 'moccaapplet'            };            var parameters = { -            GuiStyle : '<%=guiStyle%>', -            Locale : '<%=locale%>', -            Background : '<%=backgroundImg%>', -            BackgroundColor : '<%=backgroundColor%>', -            WSDL_URL : '../stal;jsessionid=<%=sessionId%>?wsdl', -            HelpURL : 'help/', -            SessionID : '<%=sessionId%>', -            RedirectURL : '../bkuResult', +            GuiStyle : '<c:out value="${requestScope.moccaParam.guiStyle}" default="simple"/>', +            Locale : '<c:out value="${requestScope.moccaParam.locale}" default=""/>', +            Background : '<c:out value="${requestScope.moccaParam.appletBackground}" default=""/>', +            BackgroundColor : '<c:out value="${requestScope.moccaParam.appletBackgroundColor}" default="#eeeeee"/>', +            WSDL_URL : '<c:out value="${wsdlUrl}"/>', +            HelpURL : '<c:out value="${helpUrl}"/>', +            SessionID : '<c:out value="${requestScope.id}"/>', +            RedirectURL : '<c:out value="${resultUrl}"/>',              RedirectTarget: '_parent',              EnforceRecommendedPINLength: 'true'            }; -          deployJava.runApplet(attributes, parameters, '1.6.0_04'); +          deployJava.runApplet(attributes, parameters, '<c:out value="${minJavaVersion}"/>');          } -				 -      </script> - -		 - -	  </div> -	   -    </body> -     -    <script> - - -     -		function focusToBrowser() { -	 -			// put focus to window -			// focus can be assigned to any focusable field on the embedding website -			 -			//alert("Put focus to browser.."); -			//self.focus(); -			document.getElementById("helpimage").focus(); -	 -		} -     -		function focusToApplet() { -			 -			//alert('try to set focus to applet'); -			if (document != null && document.moccaapplet != null) { -	 -				//alert('set focus to applet.'); -				document.moccaapplet.getFocusFromBrowser();						 -				return true;					 -			} -		} - - -		function increaseSize() { - -			var appwidth = document.moccaapplet.width; -			var appheight = document.moccaapplet.height; - -			document.moccaapplet.width = (appwidth * 1.2); -	    	document.moccaapplet.height = (appheight * 1.2); -			 -			document.getElementById("container").style.width = (appwidth * 1.2); -			 -			// TODO: This does not work in firefox, seems that width and height attributes cannot be read -			//       and set from input of type image -			var image_width = document.getElementById("increase_image").width; -			var image_height = document.getElementById("increase_image").height; - - -			document.getElementById("helpimage").width = (image_width * 1.2); -			document.getElementById("helpimage").height = (image_height * 1.2); - -			document.getElementById("increase_image").width = (image_width * 1.2); -			document.getElementById("increase_image").height = (image_height * 1.2); - -			document.getElementById("decrease_image").width = (image_width * 1.2); -			document.getElementById("decrease_image").height = (image_height * 1.2); - - -		} - -		function decreaseSize() { - -			var appwidth = document.moccaapplet.width; -			var appheight = document.moccaapplet.height; - -			document.moccaapplet.width = (appwidth * 0.8333333333333); -	    	document.moccaapplet.height = (appheight * 0.8333333333333); - -			document.getElementById("container").style.width = (appwidth * 0.8333333333333); - -			// TODO: This does not work in firefox, seems that width and height attributes cannot be read -			//       and set from input of type image -			var image_width = document.getElementById("increase_image").width; -			var image_height = document.getElementById("increase_image").height; - - -			document.getElementById("helpimage").width = (image_width * 0.8333333333333); -			document.getElementById("helpimage").height = (image_height * 0.8333333333333); - -			document.getElementById("increase_image").width = (image_width * 0.8333333333333); -			document.getElementById("increase_image").height = (image_height * 0.8333333333333); - -			document.getElementById("decrease_image").width = (image_width * 0.8333333333333); -			document.getElementById("decrease_image").height = (image_height * 0.8333333333333); - - -		} - -    </script> -     +      </script></div> +  </body>  </html> +</fmt:bundle>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/css/applet.css b/BKUOnline/src/main/webapp/css/applet.css deleted file mode 100644 index d2c734a1..00000000 --- a/BKUOnline/src/main/webapp/css/applet.css +++ /dev/null @@ -1,15 +0,0 @@ -root {  -    display: block; -} - -body { -    background: #ffffff; -    /*background-image: url(../img/mocca-t_s.png);*/ -    padding: 0; -    margin: 0; -    border-style: none; -    /* -    width:<%=width%> -    */ -} - diff --git a/BKUOnline/src/main/webapp/css/appletAlternative.css b/BKUOnline/src/main/webapp/css/appletAlternative.css deleted file mode 100644 index ce11f1b2..00000000 --- a/BKUOnline/src/main/webapp/css/appletAlternative.css +++ /dev/null @@ -1,12 +0,0 @@ -root {  -    display: block; -} - -body { -    background: #ffffff; -    background-image: url(../img/mocca-t_s.png); -    padding: 0; -    margin: 0; -    border-style: none; -} - diff --git a/BKUOnline/src/main/webapp/expired.html b/BKUOnline/src/main/webapp/expired.jsp index 2bb961f5..d7a8d7e6 100644 --- a/BKUOnline/src/main/webapp/expired.html +++ b/BKUOnline/src/main/webapp/expired.jsp @@ -14,16 +14,18 @@    See the License for the specific language governing permissions and    limitations under the License.  --> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%-- Messages --%> +<fmt:bundle basename="web">  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  <html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<title>Session Expired</title> -</head> -<body> -    <p> -    Ihre Sitzung ist abgelaufen.  -    <!--Ein neuer BKU request kann im <a href="HTTP-ohne.html">Requestformular</a> erstellt werden.--> -    </p> -</body> -</html>
\ No newline at end of file +  <head> +    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +    <title><fmt:message key="expiredTitle"/></title> +  </head> +  <body> +    <p><fmt:message key="expiredMessage"/></p> +  </body> +</html> +</fmt:bundle>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/img/dec.png b/BKUOnline/src/main/webapp/img/dec.pngBinary files differ index 87693cf4..c0b85e84 100644 --- a/BKUOnline/src/main/webapp/img/dec.png +++ b/BKUOnline/src/main/webapp/img/dec.png diff --git a/BKUOnline/src/main/webapp/img/help.png b/BKUOnline/src/main/webapp/img/help.pngBinary files differ index 5d6da3bf..ecb36e63 100644 --- a/BKUOnline/src/main/webapp/img/help.png +++ b/BKUOnline/src/main/webapp/img/help.png diff --git a/BKUOnline/src/main/webapp/img/inc.png b/BKUOnline/src/main/webapp/img/inc.pngBinary files differ index 26e58b80..960f710d 100644 --- a/BKUOnline/src/main/webapp/img/inc.png +++ b/BKUOnline/src/main/webapp/img/inc.png diff --git a/BKUOnline/src/main/webapp/js/deployJava_orig.js b/BKUOnline/src/main/webapp/js/deployJava_orig.js deleted file mode 100644 index 316fa278..00000000 --- a/BKUOnline/src/main/webapp/js/deployJava_orig.js +++ /dev/null @@ -1,725 +0,0 @@ -/* - * Copyright (c)  2008 Sun Microsystems, Inc.  All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - *   - Redistributions of source code must retain the above copyright - *     notice, this list of conditions and the following disclaimer. - * - *   - Redistributions in binary form must reproduce the above copyright - *     notice, this list of conditions and the following disclaimer in the - *     documentation and/or other materials provided with the distribution. - * - *   - Neither the name of Sun Microsystems nor the names of its - *     contributors may be used to endorse or promote products derived - *     from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Added by EGIZ: - * This file contains workarounds to - * [#423] Firefox 3.0.11 bug #498132 causes applet loading failure - *   (lines 95-99) - * [#424] Web Start loading via java plugin (Sun deployment script) fails on WinXP/Vista - *   (lines 501-506) - * - * features: - * [#425] Disable WebStart Launch Button for MacOS - *   (lines 492-504) - * - */ - -/* - * deployJava.js - * - * This file is part of the Deployment Toolkit.  It provides functions for web - * pages to detect the presence of a JRE, install the latest JRE, and easily run - * applets or Web Start programs.  Usage guide may be found at http://<TBD>/. - * - * The "live" copy of this file may be found at - * http://java.com/js/deployJava.js. - * You are encouraged to link directly to the live copy of the file. - * - * @version @(#)deployJava.js	XXXXX - */ - -var deployJava={ -  debug:null, - -  myInterval:null, -  preInstallJREList:null, -  returnPage:null, -  brand:null, -  locale:null, -  installType:null, - -  EAInstallEnabled:false, -  EarlyAccessURL:null, - -    // GetJava page -  getJavaURL:'http://java.sun.com/webapps/getjava/BrowserRedirect?host=java.com', - -    // Apple redirect page -  appleRedirectPage:'http://www.apple.com/support/downloads/', -  oldMimeType:'application/npruntime-scriptable-plugin;DeploymentToolkit', -  mimeType:'application/java-deployment-toolkit', -  launchButtonPNG:'http://java.sun.com/products/jfc/tsc/articles/swing2d/webstart.png', - -  getJREs:function(){ -    var list=new Array(); -    if(deployJava.isPluginInstalled()){ -      var plugin=deployJava.getPlugin(); -      var VMs=plugin.jvms; -      for(var i=0;i<VMs.getLength();i++){ -        list[i]=VMs.get(i).version; -      } -      }else{ -      var browser=deployJava.getBrowser(); - -      if(browser=='MSIE'){ -        if(deployJava.testUsingActiveX('1.8.0')){ -          list[0]='1.8.0'; -        }else if(deployJava.testUsingActiveX('1.7.0')){ -          list[0]='1.7.0'; -        }else if(deployJava.testUsingActiveX('1.6.0')){ -          list[0]='1.6.0'; -        }else if(deployJava.testUsingActiveX('1.5.0')){ -          list[0]='1.5.0'; -        }else if(deployJava.testUsingActiveX('1.4.2')){ -          list[0]='1.4.2'; -        }else if(deployJava.testForMSVM()){ -          list[0]='1.1'; -        } -        } -      else if(browser=='Netscape Family'){ -        if(deployJava.testUsingMimeTypes('1.8')){ -          list[0]='1.8.0'; -        }else if(deployJava.testUsingMimeTypes('1.7')){ -          list[0]='1.7.0'; -        }else if(deployJava.testUsingMimeTypes('1.6')){ -          list[0]='1.6.0'; -        }else if(deployJava.testUsingMimeTypes('1.5')){ -          list[0]='1.5.0'; -        }else if(deployJava.testUsingMimeTypes('1.4.2')){ -          list[0]='1.4.2'; -        } -        }else if(browser=='Safari'){ -        if(deployJava.testUsingPluginsArray('1.8.0')){ -          list[0]='1.8.0'; -        }else if(deployJava.testUsingPluginsArray('1.7.0')){ -          list[0]='1.7.0'; -        }else if(deployJava.testUsingPluginsArray('1.6.0')){ -          list[0]='1.6.0'; -        }else if(deployJava.testUsingPluginsArray('1.5.0')){ -          list[0]='1.5.0'; -        }else if(deployJava.testUsingPluginsArray('1.4.2')){ -          list[0]='1.4.2'; -        } -        } -      } - -    if(deployJava.debug){ -      for(var i=0;i<list.length;++i){ -        alert('We claim to have detected Java SE '+list[i]); -      } -      } - -    return list; -  }, - -  installJRE:function(requestVersion){ -    var ret=false; -    if(deployJava.isPluginInstalled()){ -      if(deployJava.getPlugin().installJRE(requestVersion)){ -        deployJava.refresh(); -        if(deployJava.returnPage!=null){ -          document.location=deployJava.returnPage; -        } -        return true; -      }else{ -        return false; -      } -      }else{ -      return deployJava.installLatestJRE(); -    } -    }, - -  installLatestJRE:function(){ -    if(deployJava.isPluginInstalled()){ -      if(deployJava.getPlugin().installLatestJRE()){ -        deployJava.refresh(); -        if(deployJava.returnPage!=null){ -          document.location=deployJava.returnPage; -        } -        return true; -      }else{ -        return false; -      } -      }else{ -      var browser=deployJava.getBrowser(); -      var platform=navigator.platform.toLowerCase(); -      if((deployJava.EAInstallEnabled=='true') && -         (platform.indexOf('win')!=-1) && -         (deployJava.EarlyAccessURL!=null)) { - -        deployJava.preInstallJREList=deployJava.getJREs(); -        if(deployJava.returnPage!=null){ -          deployJava.myInterval= -            setInterval("deployJava.poll()",3000); -        } - -        location.href=deployJava.EarlyAccessURL; -        return false; -      }else{ -        if(browser=='MSIE'){ -          return deployJava.IEInstall(); -        }else if((browser=='Netscape Family')&& -          (platform.indexOf('win32')!=-1)){ -          return deployJava.FFInstall(); -        }else{ -          location.href=deployJava.getJavaURL+ -          ((deployJava.returnPage!=null)? -          ('&returnPage='+deployJava.returnPage):'')+ -          ((deployJava.locale!=null)? -          ('&locale='+deployJava.locale):'')+ -          ((deployJava.brand!=null)? -          ('&brand='+deployJava.brand):''); -        } -        return false; -      } -      } -    }, - -  runApplet:function(attributes,parameters,minimumVersion){ -    if(minimumVersion=='undefined'||minimumVersion==null){ -      minimumVersion='1.1'; -    } - -    var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; - -    var matchData=minimumVersion.match(regex); - -    if(deployJava.returnPage==null){ -      deployJava.returnPage=document.location; -    } - -    if(matchData!=null){ -      var browser=deployJava.getBrowser(); -      if((browser!='?')&&(browser!='Safari')){ -        if(deployJava.versionCheck(minimumVersion+'+')){ -          deployJava.writeAppletTag(attributes,parameters); -        }else if(deployJava.installJRE(minimumVersion+'+')){ -          deployJava.refresh(); -          location.href=document.location; -          deployJava.writeAppletTag(attributes,parameters); -        } -        }else{ -        deployJava.writeAppletTag(attributes,parameters); -      } -      }else{ -      if(deployJava.debug){ -        alert('Invalid minimumVersion argument to runApplet():'+ -          minimumVersion); -      } -      } -    }, - -  writeAppletTag:function(attributes,parameters){ -    var s='<'+'applet '; -    for(var attribute in attributes){ -      s+=(' '+attribute+'="'+attributes[attribute]+'"'); -    } -    s+='>'; -    document.write(s); - -    if(parameters!='undefined'&¶meters!=null){ -      var codebaseParam=false; -      for(var parameter in parameters){ -        if(parameter=='codebase_lookup'){ -          codebaseParam=true; -        } -        s='<param name="'+parameter+'" value="'+ -        parameters[parameter]+'">'; -      document.write(s); -      } -      if(!codebaseParam){ -        document.write('<param name="codebase_lookup" value="false">'); -      } -      } -    document.write('<'+'/'+'applet'+'>'); -  }, - -  versionCheck:function(versionPattern) - -  { -    var index=0; -    var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$"; - -    var matchData=versionPattern.match(regex); - -    if(matchData!=null){ -      var familyMatch=true; - -      var patternArray=new Array(); - -      for(var i=1;i<matchData.length;++i){ -        if((typeof matchData[i]=='string')&&(matchData[i]!='')){ -          patternArray[index]=matchData[i]; -          index++; -        } -        } - -      if(patternArray[patternArray.length-1]=='+'){ -        familyMatch=false; -        patternArray.length--; -      }else{ -        if(patternArray[patternArray.length-1]=='*'){ -          patternArray.length--; -        } -        } - -      var list=deployJava.getJREs(); -      for(var i=0;i<list.length;++i){ -        if(deployJava.compareVersionToPattern(list[i],patternArray, -        familyMatch)){ -          return true; -        } -        } - -      return false; -    }else{ -      alert('Invalid versionPattern passed to versionCheck: '+ -        versionPattern); -      return false; -    } -    }, - -  isWebStartInstalled:function(minimumVersion){ - -    var browser=deployJava.getBrowser(); -    if((browser=='?')||(browser=='Safari')){ -      return true; -    } - -    if(minimumVersion=='undefined'||minimumVersion==null){ -      minimumVersion='1.4.2'; -    } - -    var retval=false; -    var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; -    var matchData=minimumVersion.match(regex); - -    if(matchData!=null){ -      retval=deployJava.versionCheck(minimumVersion+'+'); -    }else{ -      if(deployJava.debug){ -        alert('Invalid minimumVersion argument to isWebStartInstalled(): '+minimumVersion); -      } -      retval=deployJava.versionCheck('1.4.2+'); -    } -    return retval; -  }, - -  createWebStartLaunchButton:function(jnlp,minimumVersion){ -     -    if(deployJava.returnPage==null){ -      deployJava.returnPage=jnlp; -    } -    var url='javascript:'+'if (!deployJava.isWebStartInstalled("'+ -    minimumVersion+'")) {'+'if (deployJava.installLatestJRE()) {'+'if (deployJava.launch("'+jnlp+'")) {}'+'}'+'} else {'+'if (deployJava.launch("'+jnlp+'")) {}'+'}';document.write('<'+'a href="'+url+'" onMouseOver="window.status=\'\'; '+'return true;"><'+'img '+'src="'+deployJava.launchButtonPNG+'" '+'border="0" /><'+'/'+'a'+'>'); -  }, - -  launch:function(jnlp){ -    if(deployJava.isPluginInstalled()){ -      return deployJava.getPlugin().launch(jnlp); -    }else{ -      document.location=jnlp;return true; -    } -    }, - -  isPluginInstalled:function(){ -    var plugin=deployJava.getPlugin(); -    if(plugin&&plugin.jvms){ -      return true; -    }else{ -      return false; -    } -    }, - -  isAutoUpdateEnabled:function(){ -    if(deployJava.isPluginInstalled()){ -      return deployJava.getPlugin().isAutoUpdateEnabled(); -    } -    return false; -  }, - -  setAutoUpdateEnabled:function(){ -    if(deployJava.isPluginInstalled()){ -      return deployJava.getPlugin().setAutoUpdateEnabled(); -    } -    return false; -  }, - -  setInstallerType:function(type){ -    deployJava.installType=type; -    if(deployJava.isPluginInstalled()){ -      return deployJava.getPlugin().setInstallerType(type); -    } -    return false; -  }, - -  setAdditionalPackages:function(packageList){ -    if(deployJava.isPluginInstalled()){ -      return deployJava.getPlugin().setAdditionalPackages( -      packageList); -    } -    return false; -  }, - -  setEarlyAccess:function(enabled){ -    deployJava.EAInstallEnabled=enabled; -  }, - -  isPlugin2:function(){ -    if(deployJava.isPluginInstalled()){ -      if(deployJava.versionCheck('1.6.0_10+')){ -        try{ -          return deployJava.getPlugin().isPlugin2(); -        }catch(err){ - -        } -        } -      } -    return false; -  }, - - -  getPlugin:function(){ -    deployJava.refresh(); -    var ret=document.getElementById('deployJavaPlugin'); -    return ret; -  }, - -  compareVersionToPattern:function(version,patternArray,familyMatch){ -    var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; -    var matchData=version.match(regex); - -    if(matchData!=null){ -      var index=0; -      var result=new Array(); - -      for(var i=1;i<matchData.length;++i){ -        if((typeof matchData[i]=='string')&&(matchData[i]!='')) -        { -          result[index]=matchData[i]; -          index++; -        } -        } - -      var l=Math.min(result.length,patternArray.length); - -      if(familyMatch){ -        for(var i=0;i<l;++i){ -          if(result[i]!=patternArray[i])return false; -        } - -        return true; -      }else{ -        for(var i=0;i<l;++i){ -          if(result[i]<patternArray[i]){ -            return false; -          }else if(result[i]>patternArray[i]){ -            return true; -          } -          } - -        return true; -      } -      }else{ -      return false; -    } -    }, - - -  getBrowser:function(){ -    var browser=navigator.userAgent.toLowerCase(); - -    if(deployJava.debug){ -      alert('userAgent -> '+browser); -    } - -    if((navigator.vendor)&& -      (navigator.vendor.toLowerCase().indexOf('apple')!=-1)&& -      (browser.indexOf('safari')!=-1)){ -      if(deployJava.debug){ -        alert('We claim to have detected "Safari".'); -      } -      return'Safari'; -    }else if(browser.indexOf('msie')!=-1){ -      if(deployJava.debug){ -        alert('We claim to have detected "IE".'); -      } -      return'MSIE'; -    }else if((browser.indexOf('mozilla')!=-1)|| -      (browser.indexOf('firefox')!=-1)){ -      if(deployJava.debug){ -        alert('We claim to have detected a Netscape family browser.'); -      } -      return'Netscape Family'; -    }else{ -      if(deployJava.debug){ -        alert('We claim to have failed to detect a browser.'); -      } -      return'?'; -    } -    }, - - -  testUsingActiveX:function(version){ -    var objectName='JavaWebStart.isInstalled.'+version+'.0'; - -    if(!ActiveXObject){ -      if(deployJava.debug){ -        alert('Browser claims to be IE, but no ActiveXObject object?'); -      } -      return false; -    } - -    try{ -      return(new ActiveXObject(objectName)!=null); -    }catch(exception){ -      return false; -    } -    }, - - -  testForMSVM:function(){ -    var clsid='{08B0E5C0-4FCB-11CF-AAA5-00401C608500}'; - -    if(typeof oClientCaps!='undefined'){ -      var v=oClientCaps.getComponentVersion(clsid,"ComponentID"); -      if((v=='')||(v=='5,0,5000,0')){ -        return false; -      }else{ -        return true; -      } -      }else{ -      return false; -    } -    }, - - -  testUsingMimeTypes:function(version){ -    if(!navigator.mimeTypes){ -      if(deployJava.debug){ -        alert('Browser claims to be Netscape family, but no mimeTypes[] array?'); -      } -      return false; -    } - -    for(var i=0;i<navigator.mimeTypes.length;++i){ -      s=navigator.mimeTypes[i].type; -      var m=s.match(/^application\/x-java-applet\x3Bversion=(1\.8|1\.7|1\.6|1\.5|1\.4\.2)$/); -      if(m!=null){ -        if(deployJava.compareVersions(m[1],version)){ -          return true; -        } -        } -      } -    return false; -  }, - - -  testUsingPluginsArray:function(version){ -    if((!navigator.plugins)||(!navigator.plugins.length)){ -      return false; -    } -    var platform=navigator.platform.toLowerCase(); -    for(var i=0;i<navigator.plugins.length;++i){ -      s=navigator.plugins[i].description; - -      if(s.search(/^Java Switchable Plug-in (Cocoa)/)!=-1){ -        if(deployJava.compareVersions("1.5.0",version)){ -          return true; -        } -        }else if(s.search(/^Java/)!=-1){ -        if(platform.indexOf('win')!=-1){ -          if(deployJava.compareVersions("1.5.0",version)||deployJava.compareVersions("1.6.0",version)){ -            return true; -          } -          } -        } -      } -    if(deployJava.compareVersions("1.5.0",version)){ -      return true; -    } -    return false; -  }, - -  IEInstall:function(){ - -    location.href=deployJava.getJavaURL+ -    ((deployJava.returnPage!=null)? -    ('&returnPage='+deployJava.returnPage):'')+ -    ((deployJava.locale!=null)? -    ('&locale='+deployJava.locale):'')+ -    ((deployJava.brand!=null)?('&brand='+deployJava.brand):'')+ -    ((deployJava.installType!=null)? -    ('&type='+deployJava.installType):''); -  return false; -  }, - -  done:function(name,result){ -  }, - -  FFInstall:function(){ - -    location.href=deployJava.getJavaURL+ -    ((deployJava.returnPage!=null)? -    ('&returnPage='+deployJava.returnPage):'')+ -    ((deployJava.locale!=null)? -    ('&locale='+deployJava.locale):'')+ -    ((deployJava.brand!=null)?('&brand='+deployJava.brand):'')+ -    ((deployJava.installType!=null)? -    ('&type='+deployJava.installType):''); -  return false; -  }, - -  compareVersions:function(installed,required){ - -    var a=installed.split('.'); -    var b=required.split('.'); - -    for(var i=0;i<a.length;++i){ -      a[i]=Number(a[i]); -    } -    for(var i=0;i<b.length;++i){ -      b[i]=Number(b[i]); -    } -    if(a.length==2){ -      a[2]=0; -    } - -    if(a[0]>b[0])return true; -    if(a[0]<b[0])return false; - -    if(a[1]>b[1])return true; -    if(a[1]<b[1])return false; - -    if(a[2]>b[2])return true; -    if(a[2]<b[2])return false; - -    return true; -  }, - - -  enableAlerts:function(){ -    deployJava.debug=true; -  }, - -  poll:function(){ - -    deployJava.refresh(); -    var postInstallJREList=deployJava.getJREs(); - -    if((deployJava.preInstallJREList.length==0)&& -      (postInstallJREList.length!=0)){ -      clearInterval(deployJava.myInterval); -      if(deployJava.returnPage!=null){ -        location.href=deployJava.returnPage; -      }; -    } - -    if((deployJava.preInstallJREList.length!=0)&& -      (postInstallJREList.length!=0)&& -      (deployJava.preInstallJREList[0]!=postInstallJREList[0])){ -      clearInterval(deployJava.myInterval); -      if(deployJava.returnPage!=null){ -        location.href=deployJava.returnPage; -      } -      } - -    }, - -  writePluginTag:function(){ -    var browser=deployJava.getBrowser(); -    if(browser=='MSIE'){ -      document.write('<'+ -        'object classid="clsid:CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA" '+ -        'id="deployJavaPlugin" width="0" height="0">'+ -        '<'+'/'+'object'+'>'); -    }else if(browser=='Netscape Family'){ -      deployJava.writeEmbedTag(); -    } -    }, - -  refresh:function(){ -    navigator.plugins.refresh(false);var browser=deployJava.getBrowser();if(browser=='Netscape Family'){ -      var plugin=document.getElementById('deployJavaPlugin');if(plugin==null){ -        deployJava.writeEmbedTag(); -      } -      } -    }, - -  writeEmbedTag:function(){ -    var written=false;if(navigator.mimeTypes!=null){ -      for(var i=0;i<navigator.mimeTypes.length;i++){ -        if(navigator.mimeTypes[i].type==deployJava.mimeType){ -          if(navigator.mimeTypes[i].enabledPlugin){ -            document.write('<'+'embed id="deployJavaPlugin" type="'+ -              deployJava.mimeType+'" hidden="true" />');written=true; -          } -          } -        } -      if(!written)for(var i=0;i<navigator.mimeTypes.length;i++){ -        if(navigator.mimeTypes[i].type==deployJava.oldMimeType){ -          if(navigator.mimeTypes[i].enabledPlugin){ -            document.write('<'+'embed id="deployJavaPlugin" type="'+ -              deployJava.oldMimeType+'" hidden="true" />'); -          } -          } -        } -      } -    }, -     -  do_initialize:function(){ -    deployJava.writePluginTag(); -    if(deployJava.locale==null){ -      var loc=null; - -      if(loc==null)try{ -        loc=navigator.userLanguage; -      }catch(err){} - -      if(loc==null)try{ -        loc=navigator.systemLanguage; -      }catch(err){} - -      if(loc==null)try{ -        loc=navigator.language; -      }catch(err){} - -      if(loc!=null){ -        loc.replace("-","_") -        deployJava.locale=loc; -      } -      } -    } - -  }; -  deployJava.do_initialize(); - diff --git a/BKUOnline/src/main/webapp/local.jsp b/BKUOnline/src/main/webapp/local.jsp index 48d62674..16e408c0 100644 --- a/BKUOnline/src/main/webapp/local.jsp +++ b/BKUOnline/src/main/webapp/local.jsp @@ -14,50 +14,66 @@    See the License for the specific language governing permissions and    limitations under the License.  --> -<%@ page language="java" contentType="text/html; charset=UTF-8" -  pageEncoding="UTF-8"  -  import="at.gv.egiz.bku.online.webapp.AppletDispatcher,org.apache.commons.lang.RandomStringUtils,org.apache.commons.lang.StringEscapeUtils" %> - +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<c:set var="defaultWidth" value="190"/> +<c:set var="defaultHeight" value="130"/> +<%-- URLs --%> +<c:url value="/DataURLServer" var="dataUrl"/> +<%-- Messages --%> +<fmt:bundle basename="web">  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  <html> -   <head> -       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -       <title>MOCCA</title> -       <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> -       <style type="text/css" media="all">@import "css/applet.css";</style> - -       <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> -       <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> -       <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> -   </head> -   <% -     int width = session.getAttribute("appletWidth") == null ? 190 -         : (Integer) session.getAttribute("appletWidth"); -     int height = session.getAttribute("appletHeight") == null ? 130 -         : (Integer) session.getAttribute("appletHeight"); -     String backgroundImg = StringEscapeUtils.escapeJavaScript(session -         .getAttribute("appletBackground") == null ? "../img/chip32.png" -         : (String) session.getAttribute("appletBackground")); -     String backgroundColor = StringEscapeUtils -         .escapeJavaScript((String) session -             .getAttribute("appletBackgroundColor")); - -     String sessionId = StringEscapeUtils.escapeJavaScript(session.getId()); - -     String dataURL = request.getRequestURL().toString(); -     dataURL = dataURL.substring(0, dataURL.lastIndexOf('/')) + "/DataURLServer"; -   %> -   <body id="appletpage" style="width:<%=width%>px;height:<%=height%>px"> -     <div style="width:<%=width%>px;height:<%=height%>px"> -		     <form action="http://127.0.0.1:3495/http-security-layer-request" method="post" enctype="application/x-www-form-urlencoded"> -		       <input name="SessionID_" value="<%=sessionId%>" type="hidden"/> -		       <input name="DataURL" value="<%=dataURL%>" id="DataURL" type="hidden"/> -		       <input name="XMLRequest" value="<NullOperationRequest xmlns='http://www.buergerkarte.at/namespaces/securitylayer/1.2#'/>" type="hidden"/> -		       <p>Anfrage wird an lokale BKU gesendet</p> -           <div style="text-align: center;"> -		        <input type="submit" style="vertical-align: middle"/> -           </div> -		     </form> -     </div> -   </body> +  <head> +    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> +    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> +    <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> +    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> +    <title><fmt:message key="title"/></title> +    <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> +    <style type="text/css" media="all"> +      root { +        display: block; +      } +      body { +        background: #ffffff; +        padding: 0; +        margin: 0; +        width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px; +        height: <c:out value="${requestScope.moccaParam.appletHeight}" default="${defaultHeight}"/>px; +      } +      #container { +        padding: 0; +        margin: 0; +        width: <c:out value="${requestScope.moccaParam.appletWidth}" default="${defaultWidth}"/>px; +        background: <c:out value="${requestScope.moccaParam.appletBackgroundColor}" default="#eeeeee"/>; +      } +      #message { +        margin: 0; +        padding: 0.25em 0 0.25em 0; +        clear: both; +      } +      #message p{ +        margin: 0; +        padding: 0.25em 0.5em 0.25em 0.5em; +      } +    </style> +  </head> +  <body> +    <div id="container"> +      <form action="http://localhost:3495/http-security-layer-request" method="post" enctype="application/x-www-form-urlencoded"> +        <input name="SessionID_" value="${requestScope.id}" type="hidden"/> +        <input name="DataURL" value="${dataUrl}" id="DataURL" type="hidden"/> +        <input name="XMLRequest" value="<NullOperationRequest xmlns='http://www.buergerkarte.at/namespaces/securitylayer/1.2#'/>" type="hidden"/> +        <div id="message"> +          <p><fmt:message key="local"/></p> +          <p style="text-align: right;"> +            <input type="submit" style="vertical-align: middle"/> +          </p> +        </div> +      </form> +    </div> +  </body>  </html> +</fmt:bundle> diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties index 15f5c990..e64a2da4 100644 --- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties @@ -13,9 +13,6 @@  # See the License for the specific language governing permissions and  # limitations under the License. -# To change this template, choose Tools | Templates -# and open the template in the editor. -  dec.pin.name=Geheimhaltungs-PIN  dec.pin.length=0-8  sig.pin.name=Signatur-PIN | 
