Initial commit
This commit is contained in:
		
							parent
							
								
									6dcb329bbc
								
							
						
					
					
						commit
						acd7d764e2
					
				| @ -73,6 +73,11 @@ | |||||||
|             <version>${cache2k.version}</version> |             <version>${cache2k.version}</version> | ||||||
|             <type>pom</type> |             <type>pom</type> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.takes</groupId> | ||||||
|  |             <artifactId>takes</artifactId> | ||||||
|  |             <version>1.19</version> | ||||||
|  |         </dependency> | ||||||
|     </dependencies> |     </dependencies> | ||||||
| 
 | 
 | ||||||
|     <repositories> |     <repositories> | ||||||
| @ -81,6 +86,37 @@ | |||||||
|             <url>https://jitpack.io</url> |             <url>https://jitpack.io</url> | ||||||
|         </repository> |         </repository> | ||||||
|     </repositories> |     </repositories> | ||||||
|  |      | ||||||
|  |     <profiles> | ||||||
|  |         <profile> | ||||||
|  |             <id>hit-refresh</id> | ||||||
|  |             <build> | ||||||
|  | 		        <plugins> | ||||||
|  | 		            <plugin> | ||||||
|  | 		                <groupId>org.codehaus.mojo</groupId> | ||||||
|  | 		                <artifactId>exec-maven-plugin</artifactId> | ||||||
|  | 		                <version>1.6.0</version> | ||||||
|  | 		                <executions> | ||||||
|  | 		                    <execution> | ||||||
|  | 		                        <id>start-server</id> | ||||||
|  | 		                        <phase>pre-integration-test</phase> | ||||||
|  | 		                        <goals> | ||||||
|  | 		                            <goal>java</goal> | ||||||
|  | 		                        </goals> | ||||||
|  | 		                    </execution> | ||||||
|  | 		                </executions> | ||||||
|  | 		                <configuration> | ||||||
|  | 		                    <mainClass>com.baeldung.takes.TakesApp</mainClass> | ||||||
|  | 		                    <cleanupDaemonThreads>false</cleanupDaemonThreads> | ||||||
|  | 		                    <arguments> | ||||||
|  | 		                        <argument>--port=${port}</argument> | ||||||
|  | 		                    </arguments> | ||||||
|  | 		                </configuration> | ||||||
|  | 		            </plugin> | ||||||
|  | 		        </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |     </profiles> | ||||||
| 
 | 
 | ||||||
|     <properties> |     <properties> | ||||||
|         <jcommander.version>1.78</jcommander.version> |         <jcommander.version>1.78</jcommander.version> | ||||||
|  | |||||||
							
								
								
									
										26
									
								
								libraries-3/src/main/java/com/baeldung/takes/TakesApp.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								libraries-3/src/main/java/com/baeldung/takes/TakesApp.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | package com.baeldung.takes; | ||||||
|  | 
 | ||||||
|  | import org.takes.http.Exit; | ||||||
|  | import org.takes.http.FtBasic; | ||||||
|  | import org.takes.http.FtCli; | ||||||
|  | import org.takes.tk.TkClasspath; | ||||||
|  | import org.takes.tk.TkWrap; | ||||||
|  | import org.takes.Take; | ||||||
|  | import org.takes.facets.fork.FkRegex; | ||||||
|  | import org.takes.facets.fork.TkFork; | ||||||
|  | 
 | ||||||
|  | public final class TakesApp { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //    public static void main(final String... args) throws Exception { | ||||||
|  | //        new FtBasic(new TkFork(new FkRegex("/", "hello, world... this is coming from Takes!")), 6060).start(Exit.NEVER); | ||||||
|  | //    } | ||||||
|  | 
 | ||||||
|  |         public static void main(final String... args) throws Exception { | ||||||
|  |             new FtBasic(new TakesIndex(), 6060).start(Exit.NEVER); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										25
									
								
								libraries-3/src/main/java/com/baeldung/takes/TakesIndex.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								libraries-3/src/main/java/com/baeldung/takes/TakesIndex.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | package com.baeldung.takes; | ||||||
|  | 
 | ||||||
|  | import java.io.IOException; | ||||||
|  | 
 | ||||||
|  | import org.takes.Request; | ||||||
|  | import org.takes.Response; | ||||||
|  | import org.takes.Take; | ||||||
|  | import org.takes.rs.RsVelocity; | ||||||
|  | import org.takes.rs.RsWithBody; | ||||||
|  | import org.takes.rs.RsWithStatus; | ||||||
|  | import org.takes.rs.RsWithType; | ||||||
|  | 
 | ||||||
|  | public final class TakesIndex implements Take { | ||||||
|  | 
 | ||||||
|  | //    @Override | ||||||
|  | //    public Response act(Request req) throws IOException { | ||||||
|  | //        return new RsWithStatus(new RsWithType(new RsWithBody("<html>Hello, world!</html>"), "text/html"), 200); | ||||||
|  | //    } | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public Response act(Request req) { | ||||||
|  |       return new RsVelocity("Hello, ${name}", new RsVelocity.Pair("name", "Jeffrey")); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  | } | ||||||
| @ -0,0 +1,23 @@ | |||||||
|  | package com.baeldung.takes; | ||||||
|  | 
 | ||||||
|  | import javax.servlet.ServletContext; | ||||||
|  | 
 | ||||||
|  | import org.takes.Request; | ||||||
|  | import org.takes.Response; | ||||||
|  | import org.takes.Take; | ||||||
|  | import org.takes.rs.RsText; | ||||||
|  | 
 | ||||||
|  | public final class TakesServletApp implements Take { | ||||||
|  |      | ||||||
|  |     private final ServletContext ctx; | ||||||
|  | 
 | ||||||
|  |     public TakesServletApp(final ServletContext context) { | ||||||
|  |         this.ctx = context; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public Response act(final Request req) { | ||||||
|  |         return new RsText("Hello servlet!"); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
							
								
								
									
										15
									
								
								libraries-3/src/main/java/com/baeldung/takes/TkRoute.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								libraries-3/src/main/java/com/baeldung/takes/TkRoute.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | package com.baeldung.takes; | ||||||
|  | 
 | ||||||
|  | import org.takes.Request; | ||||||
|  | import org.takes.Response; | ||||||
|  | import org.takes.Take; | ||||||
|  | import org.takes.rs.RsText; | ||||||
|  | 
 | ||||||
|  | public final class TkRoute implements Take { | ||||||
|  |      | ||||||
|  |     @Override | ||||||
|  |     public Response act(final Request request) { | ||||||
|  |         return new RsText("Hello, world!"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user