Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial import

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

0 comments on commit 77644cd

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