From 909377f7d9444a4dc863b0bdc4772b0e0134e38c Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 16 Jun 2012 07:26:13 +0000 Subject: [PATCH] =?UTF-8?q?Das=20ServiceServlet=20verarbeitet=20jetzt=20zu?= =?UTF-8?q?s=C3=A4tzlich=20zu=20Links=20der=20Form=20/ccm/cms-service/stre?= =?UTF-8?q?am/asset/=3Fasset=5Fid=3D12345=20bzw.=20/ccm/cms-service/downlo?= =?UTF-8?q?ad/asset/=3Fasset=5Fid=3D12345=20auch=20Links,=20die=20zus?= =?UTF-8?q?=C3=A4tzlich=20den=20Namen=20der=20herzuladenen=20Datei=20entha?= =?UTF-8?q?lten,=20z.B.=20/ccm/cms-service/download/asset/example.pdf/=3Fa?= =?UTF-8?q?sset=5Fid=3D12345?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Name der Datei wird von ServiceServlet ignorniert. git-svn-id: https://svn.libreccm.org/ccm/trunk@1712 8810af33-2d31-482b-a856-94f89814c4df --- .../src/com/arsdigita/cms/ServiceServlet.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java b/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java index ea314e43e..8f819c609 100644 --- a/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java +++ b/ccm-cms/src/com/arsdigita/cms/ServiceServlet.java @@ -124,6 +124,11 @@ public class ServiceServlet extends BaseApplicationServlet { /** * Implements the (abstract) doService method of BaseApplicationServlet to * perform the services. + * @param sreq + * @param sresp + * @param app + * @throws ServletException + * @throws IOException * @see com.arsdigita.web.BaseApplicationServlet#doService * (HttpServletRequest, HttpServletResponse, Application) */ @@ -146,7 +151,7 @@ public class ServiceServlet extends BaseApplicationServlet { // An empty remaining URL or a URL which doesn't end in trailing slash: // probably want to redirect. if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) { - DispatcherHelper.sendRedirect(sresp, originalUrl + "/"); + DispatcherHelper.sendRedirect(sreq, sresp, originalUrl + "/"); return; } @@ -155,6 +160,19 @@ public class ServiceServlet extends BaseApplicationServlet { /* checkUserAccess(request, response, actx); */ ResourceHandler page = getResource(url); + + if (page == null) { + //Retry without last part + final String[] tokens = url.split("/"); + + final StringBuilder altUrlBuilder = new StringBuilder('/'); + for(int i = 0; i < tokens.length - 1; i++) { + altUrlBuilder.append(tokens[i]); + altUrlBuilder.append('/'); + } + page = getResource(altUrlBuilder.toString()); + } + if ( page != null ) { // Serve the page. page.init();