You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2017/06/19 07:22:26 UTC

svn commit: r1799143 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo: pom.xml src/main/docker/ src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java src/main/webapp/WEB-INF/web.xml

Author: lofwyr
Date: Mon Jun 19 07:22:26 2017
New Revision: 1799143

URL: http://svn.apache.org/viewvc?rev=1799143&view=rev
Log:
Demo: removing prefix "/faces".
* Backward compatible links

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/docker/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml?rev=1799143&r1=1799142&r2=1799143&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/pom.xml Mon Jun 19 07:22:26 2017
@@ -248,7 +248,11 @@
       <artifactId>hibernate-validator</artifactId>
       <version>4.3.2.Final</version>
     </dependency>
-
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore</artifactId>
+      <version>4.4.6</version>
+    </dependency>
     <dependency>
       <groupId>org.jboss.arquillian.junit</groupId>
       <artifactId>arquillian-junit-container</artifactId>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java?rev=1799143&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java Mon Jun 19 07:22:26 2017
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.myfaces.tobago.example.demo;
+
+import org.apache.http.HttpHeaders;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class OldLinksServlet extends HttpServlet {
+
+    private static final Logger LOG = LoggerFactory.getLogger(OldLinksServlet.class);
+
+    protected void doPost(HttpServletRequest request,
+                          HttpServletResponse response)
+            throws ServletException, IOException {
+        doGet(request, response);
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        response.setStatus(HttpServletResponse.SC_FOUND);
+        response.sendRedirect(request.getRequestURI().substring("/faces".length()));
+
+        LOG.warn("Old URI was called: {}", request.getRequestURI(), request.getHeader(HttpHeaders.REFERER));
+    }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml?rev=1799143&r1=1799142&r2=1799143&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml Mon Jun 19 07:22:26 2017
@@ -132,6 +132,16 @@
     <url-pattern>*.xhtml</url-pattern>
   </servlet-mapping>
 
+  <servlet>
+    <servlet-name>OldLinksServlet</servlet-name>
+    <servlet-class>org.apache.myfaces.tobago.example.demo.OldLinksServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>OldLinksServlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+  </servlet-mapping>
+
   <!-- Error handling, see also these classes:
        org.apache.myfaces.tobago.example.demo.TestExceptionHandler
        org.apache.myfaces.tobago.example.demo.DeltaSpikeClientWindowConfig