From 29ad090c29567ff1a4d3a2ec9b8ad0b5d80ee24d Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 6 Dec 2010 16:34:52 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@671 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../servlets/AsynchronousRedirectResponder.java | 184 +++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/AsynchronousRedirectResponder.java (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/AsynchronousRedirectResponder.java') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/AsynchronousRedirectResponder.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/AsynchronousRedirectResponder.java new file mode 100644 index 0000000..80078ed --- /dev/null +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/AsynchronousRedirectResponder.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) 2006 by Know-Center, Graz, Austria + * + * This software is the confidential and proprietary information of Know-Center, + * Graz, Austria. You shall not disclose such Confidential Information and shall + * use it only in accordance with the terms of the license agreement you entered + * into with Know-Center. + * + * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF + * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY + * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. + * + * $Id: AsynchronousRedirectResponder.java,v 1.4 2006/10/11 07:39:13 wprinz Exp $ + */ +package at.gv.egiz.pdfas.web.servlets; + +import javax.servlet.http.HttpServlet; + +/** + * Servlet that responds to the redirect requests of the local service (e.g. + * BKU). + * + * @deprecated remove this + * + * @author wprinz + */ +public class AsynchronousRedirectResponder extends HttpServlet +{ + + /** + * SVUID. + */ + private static final long serialVersionUID = -682360466333727236L; + +// /** +// * The logger definition. +// */ +// private static final Logger logger_ = ConfigLogger.getLogger(AsynchronousRedirectResponder.class); +// +// protected void dispatch(HttpServletRequest request, +// HttpServletResponse response, String resource) throws ServletException, IOException +// { +// response.setContentType("text/html"); +// response.setCharacterEncoding("UTF-8"); +// +// RequestDispatcher disp = getServletContext().getRequestDispatcher(resource); +// disp.forward(request, response); +// } +// +// protected void dispatchToResults(List results, HttpServletRequest request, +// HttpServletResponse response) throws ServletException, IOException +// { +// request.setAttribute("results", results); +// dispatch(request, response, "/jsp/results.jsp"); +// } +// +// protected void dispatchToRedirectRefreshPage (HttpServletRequest request, +// HttpServletResponse response, String refresh_url) throws ServletException, IOException +// { +// request.setAttribute("refresh_url", refresh_url); +// dispatch(request, response, LocalRequestHelper.REDIRECT_REFRESH_PAGE_JSP); +// } +// +// protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException +// { +// logger_.debug("AsyncRedirResp"); +// +// SessionInformation si = null; +// +// HttpSession session = null; +// try +// { +// session = request.getSession(false); +// //String session_id_string = request.getParameter("session"); +// if (session == null) +// { +// throw new ErrorCodeException(600, "The session is missing."); +// } +// +// si = (SessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION); +//// long session_id = Long.parseLong(session_id_string); +//// si = SessionTable.get(session_id); +// if (si == null) +// { +// throw new ErrorCodeException(600, "The session is not found or is no longer valid."); +// } +// +// } +// catch (PresentableException e) +// { +// e.printStackTrace(); +// SignServlet.prepareDispatchToErrorPage(e, request); +// dispatch(request, response, "/jsp/error.jsp"); +// +// return; +// } +// +// try +// { +// if (si.finished == false) +// { +// String url = request.getRequestURL().toString(); +// logger_.debug("RequestURL = " + url); +// String refresh_url = response.encodeURL(url); +// logger_.debug("RefreshURL = " + refresh_url); +// dispatchToRedirectRefreshPage(request, response, refresh_url); +// return; +// } +// +// // si.finished is true, but maybe there are more requests to process. +// if (si.current_operation < si.requests.length) +// { +// si.finished = false; +// +// LocalRequestHelper.prepareDispatchToLocalConnectionPage(si.requests[si.current_operation], request, response); +// dispatch(request, response, LocalRequestHelper.LOCAL_CONNECTION_PAGE_JSP); +// return; +// } +// +// // all requests have been carried out. +// +// BKUConnector local_conn = (BKUConnector) ConnectorFactory.createConnector(si.connector); +// +// if (si.application.equals("verify")) +// { +// List results = new ArrayList(); +// +// for (int i = 0; i < si.response_properties.length; i++) +// { +// SignatureResponse sig_resp = local_conn.analyzeVerifyResponse(si.response_properties[i]); +// results.add(sig_resp); +// } +// +// dispatchToResults(results, request, response); +// } +// else +// { +// //logger_.debug("AsyncRedirResponder: si.response_string[0] = " + si.response_string[0]); +// logger_.debug("AsyncRedirResponder: si.current_op = " + si.current_operation); +// +// // The response string must not be null here - otherwise finished mustn't have been set! +//// if (si.response_string[0] == null) +//// { +//// String url = request.getRequestURL().toString(); +//// logger_.debug("RequestURL = " + url); +//// String refresh_url = response.encodeURL(url); +//// logger_.debug("RefreshURL = " + refresh_url); +//// dispatchToRedirectRefreshPage(request, response, refresh_url); +//// return ; +//// } +// +// // A download blocker may have blocked the first download. +// // So, if the user asks for the document a second time and the sign_result +// // has already been computed - don't recompute it. +// if (si.sign_result == null) +// { +// // refactor WEB +// si.iui.signed_signature_object = null; //local_conn.analyzeSignResponse(si.response_properties[0], si.type); +// +// PdfASID algorithm = FormFields.translateSignatureModeToPdfASID(si.mode); +// Signator signator = SignatorFactory.createSignator(algorithm); +// +// si.sign_result = signator.finishSign(si.iui); +// } +// +// SignServlet.returnSignResponse(si, response); +// } +// +// } +// catch (PresentableException e) +// { +// session.removeAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION); +// //SessionTable.remove(si.session_id); +// +// e.printStackTrace(); +// SignServlet.prepareDispatchToErrorPage(e, request); +// dispatch(request, response, "/jsp/error.jsp"); +// } +// +// } +} -- cgit v1.2.3