Ver código fonte

Initial commit

Tom Flucke 7 anos atrás
commit
10d04690a9
6 arquivos alterados com 351 adições e 0 exclusões
  1. 3 0
      .gitignore
  2. 90 0
      build.xml
  3. 13 0
      ivy.xml
  4. 29 0
      src/name/tflucke/ieat2/AppInitializer.java
  5. 13 0
      src/name/tflucke/ieat2/TestController.java
  6. 203 0
      web.xml

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+build/
+lib/
+interrupt

+ 90 - 0
build.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="ieat2" basedir="." default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
+  <property name="app.name" value="ieat"/>
+   
+  <property name="build.version" value="2.0.0"/>
+  <property name="build.java.version" value="1.8"/>
+  <property name="build.dir" value="build/"/>
+  <property name="build.bootstrap.path" value="/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar"/>
+  <property name="build.lib" value="build/lib/"/>
+  <property name="build.warfile" value="${build.dir}/${app.name}-${build.version}.war"/>
+
+  <property name="web.dir" value="web/"/>
+  <property name="source.dir" value="src/"/>
+  <property name="target.dir" value="${build.dir}/${app.name}/WEB-INF/classes"/>
+  
+  <property name="compile.verbose" value="false"/>
+  <property name="compile.debug" value="true"/>
+  <property name="compile.deprecation" value="true"/>
+  <property name="compile.optimize" value="false"/>
+  <property name="compile.nowarn" value="false"/>
+  <property name="compile.dependencies" value="lib/"/>
+  <property name="compile.include.ant" value="false"/>
+  <path id="compile.classpath">
+	<pathelement location="${target.dir}"/>
+	<fileset dir="${compile.dependencies}" includes="*.jar"/>
+  </path>
+
+  <property name="ant.lib" value="${user.home}/.ant/lib"/>
+  
+  <property name="ivy.signal" value="${ant.lib}/ivy.jar"/>
+  <available property="ivy.installed" file="${ivy.signal}"/>
+  
+  <tstamp>
+	<format property="build.time" pattern="MM/dd/yyyy hh:mm aa z" />
+  </tstamp>
+  
+  <target name="help" description="Display build help">
+	<echo>iEat v${build.version}</echo>
+	<echo>To see list of targets, use ant -p</echo>
+  </target>
+
+  <target name="install.ivy" unless="ivy.installed">
+    <mkdir dir="${ant.lib}"/>
+    <get dest="${ant.lib}/ivy.jar"
+         src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
+  </target>
+
+  <target name="resolve-dependencies" depends="install.ivy" description="Use ivy to resolve dependencies">
+    <ivy:retrieve/>
+  </target>
+
+  <target name="compile" depends="resolve-dependencies" description="Compile source files">
+    <mkdir dir="${target.dir}"/>
+	<javac srcdir="${source.dir}"
+           verbose="${compile.verbose}"
+		   destdir="${target.dir}"
+		   debug="${compile.debug}" 
+		   deprecation="${compile.deprecation}" 
+		   optimize="${compile.optimize}" 
+		   nowarn="${compile.nowarn}"
+           includeantruntime="${compile.include.ant}"
+           bootclasspath="${build.bootstrap.path}"
+		   target="${build.java.version}"
+		   source="${build.java.version}">
+	  <classpath refid="compile.classpath" />
+	</javac>
+  </target>
+  
+  <target name="war" depends="compile" description="Create application WAR">
+	<mkdir dir="${build.dir}"/>
+	<war warfile="${build.warfile}" 
+		 webxml="web.xml">
+      <lib dir="${compile.dependencies}">
+        <exclude name="*sources.jar"/>
+        <exclude name="*javadoc.jar"/>
+      </lib>
+      <classes dir="${target.dir}"/>
+    </war>
+  </target>
+  
+  <target name="clean" description="Delete build files">
+	<delete dir="${build.dir}" />
+  </target>
+
+  <target name="clean.full" depends="clean" description="Delete build files and dependencies">
+	<delete dir="${ivy.signal}" />
+    <ivy:cleancache/>
+  </target>
+</project>

+ 13 - 0
ivy.xml

@@ -0,0 +1,13 @@
+<ivy-module version="2.0">
+  <info organisation="name.tflucke" module="ieat2"/>
+  <configurations defaultconfmapping="runtime->*">
+    <conf name="compile"/>
+    <conf name="test" extends="compile"/>
+  </configurations>
+  <dependencies>
+    <!-- Spring Framework -->
+    <dependency org="commons-logging" name="commons-logging" rev="1.2" conf="compile->*"/>
+    <dependency org="org.springframework" name="spring-web" rev="5.0.9.RELEASE" conf="compile->*"/>
+    <dependency org="org.springframework" name="spring-webmvc" rev="5.0.9.RELEASE" conf="compile->*"/>
+  </dependencies>
+</ivy-module>

+ 29 - 0
src/name/tflucke/ieat2/AppInitializer.java

@@ -0,0 +1,29 @@
+package name.tflucke.ieat2;
+
+import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
+
+    //private static final Log LOGGER = LogFactory.getLog(WebInitializer.class);
+
+    @Override
+    protected Class<?>[] getRootConfigClasses() {
+        /*  this is where you will return you config class
+         *  your root config class should @Import other configs 
+         *  to make them work without needing them to add there
+         */
+        return new Class[] {};
+    }
+
+    @Override
+    protected Class<?>[] getServletConfigClasses() {
+        return new Class[] {TestController.class};
+    }
+
+    @Override
+    protected String[] getServletMappings() {
+        return new String[] { "/" };
+    }
+}

+ 13 - 0
src/name/tflucke/ieat2/TestController.java

@@ -0,0 +1,13 @@
+package name.tflucke.ieat2;
+
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+
+@RestController
+public class TestController {
+    @GetMapping("/echo/{name}")
+    public String echo(@PathVariable("name") String name) {
+        return "Test: " + name;
+    }
+}

+ 203 - 0
web.xml

@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Copyright (c) 2002-2006 Matt Magoffin
+	
+	This program is free software; you can redistribute it and/or 
+	modify it under the terms of the GNU General Public License as 
+	published by the Free Software Foundation; either version 2 of 
+	the License, or (at your option) any later version.
+	
+	This program is distributed in the hope that it will be useful, 
+	but WITHOUT ANY WARRANTY; without even the implied warranty of 
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+	General Public License for more details.
+	
+	You should have received a copy of the GNU General Public License 
+	along with this program; if not, write to the Free Software 
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
+	02111-1307 USA
+	
+	$Id: web.xml,v 1.4 2006/11/28 09:23:25 matt Exp $
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+	     version="5.0">
+  <display-name>Online recipe manager.</display-name>
+  
+  <resource-ref>
+	<res-ref-name>jdbc/ieat</res-ref-name>
+	<res-type>javax.sql.DataSource</res-type>
+	<res-auth>Container</res-auth>
+	<res-sharing-scope>Shareable</res-sharing-scope>
+  </resource-ref>
+
+  <context-param>
+	<param-name>webAppRootKey</param-name>
+	<param-value>ieat.root.dir</param-value>
+  </context-param>
+  
+  <!--
+	  <context-param>
+	  <param-name>log4jConfigLocation</param-name>
+	  <param-value>log4j.properties</param-value>
+	  </context-param>
+  -->
+  
+  <!-- 
+	   Static content client-side cache headers filter
+  -->
+  <!--
+  <filter>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<filter-class>magoffin.matt.xweb.util.ResponseHeaderFilter</filter-class>
+	<init-param>
+	  <param-name>Cache-Control</param-name>
+	  <param-value>max-age=86400</param-value>
+	</init-param>
+  </filter>
+  -->
+  
+  <!-- Compression filter -->
+  <!--
+  <filter>
+	<filter-name>Compression Filter</filter-name>
+	<filter-class>compressionFilters.CompressionFilter</filter-class>
+	<init-param>
+	  <param-name>compressionThreshold</param-name>
+	  <param-value>10</param-value>
+	</init-param>
+	<init-param>
+	  <param-name>debug</param-name>
+	  <param-value>0</param-value>
+	</init-param>
+  </filter>
+-->
+  
+  <!-- Use UTF-8 character encoding -->
+  <!--
+  <filter>
+	<filter-name>Set Character Encoding</filter-name>
+	<filter-class>filters.SetCharacterEncodingFilter</filter-class>
+	<init-param>
+	  <param-name>encoding</param-name>
+	  <param-value>UTF-8</param-value>
+	</init-param>
+  </filter>
+  -->
+  
+  <!-- Cache filter -->
+  <!--
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.js</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.css</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.gif</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.jpg</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.png</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>*.html</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Client-side Cache Headers Filter</filter-name>
+	<url-pattern>/messages.json</url-pattern>
+  </filter-mapping>
+  -->
+  
+  <!-- Compression filter -->
+  <!--
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.css</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.do</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.html</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.js</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.json</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+	<filter-name>Compression Filter</filter-name>
+	<url-pattern>*.txt</url-pattern>
+  </filter-mapping>
+  -->
+  
+  <!--
+  <filter-mapping>
+	<filter-name>Set Character Encoding</filter-name>
+	<servlet-name>ieat</servlet-name>
+  </filter-mapping>
+  -->
+  
+  <!--
+	  <listener>
+	  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+	  </listener>
+  -->
+
+  <!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
+       instead of the default XmlWebApplicationContext -->
+  <context-param>
+    <param-name>contextClass</param-name>
+    <param-value>
+      org.springframework.web.context.support.AnnotationConfigWebApplicationContext
+    </param-value>
+  </context-param>
+
+  <!-- Configuration locations must consist of one or more comma- or space-delimited
+       fully-qualified @Configuration classes. Fully-qualified packages may also
+       be specified for component-scanning -->
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>com.nirav.modi.config.SpringAppConfig</param-value>
+  </context-param>
+
+  <listener>
+	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+
+  <!--
+  <servlet>
+	<servlet-name>ieat</servlet-name>
+	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+	<load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+	<servlet-name>ieat</servlet-name>
+	<url-pattern>*.do</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+	<servlet-name>ieat</servlet-name>
+	<url-pattern>*.json</url-pattern>
+  </servlet-mapping>
+  -->
+
+  <welcome-file-list>
+	<welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+</web-app>