From 5e10b6b575993c78ac22191849c464b618c4fa8a Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 14 Jul 2010 15:22:56 +0000 Subject: MOCCA Online HTTP binding refactored. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@762 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/webapp/AppletDispatcher.java | 112 --------------------- 1 file changed, 112 deletions(-) delete mode 100644 BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java (limited to 'BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java') 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 - */ -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 GET and POST 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); - } - - // - /** - * Handles the HTTP GET 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 POST 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"; - }// - -} -- cgit v1.2.3