├── .travis.yml ├── .gitignore ├── hello-cdi ├── src │ └── main │ │ ├── webapp │ │ ├── index.jsp │ │ └── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── jboss-web.xml │ │ │ ├── views │ │ │ ├── hello.jsp │ │ │ └── form.jsp │ │ │ └── glassfish-web.xml │ │ ├── resources │ │ └── META-INF │ │ │ └── validation.xml │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── Messages.java │ │ ├── config │ │ └── ApplicationConfig.java │ │ ├── HelloBean.java │ │ ├── HelloForm.java │ │ └── HelloController.java └── pom.xml ├── hello ├── src │ └── main │ │ ├── webapp │ │ ├── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── jboss-web.xml │ │ │ └── views │ │ │ │ ├── hello.jsp │ │ │ │ └── error.jsp │ │ └── index.html │ │ ├── resources │ │ └── META-INF │ │ │ └── validation.xml │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── config │ │ └── ApplicationConfig.java │ │ ├── HelloBean.java │ │ ├── EventObserver.java │ │ └── HelloController.java └── pom.xml ├── counter ├── src │ └── main │ │ ├── webapp │ │ └── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── jboss-web.xml │ │ │ └── views │ │ │ └── counter.jsp │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── Counter.java │ │ ├── config │ │ └── ApplicationConfig.java │ │ ├── Count.java │ │ ├── CountObserver.java │ │ └── CountController.java └── pom.xml ├── generator ├── src │ └── main │ │ ├── webapp │ │ └── WEB-INF │ │ │ └── beans.xml │ │ └── java │ │ └── cookbookModel.jpa └── pom.xml ├── post-redirect-get ├── src │ └── main │ │ ├── webapp │ │ ├── index.jsp │ │ └── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── jboss-web.xml │ │ │ ├── glassfish-web.xml │ │ │ └── views │ │ │ ├── confirmation.jsp │ │ │ └── reservation.jsp │ │ ├── resources │ │ └── META-INF │ │ │ └── validation.xml │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── prg │ │ ├── Messages.java │ │ ├── ConfirmationController.java │ │ ├── Reservation.java │ │ ├── ReservationFormBean.java │ │ └── ReservationController.java │ │ ├── config │ │ ├── PrimitiveConverterProvider.java │ │ ├── EventObserver.java │ │ └── MyApplication.java │ │ └── service │ │ └── ReservationService.java └── pom.xml ├── simple ├── src │ └── main │ │ ├── webapp │ │ ├── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── jboss-web.xml │ │ │ ├── views │ │ │ │ └── hello.jsp │ │ │ └── glassfish-web.xml │ │ └── index.jsp │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── HelloController.java │ │ └── config │ │ └── ApplicationConfig.java └── pom.xml ├── simple-form ├── src │ └── main │ │ ├── webapp │ │ ├── WEB-INF │ │ │ ├── beans.xml │ │ │ ├── views │ │ │ │ ├── hello.jsp │ │ │ │ └── form.jsp │ │ │ ├── jboss-web.xml │ │ │ └── glassfish-web.xml │ │ └── index.jsp │ │ └── java │ │ └── eu │ │ └── agilejava │ │ └── mvc │ │ ├── HelloController.java │ │ └── config │ │ └── ApplicationConfig.java └── pom.xml ├── README.adoc ├── LICENSE └── pom.xml /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk8 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | .DS_Store 4 | nbactions.xml 5 | **/nb-configuration.xml 6 | *.iml 7 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : index 3 | Created on : Sep 18, 2016, 10:33:50 AM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 8 | <% 9 | response.sendRedirect(request.getContextPath() + "/mvc/hello"); 10 | %> -------------------------------------------------------------------------------- /hello/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /counter/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /generator/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : index 3 | Created on : Jun 9, 2016, 2:50:58 PM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 8 | <% 9 | response.sendRedirect(request.getContextPath() + "/mvc/reservations/new"); 10 | %> -------------------------------------------------------------------------------- /simple/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /hello/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /hello 4 | 5 | -------------------------------------------------------------------------------- /hello/src/main/webapp/WEB-INF/views/hello.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | MVC 1.0 Hello Demo 7 | 8 | 9 |

Hello ${name}

10 | 11 | 12 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /counter/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /counter 4 | 5 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/WEB-INF/views/hello.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | Simple MVC 1.0 Sample 7 | 8 | 9 |

${message}

10 | 11 | 12 | -------------------------------------------------------------------------------- /simple/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /simple 4 | 5 | -------------------------------------------------------------------------------- /simple/src/main/webapp/WEB-INF/views/hello.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | Simple MVC 1.0 Sample 7 | 8 | 9 |

Hello, World!

10 | 11 | 12 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /hello-cdi 4 | 5 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /simple-form 4 | 5 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /post-redirect-get 4 | 5 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/WEB-INF/views/hello.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | MVC 1.0 Hello Demo 7 | 8 | 9 |

Hello ${hello.firstName} ${hello.lastName}

10 | 11 | 12 | -------------------------------------------------------------------------------- /hello/src/main/webapp/WEB-INF/views/error.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | MVC 1.0 Hello Demo 7 | 8 | 9 | Property: ${property}
10 | Value: ${value}
11 | Message: ${message}
12 | 13 | 14 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = Samples for MVC 1.0 (JSR-371) 2 | 3 | The code in these samples are highly experimental as the work on JSR 371 is ongoing. That means that they may not always build or run on the latest snapshots. 4 | 5 | == Running on GlassFish 5.0 6 | 7 | Make sure you activate the `glassfish` profile 8 | 9 | ``` 10 | mvn clean package -Pglassfish 11 | ``` 12 | 13 | == Running on Wildfly 11 14 | 15 | Make sure you activate the `wildfly` profile 16 | 17 | ``` 18 | mvn clean package -Pwildfly 19 | ``` 20 | 21 | 22 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/WEB-INF/glassfish-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Keep a copy of the generated servlet class' java code. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /simple/src/main/webapp/WEB-INF/glassfish-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Keep a copy of the generated servlet class' java code. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/WEB-INF/glassfish-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Keep a copy of the generated servlet class' java code. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/WEB-INF/glassfish-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Keep a copy of the generated servlet class' java code. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /counter/src/main/webapp/WEB-INF/views/counter.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : cookbook 3 | Created on : Jan 23, 2015, 8:20:27 PM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | MVC Counter Demo 13 | 14 | 15 |

Count for ${count.message}

16 |

${count.count}

17 | 18 | 19 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/WEB-INF/views/form.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : form 3 | Created on : Mar 29, 2017, 10:27:24 AM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Simple MVC 1.0 Form 13 | 14 | 15 |

Simple Form

16 | 17 |
18 | Name: 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /counter/src/main/java/eu/agilejava/mvc/Counter.java: -------------------------------------------------------------------------------- 1 | package eu.agilejava.mvc; 2 | 3 | import java.util.concurrent.atomic.AtomicLong; 4 | import java.util.logging.Logger; 5 | import javax.annotation.PostConstruct; 6 | import javax.ejb.Singleton; 7 | 8 | /** 9 | * 10 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 11 | */ 12 | @Singleton 13 | public class Counter { 14 | 15 | private static final Logger LOGGER = Logger.getLogger(CountObserver.class.getName()); 16 | 17 | private final AtomicLong counter = new AtomicLong(); 18 | 19 | /** 20 | * Retrieves the next number. 21 | * 22 | * @return the next count 23 | */ 24 | public long next() { 25 | return counter.incrementAndGet(); 26 | } 27 | 28 | @PostConstruct 29 | private void init() { 30 | LOGGER.config(() -> this.getClass().getSimpleName() + " created"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hello-cdi/src/main/webapp/WEB-INF/views/form.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | MVC 1.0 Hello Demo 7 | 8 | 9 |

An empty first and/or last name will result in a validation error

10 |
11 |

12 | 13 | 14 | 15 | ${mvc.encoders.html(messages.getMessage("firstName"))} 16 |

17 |

18 | 19 | 20 | ${mvc.encoders.html(messages.getMessage("lastName"))} 21 |

22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /generator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | mvc-samples-generator 5 | war 6 | 7 | MVC Generator Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 20 | 21 | 22 | 23 | javax 24 | javaee-web-api 25 | provided 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ivar Grimstad 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /hello/src/main/resources/META-INF/validation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 19 | NONE 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /hello-cdi/src/main/resources/META-INF/validation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 19 | NONE 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/resources/META-INF/validation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 19 | NONE 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /simple/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 25 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 26 | <% 27 | response.sendRedirect(request.getContextPath() + "/mvc/hello"); 28 | %> 29 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/WEB-INF/views/confirmation.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : order 3 | Created on : Nov 13, 2015, 2:32:40 PM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 9 | 10 | 11 | 12 | 13 | Confirmation 14 | 15 | 16 |

Reservation confirmed

17 |

18 | 19 | ${reservation.id} 20 |

21 |

22 | 23 | ${reservation.name} 24 |

25 |

26 | 27 | ${reservation.count} 28 |

29 |

30 | 31 | ${reservation.date} 32 |

33 |

34 | 35 | 36 |

37 |

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /simple-form/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 25 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 26 | <% 27 | response.sendRedirect(request.getContextPath() + "/mvc/hello"); 28 | %> 29 | -------------------------------------------------------------------------------- /hello-cdi/src/main/java/eu/agilejava/mvc/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package eu.agilejava.mvc; 7 | 8 | import java.io.Serializable; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import static java.util.stream.Collectors.toList; 12 | import javax.enterprise.context.RequestScoped; 13 | import javax.inject.Named; 14 | import javax.mvc.binding.ParamError; 15 | import javax.mvc.binding.ValidationError; 16 | 17 | /** 18 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 19 | */ 20 | @Named 21 | @RequestScoped 22 | public class Messages implements Serializable { 23 | 24 | private static final long serialVersionUID = 601263646224546642L; 25 | 26 | private List errors = new ArrayList<>(); 27 | 28 | public void setErrors(List messages) { 29 | this.errors = messages; 30 | } 31 | 32 | public List getErrors() { 33 | return errors.stream() 34 | .map(ParamError::getMessage) 35 | .collect(toList()); 36 | } 37 | 38 | public String getMessage(String param) { 39 | return errors.stream() 40 | .filter(v -> v.getParamName().equals(param)) 41 | .map(ParamError::getMessage) 42 | .findFirst() 43 | .orElse(""); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/prg/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package eu.agilejava.mvc.prg; 7 | 8 | import java.io.Serializable; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import static java.util.stream.Collectors.toList; 12 | import javax.enterprise.context.RequestScoped; 13 | import javax.inject.Named; 14 | import javax.mvc.binding.ParamError; 15 | import javax.mvc.binding.ValidationError; 16 | 17 | /** 18 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 19 | */ 20 | @Named 21 | @RequestScoped 22 | public class Messages implements Serializable { 23 | 24 | private static final long serialVersionUID = 601263646224546642L; 25 | 26 | private List errors = new ArrayList<>(); 27 | 28 | public void setErrors(List messages) { 29 | this.errors = messages; 30 | } 31 | 32 | public List getErrors() { 33 | return errors.stream() 34 | .map(ParamError::getMessage) 35 | .collect(toList()); 36 | } 37 | 38 | public String getMessage(String param) { 39 | return errors.stream() 40 | .filter(v -> v.getParamName().equals(param)) 41 | .map(ParamError::getMessage) 42 | .findFirst() 43 | .orElse(""); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /simple/src/main/java/eu/agilejava/mvc/HelloController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.mvc.Controller; 27 | import javax.ws.rs.PUT; 28 | import javax.ws.rs.Path; 29 | 30 | /** 31 | * 32 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 33 | */ 34 | @Path("hello") 35 | @Controller 36 | public class HelloController { 37 | 38 | @PUT 39 | public String view() { 40 | return "hello.jsp"; 41 | } 42 | 43 | // Add model 44 | // Update view 45 | } 46 | -------------------------------------------------------------------------------- /counter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | mvc-samples-counter 5 | war 6 | 7 | MVC Counter Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 20 | 21 | 22 | 23 | glassfish 24 | 25 | true> 26 | 27 | 28 | 29 | org.mvc-spec.ozark 30 | ozark-jersey 31 | runtime 32 | 33 | 34 | 35 | 36 | wildfly 37 | 38 | 39 | org.mvc-spec.ozark 40 | ozark-resteasy 41 | runtime 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /hello/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | mvc-samples-hello 5 | war 6 | 7 | MVC Hello Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 20 | 21 | 22 | 23 | glassfish 24 | 25 | true> 26 | 27 | 28 | 29 | org.mvc-spec.ozark 30 | ozark-jersey 31 | runtime 32 | 33 | 34 | 35 | 36 | wildfly 37 | 38 | 39 | org.mvc-spec.ozark 40 | ozark-resteasy 41 | runtime 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /hello-cdi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | mvc-samples-hello-cdi 5 | war 6 | 7 | MVC Hello CDI Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 20 | 21 | 22 | 23 | glassfish 24 | 25 | true> 26 | 27 | 28 | 29 | org.mvc-spec.ozark 30 | ozark-jersey 31 | runtime 32 | 33 | 34 | 35 | 36 | wildfly 37 | 38 | 39 | org.mvc-spec.ozark 40 | ozark-resteasy 41 | runtime 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /counter/src/main/java/eu/agilejava/mvc/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.CountController; 27 | import java.util.Collections; 28 | import java.util.Set; 29 | import javax.ws.rs.ApplicationPath; 30 | import javax.ws.rs.core.Application; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @ApplicationPath("mvc") 37 | public class ApplicationConfig extends Application { 38 | 39 | @Override 40 | public Set> getClasses() { 41 | return Collections.singleton(CountController.class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/prg/ConfirmationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.prg; 25 | 26 | import javax.inject.Inject; 27 | import javax.mvc.Controller; 28 | import javax.mvc.View; 29 | import javax.ws.rs.GET; 30 | import javax.ws.rs.Path; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @Controller 37 | @Path("confirmation") 38 | public class ConfirmationController { 39 | 40 | @Inject 41 | private Reservation reservation; 42 | 43 | @GET 44 | @View("confirmation.jsp") 45 | public void confirm() { 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /post-redirect-get/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | mvc-samples-prg 5 | war 6 | MVC Post Redirect Get Sample 7 | 8 | 9 | eu.agilejava 10 | mvc-samples 11 | 1.0-SNAPSHOT 12 | ../pom.xml 13 | 14 | 15 | 16 | mit 17 | false 18 | 0.22.1 19 | 20 | 21 | 22 | 23 | glassfish 24 | 25 | true> 26 | 27 | 28 | 29 | org.mvc-spec.ozark 30 | ozark-jersey 31 | runtime 32 | 33 | 34 | 35 | 36 | wildfly 37 | 38 | 39 | org.mvc-spec.ozark 40 | ozark-resteasy 41 | runtime 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /hello/src/main/java/eu/agilejava/mvc/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.HelloController; 27 | import java.util.HashSet; 28 | import java.util.Set; 29 | import javax.ws.rs.ApplicationPath; 30 | import javax.ws.rs.core.Application; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @ApplicationPath("mvc") 37 | public class ApplicationConfig extends Application { 38 | 39 | @Override 40 | public Set> getClasses() { 41 | final Set> set = new HashSet<>(); 42 | set.add(HelloController.class); 43 | return set; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /simple/src/main/java/eu/agilejava/mvc/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.HelloController; 27 | import java.util.HashSet; 28 | import java.util.Set; 29 | import javax.ws.rs.ApplicationPath; 30 | import javax.ws.rs.core.Application; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @ApplicationPath("mvc") 37 | public class ApplicationConfig extends Application { 38 | 39 | @Override 40 | public Set> getClasses() { 41 | final Set> set = new HashSet<>(); 42 | set.add(HelloController.class); 43 | return set; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /hello-cdi/src/main/java/eu/agilejava/mvc/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.HelloController; 27 | import java.util.HashSet; 28 | import java.util.Set; 29 | import javax.ws.rs.ApplicationPath; 30 | import javax.ws.rs.core.Application; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @ApplicationPath("mvc") 37 | public class ApplicationConfig extends Application { 38 | 39 | @Override 40 | public Set> getClasses() { 41 | final Set> set = new HashSet<>(); 42 | set.add(HelloController.class); 43 | return set; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /hello/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | Hello MVC Example 28 | 29 | 30 | 31 | 32 |

An empty first and/or last name will result in a 400 (validation error)

33 |
34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /simple-form/src/main/java/eu/agilejava/mvc/HelloController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.inject.Inject; 27 | import javax.mvc.Models; 28 | import javax.mvc.annotation.Controller; 29 | import javax.ws.rs.GET; 30 | import javax.ws.rs.Path; 31 | 32 | /** 33 | * 34 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 35 | */ 36 | @Path("hello") 37 | @Controller 38 | public class HelloController { 39 | 40 | @Inject 41 | private Models model; 42 | 43 | @GET 44 | public String view() { 45 | model.put("message", "Hello, JavaOne!"); 46 | return "hello.jsp"; 47 | } 48 | 49 | // return form.jsp from @GET 50 | // @POST method with form param name 51 | // add models 52 | // add csrf 53 | // locale 54 | // events 55 | } 56 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/webapp/WEB-INF/views/reservation.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : order 3 | Created on : Nov 13, 2015, 2:32:40 PM 4 | Author : Ivar Grimstad (ivar.grimstad@gmail.com) 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 9 | 10 | 11 | 12 | 13 | Reservation Form 14 | 15 | 16 |

Reservation

17 | 18 |
19 | 20 |

21 | 22 | 23 | ${mvc.encoders.html(messages.getMessage("name"))} 24 |

25 |

26 | 27 | 28 | ${mvc.encoders.html(messages.getMessage("count"))} 29 |

30 |

31 | 32 | 33 | ${mvc.encoders.html(messages.getMessage("date"))} 34 |

35 |

36 | 37 | 38 |

39 |

40 | 41 |

42 | 43 |
44 |

45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /hello-cdi/src/main/java/eu/agilejava/mvc/HelloBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2018 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.enterprise.context.RequestScoped; 27 | import javax.inject.Named; 28 | 29 | /** 30 | * 31 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 32 | */ 33 | @Named("hello") 34 | @RequestScoped 35 | public class HelloBean { 36 | 37 | private String firstName; 38 | private String lastName; 39 | 40 | public String getFirstName() { 41 | return firstName; 42 | } 43 | 44 | public void setFirstName(String firstName) { 45 | this.firstName = firstName; 46 | } 47 | 48 | public String getLastName() { 49 | return lastName; 50 | } 51 | 52 | public void setLastName(String lastName) { 53 | this.lastName = lastName; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/config/PrimitiveConverterProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package eu.agilejava.mvc.config; 7 | 8 | import java.lang.annotation.Annotation; 9 | import java.lang.reflect.Type; 10 | import javax.ws.rs.ext.ParamConverter; 11 | import javax.ws.rs.ext.ParamConverterProvider; 12 | import javax.ws.rs.ext.Provider; 13 | 14 | /** 15 | * 16 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 17 | */ 18 | @Provider 19 | public class PrimitiveConverterProvider implements ParamConverterProvider { 20 | 21 | @Override 22 | public ParamConverter getConverter(Class rawType, Type genericType, Annotation[] annotations) { 23 | 24 | if (rawType.getName().equals(boolean.class.getName())) { 25 | 26 | return new ParamConverter() { 27 | @Override 28 | public T fromString(String value) { 29 | return (T) Boolean.valueOf(value != null && value.equals("on")); 30 | } 31 | 32 | @Override 33 | public String toString(T value) { 34 | return ((Boolean) value) ? "on" : ""; 35 | } 36 | }; 37 | 38 | } else if (rawType.getName().equals(int.class.getName())) { 39 | 40 | return new ParamConverter() { 41 | @Override 42 | public T fromString(String value) { 43 | 44 | try { 45 | return (T) (Integer) Integer.parseInt(value); 46 | } catch (NumberFormatException e) { 47 | } 48 | 49 | return (T) (Integer) 0; 50 | } 51 | 52 | @Override 53 | public String toString(T value) { 54 | return "" + value; 55 | } 56 | }; 57 | 58 | } else { 59 | return null; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/service/ReservationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.service; 25 | 26 | import eu.agilejava.mvc.prg.Reservation; 27 | import java.util.HashSet; 28 | import java.util.Set; 29 | import java.util.UUID; 30 | import javax.inject.Named; 31 | import javax.inject.Singleton; 32 | import javax.validation.constraints.NotNull; 33 | 34 | /** 35 | * 36 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 37 | */ 38 | @Named 39 | @Singleton 40 | public class ReservationService { 41 | 42 | private final Set reservations = new HashSet<>();; 43 | 44 | public Reservation save(@NotNull Reservation reservation) { 45 | 46 | if(reservation.getId() == null || reservation.getId().isEmpty() ) { 47 | reservation.setId(UUID.randomUUID().toString()); 48 | } 49 | 50 | reservations.remove(reservation); 51 | reservations.add(reservation); 52 | 53 | return reservation; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /hello/src/main/java/eu/agilejava/mvc/HelloBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.mvc.binding.MvcBinding; 27 | import javax.validation.constraints.NotNull; 28 | import javax.validation.constraints.Size; 29 | import javax.ws.rs.FormParam; 30 | 31 | /** 32 | * 33 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 34 | */ 35 | public class HelloBean { 36 | 37 | @MvcBinding 38 | @NotNull 39 | @Size(min = 1, max = 16) 40 | @FormParam("firstName") 41 | private String firstName; 42 | 43 | @MvcBinding 44 | @NotNull 45 | @Size(min = 1, max = 24) 46 | @FormParam("lastName") 47 | private String lastName; 48 | 49 | public String getFirstName() { 50 | return firstName; 51 | } 52 | 53 | public void setFirstName(String firstName) { 54 | this.firstName = firstName; 55 | } 56 | 57 | public String getLastName() { 58 | return lastName; 59 | } 60 | 61 | public void setLastName(String lastName) { 62 | this.lastName = lastName; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /hello-cdi/src/main/java/eu/agilejava/mvc/HelloForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.mvc.binding.MvcBinding; 27 | import javax.validation.constraints.NotNull; 28 | import javax.validation.constraints.Size; 29 | import javax.ws.rs.FormParam; 30 | 31 | /** 32 | * 33 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 34 | */ 35 | public class HelloForm { 36 | 37 | @MvcBinding 38 | @NotNull 39 | @Size(min = 1, max = 16) 40 | @FormParam("firstName") 41 | private String firstName; 42 | 43 | @MvcBinding 44 | @NotNull 45 | @Size(min = 2, max = 24) 46 | @FormParam("lastName") 47 | private String lastName; 48 | 49 | public String getFirstName() { 50 | return firstName; 51 | } 52 | 53 | public void setFirstName(String firstName) { 54 | this.firstName = firstName; 55 | } 56 | 57 | public String getLastName() { 58 | return lastName; 59 | } 60 | 61 | public void setLastName(String lastName) { 62 | this.lastName = lastName; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /counter/src/main/java/eu/agilejava/mvc/Count.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License 3 | * 4 | * Copyright 2014 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 8 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 12 | * Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 15 | * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 17 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | package eu.agilejava.mvc; 20 | 21 | /** 22 | * 23 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 24 | */ 25 | public class Count { 26 | 27 | private final String message; 28 | private long count; 29 | private long simpleCount; 30 | private long awsomeCount; 31 | 32 | public Count(String content) { 33 | this.message = content; 34 | } 35 | 36 | public String getMessage() { 37 | return message; 38 | } 39 | 40 | public long getCount() { 41 | return count; 42 | } 43 | 44 | public void setCount(final long count) { 45 | this.count = count; 46 | } 47 | 48 | public long getSimpleCount() { 49 | return simpleCount; 50 | } 51 | 52 | public void setSimpleCount(final long simpleCount) { 53 | this.simpleCount = simpleCount; 54 | } 55 | 56 | public long getAwsomeCount() { 57 | return awsomeCount; 58 | } 59 | 60 | public void setAwsomeCount(final long awsomeCount) { 61 | this.awsomeCount = awsomeCount; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /counter/src/main/java/eu/agilejava/mvc/CountObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import java.util.logging.Logger; 27 | import javax.annotation.PostConstruct; 28 | import javax.enterprise.context.ApplicationScoped; 29 | import javax.enterprise.event.Observes; 30 | import javax.mvc.event.BeforeControllerEvent; 31 | import javax.mvc.event.BeforeProcessViewEvent; 32 | 33 | /** 34 | * 35 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 36 | */ 37 | @ApplicationScoped 38 | public class CountObserver { 39 | 40 | private static final Logger LOGGER = Logger.getLogger(CountObserver.class.getName()); 41 | 42 | private void onControllerMatched(@Observes BeforeControllerEvent event) { 43 | LOGGER.info(() -> "Controller matched for " + event.getUriInfo().getRequestUri()); 44 | } 45 | 46 | private void onViewEngineSelected(@Observes BeforeProcessViewEvent event) { 47 | LOGGER.info(() -> "View engine: " + event.getEngine()); 48 | } 49 | 50 | @PostConstruct 51 | private void init() { 52 | LOGGER.config(() -> this.getClass().getSimpleName() + " created"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /simple-form/src/main/java/eu/agilejava/mvc/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.HelloController; 27 | import java.util.HashMap; 28 | import java.util.HashSet; 29 | import java.util.Map; 30 | import java.util.Set; 31 | import javax.mvc.security.Csrf; 32 | import javax.ws.rs.ApplicationPath; 33 | import javax.ws.rs.core.Application; 34 | import org.mvcspec.ozark.Properties; 35 | 36 | /** 37 | * 38 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 39 | */ 40 | @ApplicationPath("mvc") 41 | public class ApplicationConfig extends Application { 42 | 43 | @Override 44 | public Set> getClasses() { 45 | final Set> set = new HashSet<>(); 46 | set.add(HelloController.class); 47 | return set; 48 | } 49 | 50 | @Override 51 | public Map getProperties() { 52 | final Map map = new HashMap<>(); 53 | 54 | // use cookie for redirect 55 | map.put(Properties.REDIRECT_SCOPE_COOKIES, true); 56 | 57 | // explicit CSRF Protection 58 | map.put(Csrf.CSRF_PROTECTION, Csrf.CsrfOptions.EXPLICIT); 59 | return map; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /counter/src/main/java/eu/agilejava/mvc/CountController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import java.util.logging.Logger; 27 | import javax.annotation.PostConstruct; 28 | import javax.inject.Inject; 29 | import javax.mvc.Controller; 30 | import javax.mvc.Models; 31 | import javax.mvc.View; 32 | import javax.ws.rs.GET; 33 | import javax.ws.rs.Path; 34 | import javax.ws.rs.PathParam; 35 | 36 | /** 37 | * 38 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 39 | */ 40 | @Path("count") 41 | @View("counter.jsp") 42 | @Controller 43 | public class CountController { 44 | 45 | private static final Logger LOGGER = Logger.getLogger(CountController.class.getName()); 46 | 47 | @Inject 48 | private Models models; 49 | 50 | @Inject 51 | private Counter counter; 52 | 53 | @GET 54 | @Path("{id}") 55 | public void view(@PathParam("id") String id) { 56 | 57 | LOGGER.info(() -> "Invoking controller"); 58 | 59 | Count count = new Count(id); 60 | count.setCount(counter.next()); 61 | models.put("count", count); 62 | } 63 | 64 | @PostConstruct 65 | private void init() { 66 | LOGGER.config(() -> this.getClass().getSimpleName() + " created"); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /hello/src/main/java/eu/agilejava/mvc/EventObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2016 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.enterprise.context.ApplicationScoped; 27 | import javax.enterprise.event.Observes; 28 | import javax.mvc.event.AfterControllerEvent; 29 | import javax.mvc.event.AfterProcessViewEvent; 30 | import javax.mvc.event.BeforeControllerEvent; 31 | import javax.mvc.event.BeforeProcessViewEvent; 32 | import javax.mvc.event.ControllerRedirectEvent; 33 | 34 | /** 35 | * 36 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 37 | */ 38 | @ApplicationScoped 39 | public class EventObserver { 40 | 41 | public void onBeforeController(@Observes BeforeControllerEvent event) { 42 | System.out.println("Before Controller"); 43 | } 44 | 45 | public void onAfterController(@Observes AfterControllerEvent event) { 46 | System.out.println("After Controller"); 47 | } 48 | 49 | public void onBeforeView(@Observes BeforeProcessViewEvent event) { 50 | System.out.println("Before View"); 51 | } 52 | 53 | public void onAfterView(@Observes AfterProcessViewEvent event) { 54 | System.out.println("After View"); 55 | } 56 | 57 | public void onRedirect(@Observes ControllerRedirectEvent event) { 58 | System.out.println("Redirect"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/config/EventObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2016 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import javax.enterprise.context.ApplicationScoped; 27 | import javax.enterprise.event.Observes; 28 | import javax.mvc.event.AfterControllerEvent; 29 | import javax.mvc.event.AfterProcessViewEvent; 30 | import javax.mvc.event.BeforeControllerEvent; 31 | import javax.mvc.event.BeforeProcessViewEvent; 32 | import javax.mvc.event.ControllerRedirectEvent; 33 | 34 | /** 35 | * 36 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 37 | */ 38 | @ApplicationScoped 39 | public class EventObserver { 40 | 41 | public void onBeforeController(@Observes BeforeControllerEvent event) { 42 | System.out.println("Before Controller"); 43 | } 44 | 45 | public void onAfterController(@Observes AfterControllerEvent event) { 46 | System.out.println("After Controller"); 47 | } 48 | 49 | public void onBeforeView(@Observes BeforeProcessViewEvent event) { 50 | System.out.println("Before View"); 51 | } 52 | 53 | public void onAfterView(@Observes AfterProcessViewEvent event) { 54 | System.out.println("After View"); 55 | } 56 | 57 | public void onRedirect(@Observes ControllerRedirectEvent event) { 58 | System.out.println("Redirect"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/config/MyApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.config; 25 | 26 | import eu.agilejava.mvc.prg.ConfirmationController; 27 | import eu.agilejava.mvc.prg.ReservationController; 28 | import java.util.HashMap; 29 | import java.util.HashSet; 30 | import java.util.Map; 31 | import java.util.Set; 32 | import javax.mvc.security.Csrf; 33 | import javax.ws.rs.ApplicationPath; 34 | import javax.ws.rs.core.Application; 35 | import org.mvcspec.ozark.Properties; 36 | 37 | /** 38 | * 39 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 40 | */ 41 | @ApplicationPath("mvc") 42 | public class MyApplication extends Application { 43 | 44 | @Override 45 | public Set> getClasses() { 46 | 47 | Set> classes = new HashSet<>(); 48 | 49 | classes.add(ReservationController.class); 50 | classes.add(ConfirmationController.class); 51 | classes.add(PrimitiveConverterProvider.class); 52 | 53 | return classes; 54 | } 55 | 56 | @Override 57 | public Map getProperties() { 58 | final Map map = new HashMap<>(); 59 | 60 | // use cookie for redirect 61 | map.put(Properties.REDIRECT_SCOPE_COOKIES, true); 62 | 63 | // explicit CSRF Protection 64 | map.put(Csrf.CSRF_PROTECTION, Csrf.CsrfOptions.EXPLICIT); 65 | return map; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/prg/Reservation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.prg; 25 | 26 | import java.io.Serializable; 27 | import javax.inject.Named; 28 | import javax.mvc.RedirectScoped; 29 | 30 | /** 31 | * 32 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 33 | */ 34 | @Named 35 | @RedirectScoped 36 | public class Reservation implements Serializable { 37 | 38 | private static final long serialVersionUID = 14251616245433L; 39 | 40 | private String id; 41 | private String name; 42 | private int count; 43 | private String date; 44 | private boolean outside; 45 | 46 | public String getId() { 47 | return id; 48 | } 49 | 50 | public void setId(String id) { 51 | this.id = id; 52 | } 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(String name) { 59 | this.name = name; 60 | } 61 | 62 | public int getCount() { 63 | return count; 64 | } 65 | 66 | public void setCount(int count) { 67 | this.count = count; 68 | } 69 | 70 | public String getDate() { 71 | return date; 72 | } 73 | 74 | public void setDate(String date) { 75 | this.date = date; 76 | } 77 | 78 | public boolean isOutside() { 79 | return outside; 80 | } 81 | 82 | public void setOutside(boolean outside) { 83 | this.outside = outside; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /hello-cdi/src/main/java/eu/agilejava/mvc/HelloController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import static java.util.stream.Collectors.toList; 27 | import javax.inject.Inject; 28 | import javax.mvc.Controller; 29 | import javax.mvc.View; 30 | import javax.mvc.binding.BindingResult; 31 | import javax.validation.Valid; 32 | import javax.ws.rs.BeanParam; 33 | import javax.ws.rs.GET; 34 | import javax.ws.rs.POST; 35 | import javax.ws.rs.Path; 36 | import javax.ws.rs.core.Response; 37 | import static javax.ws.rs.core.Response.Status.BAD_REQUEST; 38 | import static javax.ws.rs.core.Response.Status.OK; 39 | 40 | /** 41 | * 42 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 43 | */ 44 | @Path("hello") 45 | @Controller 46 | public class HelloController { 47 | 48 | @Inject 49 | private BindingResult br; 50 | 51 | @Inject 52 | private Messages messages; 53 | 54 | @Inject 55 | private HelloBean helloBean; 56 | 57 | @GET 58 | @View("form.jsp") 59 | public void form() { 60 | } 61 | 62 | @POST 63 | public Response formPost(@Valid @BeanParam HelloForm form) { 64 | 65 | if (br.isFailed()) { 66 | messages.setErrors( 67 | br.getAllErrors().stream() 68 | .collect(toList())); 69 | 70 | return Response.status(BAD_REQUEST).entity("form.jsp").build(); 71 | } 72 | 73 | helloBean.setFirstName(form.getFirstName()); 74 | helloBean.setLastName(form.getLastName()); 75 | 76 | return Response.status(OK).entity("hello.jsp").build(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /hello/src/main/java/eu/agilejava/mvc/HelloController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc; 25 | 26 | import javax.inject.Inject; 27 | import javax.mvc.Controller; 28 | import javax.mvc.Models; 29 | import javax.mvc.View; 30 | import javax.mvc.binding.BindingResult; 31 | import javax.validation.Valid; 32 | import javax.ws.rs.BeanParam; 33 | import javax.ws.rs.GET; 34 | import javax.ws.rs.POST; 35 | import javax.ws.rs.Path; 36 | import javax.ws.rs.PathParam; 37 | import javax.ws.rs.core.Response; 38 | import static javax.ws.rs.core.Response.Status.BAD_REQUEST; 39 | import static javax.ws.rs.core.Response.Status.OK; 40 | 41 | /** 42 | * 43 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 44 | */ 45 | @Path("hello") 46 | @Controller 47 | public class HelloController { 48 | 49 | @Inject 50 | private Models models; 51 | 52 | @Inject 53 | private BindingResult validationResult; 54 | 55 | @GET 56 | @Path("{name}") 57 | @View("hello.jsp") 58 | public void view(@PathParam("name") String name) { 59 | 60 | models.put("name", name); 61 | } 62 | 63 | @POST 64 | public Response formPost(@Valid @BeanParam HelloBean form) { 65 | 66 | if (validationResult.isFailed()) { 67 | 68 | validationResult.getAllErrors().stream() 69 | .forEach(v -> { 70 | models.put("property", v.getParamName()); 71 | models.put("message", v.getMessage()); 72 | }); 73 | 74 | return Response.status(BAD_REQUEST).entity("error.jsp").build(); 75 | } 76 | 77 | models.put("name", form.getFirstName() + " " + form.getLastName()); 78 | 79 | return Response.status(OK).entity("hello.jsp").build(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/prg/ReservationFormBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.prg; 25 | 26 | import javax.mvc.binding.MvcBinding; 27 | import javax.validation.constraints.Max; 28 | import javax.validation.constraints.Min; 29 | import javax.validation.constraints.NotNull; 30 | import javax.validation.constraints.Pattern; 31 | import javax.validation.constraints.Size; 32 | import javax.ws.rs.FormParam; 33 | 34 | /** 35 | * 36 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 37 | */ 38 | public class ReservationFormBean { 39 | 40 | @FormParam("id") 41 | private String id; 42 | 43 | @MvcBinding 44 | @NotNull 45 | @Size(min = 2) 46 | @FormParam("name") 47 | private String contact; 48 | 49 | @MvcBinding 50 | @Min(1) 51 | @Max(10) 52 | @FormParam("count") 53 | private int count; 54 | 55 | @MvcBinding 56 | @Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "Enter a valid date") 57 | @FormParam("date") 58 | private String date; 59 | 60 | @FormParam("outside") 61 | private boolean outside; 62 | 63 | public String getId() { 64 | return id; 65 | } 66 | 67 | public void setId(String id) { 68 | this.id = id; 69 | } 70 | 71 | public String getContact() { 72 | return contact; 73 | } 74 | 75 | public void setContact(String contact) { 76 | this.contact = contact; 77 | } 78 | 79 | public int getCount() { 80 | return count; 81 | } 82 | 83 | public void setCount(int count) { 84 | this.count = count; 85 | } 86 | 87 | public String getDate() { 88 | return date; 89 | } 90 | 91 | public void setDate(String date) { 92 | this.date = date; 93 | } 94 | 95 | public boolean isOutside() { 96 | return outside; 97 | } 98 | 99 | public void setOutside(boolean outside) { 100 | this.outside = outside; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /post-redirect-get/src/main/java/eu/agilejava/mvc/prg/ReservationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright 2015 Ivar Grimstad (ivar.grimstad@gmail.com). 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package eu.agilejava.mvc.prg; 25 | 26 | import eu.agilejava.mvc.service.ReservationService; 27 | import static java.util.stream.Collectors.toList; 28 | import javax.inject.Inject; 29 | import javax.mvc.Controller; 30 | import javax.mvc.View; 31 | import javax.mvc.binding.BindingResult; 32 | import javax.mvc.security.CsrfProtected; 33 | import javax.validation.Valid; 34 | import javax.ws.rs.BeanParam; 35 | import javax.ws.rs.GET; 36 | import javax.ws.rs.POST; 37 | import javax.ws.rs.Path; 38 | import javax.ws.rs.core.Response; 39 | import static javax.ws.rs.core.Response.Status.BAD_REQUEST; 40 | 41 | /** 42 | * 43 | * @author Ivar Grimstad (ivar.grimstad@gmail.com) 44 | */ 45 | @Controller 46 | @Path("reservations") 47 | public class ReservationController { 48 | 49 | @Inject 50 | private Reservation reservation; 51 | 52 | @Inject 53 | private ReservationService reservationService; 54 | 55 | @Inject 56 | private BindingResult br; 57 | 58 | @Inject 59 | private Messages messages; 60 | 61 | @GET 62 | @View("reservation.jsp") 63 | @Path("new") 64 | public void emptyReservation() { 65 | } 66 | 67 | @CsrfProtected 68 | @POST 69 | @Path("new") 70 | public Response createReservation(@Valid @BeanParam ReservationFormBean form) { 71 | 72 | reservation.setId(form.getId()); 73 | reservation.setName(form.getContact()); 74 | reservation.setCount(form.getCount()); 75 | reservation.setDate(form.getDate()); 76 | reservation.setOutside(form.isOutside()); 77 | 78 | if (br.isFailed()) { 79 | messages.setErrors( 80 | br.getAllErrors().stream() 81 | .collect(toList())); 82 | 83 | return Response.status(BAD_REQUEST).entity("reservation.jsp").build(); 84 | } 85 | 86 | reservationService.save(reservation); 87 | 88 | return Response.ok("redirect:confirmation").build(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | eu.agilejava 5 | mvc-samples 6 | 1.0-SNAPSHOT 7 | pom 8 | 9 | MVC Samples 10 | 11 | 12 | counter 13 | hello 14 | hello-cdi 15 | post-redirect-get 16 | generator 17 | simple 18 | 19 | 20 | 21 | mit 22 | 1.8 23 | 1.8 24 | false 25 | 0.23.0 26 | 1.0-pfd 27 | 1.0.0-m04 28 | 29 | 30 | 31 | 32 | 33 | javax 34 | javaee-web-api 35 | 7.0 36 | provided 37 | 38 | 39 | javax.mvc 40 | javax.mvc-api 41 | ${version.mvc.api} 42 | 43 | 44 | org.mvc-spec.ozark 45 | ozark-core 46 | ${version.ozark} 47 | 48 | 49 | org.mvc-spec.ozark 50 | ozark-jersey 51 | ${version.ozark} 52 | 53 | 54 | org.mvc-spec.ozark 55 | ozark-resteasy 56 | ${version.ozark} 57 | 58 | 59 | 60 | 61 | 62 | 63 | javax 64 | javaee-web-api 65 | provided 66 | 67 | 68 | 69 | javax.mvc 70 | javax.mvc-api 71 | 72 | 73 | 74 | org.mvc-spec.ozark 75 | ozark-core 76 | 77 | 78 | 79 | 80 | 81 | sonatype-oss-snapshots 82 | https://oss.sonatype.org/content/repositories/snapshots 83 | 84 | false 85 | 86 | 87 | true 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /generator/src/main/java/cookbookModel.jpa: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | java.util.List 68 | java.util.Set 69 | java.util.Collection 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /simple/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | simple 5 | war 6 | 7 | Simple MVC Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 0.22.1 20 | 21 | 22 | 23 | 24 | glassfish 25 | 26 | true> 27 | 28 | 29 | 30 | org.mvc-spec.ozark 31 | ozark-core 32 | 33 | 34 | org.mvc-spec.ozark 35 | ozark-jersey 36 | 37 | 38 | 39 | 40 | 41 | wildfly 42 | 43 | 44 | org.mvc-spec.ozark 45 | ozark-core 46 | 47 | 48 | org.mvc-spec.ozark 49 | ozark-resteasy 50 | 51 | 52 | 53 | 54 | 55 | glassfish-docker 56 | 57 | 58 | org.mvc-spec.ozark 59 | ozark-core 60 | 61 | 62 | org.mvc-spec.ozark 63 | ozark-jersey 64 | 65 | 66 | 67 | 68 | 69 | io.fabric8 70 | docker-maven-plugin 71 | ${version.docker-maven-plugin} 72 | 73 | 74 | 75 | glassfish 76 | ivargrimstad/${project.artifactId}:glassfish 77 | 78 | Ivar Grimstad (ivar.grimstad@gmail.com) 79 | oracle/glassfish:5.0-web 80 | 81 | /glassfish5/glassfish/domains/domain1/autodeploy/ 82 | artifact 83 | 84 | 85 | /glassfish5/bin/asadmin 86 | start-domain 87 | -v 88 | 89 | 90 | 91 | 92 | 8081:8080 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | wildfly-docker 105 | 106 | 107 | org.mvc-spec.ozark 108 | ozark-core 109 | 110 | 111 | org.mvc-spec.ozark 112 | ozark-resteasy 113 | 114 | 115 | 116 | 117 | 118 | io.fabric8 119 | docker-maven-plugin 120 | ${version.docker-maven-plugin} 121 | 122 | 123 | 124 | wildfly 125 | ivargrimstad/${project.artifactId}:wildfly 126 | 127 | Ivar Grimstad (ivar.grimstad@gmail.com) 128 | jboss/wildfly:10.1.0.Final 129 | 130 | /opt/jboss/wildfly/standalone/deployments/ 131 | artifact 132 | 133 | 134 | 135 | 136 | 8082:8080 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /simple-form/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | simple-form 5 | war 6 | 7 | Simple MVC Form Sample 8 | 9 | 10 | eu.agilejava 11 | mvc-samples 12 | 1.0-SNAPSHOT 13 | ../pom.xml 14 | 15 | 16 | 17 | mit 18 | false 19 | 0.20.0 20 | 21 | 22 | 23 | 24 | org.mvc-spec.ozark 25 | ozark-core 26 | compile 27 | 28 | 29 | 30 | 31 | 32 | glassfish 33 | 34 | true> 35 | 36 | 37 | 38 | org.mvc-spec.ozark 39 | ozark-core 40 | 41 | 42 | org.mvc-spec.ozark 43 | ozark-jersey 44 | 45 | 46 | 47 | 48 | 49 | wildfly 50 | 51 | 52 | org.mvc-spec.ozark 53 | ozark-core 54 | 55 | 56 | org.mvc-spec.ozark 57 | ozark-resteasy 58 | 59 | 60 | 61 | 62 | 63 | glassfish-docker 64 | 65 | 66 | org.mvc-spec.ozark 67 | ozark-core 68 | 69 | 70 | org.mvc-spec.ozark 71 | ozark-jersey 72 | 73 | 74 | 75 | 76 | 77 | io.fabric8 78 | docker-maven-plugin 79 | ${version.docker-maven-plugin} 80 | 81 | 82 | 83 | glassfish 84 | ivargrimstad/${project.artifactId}:glassfish 85 | 86 | Ivar Grimstad (ivar.grimstad@gmail.com) 87 | oracle/glassfish:5.0-web 88 | 89 | /glassfish5/glassfish/domains/domain1/autodeploy/ 90 | artifact 91 | 92 | 93 | /glassfish5/bin/asadmin 94 | start-domain 95 | -v 96 | 97 | 98 | 99 | 100 | 8081:8080 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | wildfly-docker 113 | 114 | 115 | org.mvc-spec.ozark 116 | ozark-core 117 | 118 | 119 | org.mvc-spec.ozark 120 | ozark-resteasy 121 | 122 | 123 | 124 | 125 | 126 | io.fabric8 127 | docker-maven-plugin 128 | ${version.docker-maven-plugin} 129 | 130 | 131 | 132 | wildfly 133 | ivargrimstad/${project.artifactId}:wildfly 134 | 135 | Ivar Grimstad (ivar.grimstad@gmail.com) 136 | jboss/wildfly:10.1.0.Final 137 | 138 | /opt/jboss/wildfly/standalone/deployments/ 139 | artifact 140 | 141 | 142 | 143 | 144 | 8082:8080 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | --------------------------------------------------------------------------------