Skip to content
Browse files

initial import

  • Loading branch information...
1 parent cea55e1 commit 77644cd1f4a751aaef215c304a57c8f163ac6dc6 @vardlokkur committed Sep 10, 2011
View
12 pom.xml
@@ -0,0 +1,12 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.blogspot.vardlokkur</groupId>
+ <artifactId>jboss-modules-001</artifactId>
+ <version>1.0.0</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>echo-api</module>
+ <module>echo-module</module>
+ <module>webapp-module</module>
+ </modules>
+</project>
View
23 webapp-module/src/main/java/warlock/EchoController.java
@@ -0,0 +1,23 @@
+package warlock;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import warlock.echo.EchoService;
+
+@Controller
+@RequestMapping("/echo.html")
+public class EchoController {
+
+ @Autowired
+ private EchoService service;
+
+ @RequestMapping(method = RequestMethod.GET)
+ @ResponseBody
+ public String handleGet() {
+ return service.echo("It workzzzzz!");
+ }
+}
View
27 webapp-module/src/main/resources/log4j.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{MM/dd/yy HH:mm:ss}]%-5p:%-40c{4}:%m%n"/>
+ </layout>
+ </appender>
+
+ <logger name="warlock">
+ <level value="DEBUG" />
+ </logger>
+
+ <logger name="org.springframework.web.servlet.view">
+ <level value="WARN" />
+ </logger>
+
+ <root>
+ <priority value="info" />
+ <appender-ref ref="console" />
+ </root>
+
+</log4j:configuration>
+
View
10 webapp-module/src/main/resources/warlock/base-config.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+ <bean class="org.springframework.beans.factory.serviceloader.ServiceFactoryBean">
+ <property name="serviceType" value="warlock.echo.EchoService" />
+ </bean>
+
+</beans>
View
28 webapp-module/src/main/resources/warlock/mvc.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:mvc="http://www.springframework.org/schema/mvc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
+
+ <!--
+ - View Resolver.
+ -->
+ <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+ <property name="contentType" value="text/html;charset=utf-8" />
+ <property name="prefix" value="/WEB-INF/templates/" />
+ <property name="requestContextAttribute" value="requestContext" />
+ <property name="suffix" value=".jsp" />
+ <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
+ </bean>
+
+ <context:component-scan base-package="warlock" />
+
+ <mvc:annotation-driven />
+
+ <mvc:view-controller path="/welcome.html" />
+
+</beans>
View
8 webapp-module/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -0,0 +1,8 @@
+<jboss-deployment-structure>
+ <deployment>
+ <dependencies>
+ <module name="warlock.echo" services="export" />
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
+
View
10 webapp-module/src/main/webapp/WEB-INF/templates/welcome.jsp
@@ -0,0 +1,10 @@
+<%@ page contentType="text/html; charset=utf-8" trimDirectiveWhitespaces="true" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<html>
+ <head>
+ <title>Welcome!</title>
+ </head>
+ <body>
+ <h1>Welcome!</h1>
+ </body>
+</html>
View
54 webapp-module/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,54 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath:warlock/base-config.xml
+ </param-value>
+ </context-param>
+
+ <listener>
+ <description>Bootstrap listener for custom log4j initialization in a web environment.</description>
+ <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+ </listener>
+
+ <listener>
+ <description>Bootstrap listener to start up and shut down Spring's root WebApplicationContext.</description>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>Character Encoding Filter</filter-name>
+ <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+ <init-param>
+ <param-name>encoding</param-name>
+ <param-value>utf-8</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Character Encoding Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>Dispatcher Servlet</servlet-name>
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+ <init-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath:warlock/mvc.xml
+ </param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Dispatcher Servlet</servlet-name>
+ <url-pattern>*.html</url-pattern>
+ </servlet-mapping>
+
+</web-app>

0 comments on commit 77644cd

Please sign in to comment.
Something went wrong with that request. Please try again.