Skip to content

Commit 436d70d

Browse files
committed
commit api application
1 parent ccfe8dc commit 436d70d

32 files changed

+1522
-0
lines changed

EVAM04_EMISIONVOTO_API/pom.xml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<parent>
6+
<artifactId>EVAM04_EMISIONVOTO</artifactId>
7+
<groupId>edu.cibertec.votoelectronico.application</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
11+
<modelVersion>4.0.0</modelVersion>
12+
<groupId>edu.cibertec.votoelectronico.api</groupId>
13+
<artifactId>EVAM04_EMISIONVOTO_API</artifactId>
14+
<name>EVAM04_EMISIONVOTO_API</name>
15+
<url>http://www.cibertec.edu.pe</url>
16+
<description>A REST API using JAX-RS</description>
17+
<packaging>war</packaging>
18+
19+
<properties>
20+
<project.build.finalName>EVAM04_EMISIONVOTO_API</project.build.finalName>
21+
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
22+
<version.wildfly>18.0.1.Final</version.wildfly>
23+
<version.war.plugin>2.1.1</version.war.plugin>
24+
<version.exec.plugin>1.6.0</version.exec.plugin>
25+
<!-- <resteasy.version>3.1.4.Final</resteasy.version> -->
26+
<resteasy.version>3.11.1.Final</resteasy.version>
27+
</properties>
28+
29+
<dependencies>
30+
<dependency>
31+
<groupId>edu.cibertec.votoelectronico.core</groupId>
32+
<artifactId>EVAM04_EMISIONVOTO_CORE</artifactId>
33+
<version>1.0-SNAPSHOT</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>edu.cibertec.votoelectronico.mapper</groupId>
37+
<artifactId>EVAM04_EMISIONVOTO_MAPPER</artifactId>
38+
<version>1.0-SNAPSHOT</version>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>javax.servlet</groupId>
43+
<artifactId>javax.servlet-api</artifactId>
44+
<version>3.1.0</version>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.jboss.resteasy</groupId>
49+
<artifactId>resteasy-jaxrs</artifactId>
50+
<version>${resteasy.version}</version>
51+
</dependency>
52+
<!-- <dependency> -->
53+
<!-- <groupId>org.jboss.resteasy</groupId> -->
54+
<!-- <artifactId>resteasy-json-p-provider</artifactId> -->
55+
<!-- <version>${resteasy.version}</version> -->
56+
<!-- </dependency> -->
57+
58+
<!-- JAXB support -->
59+
<!-- <dependency> -->
60+
<!-- <groupId>org.jboss.resteasy</groupId> -->
61+
<!-- <artifactId>resteasy-jaxb-provider</artifactId> -->
62+
<!-- <version>${resteasy.version}</version> -->
63+
<!-- </dependency> -->
64+
<dependency>
65+
<groupId>org.jboss.resteasy</groupId>
66+
<artifactId>resteasy-jackson-provider</artifactId>
67+
<version>${resteasy.version}</version>
68+
<exclusions>
69+
<exclusion>
70+
<groupId>org.jboss.resteasy</groupId>
71+
<artifactId>resteasy-jaxrs</artifactId>
72+
</exclusion>
73+
</exclusions>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.jboss.resteasy</groupId>
77+
<artifactId>resteasy-servlet-initializer</artifactId>
78+
<version>${resteasy.version}</version>
79+
<exclusions>
80+
<exclusion>
81+
<groupId>org.jboss.resteasy</groupId>
82+
<artifactId>resteasy-jaxrs</artifactId>
83+
</exclusion>
84+
</exclusions>
85+
</dependency>
86+
87+
<dependency>
88+
<groupId>org.jboss.resteasy</groupId>
89+
<artifactId>resteasy-client</artifactId>
90+
<version>${resteasy.version}</version>
91+
<scope>test</scope>
92+
</dependency>
93+
94+
<!-- <dependency> -->
95+
<!-- <groupId>org.jboss.resteasy</groupId> -->
96+
<!-- <artifactId>resteasy-undertow</artifactId> -->
97+
<!-- <version>${resteasy.version}</version> -->
98+
<!-- <scope>test</scope> -->
99+
<!-- </dependency> -->
100+
101+
<dependency>
102+
<groupId>org.jboss.resteasy</groupId>
103+
<artifactId>resteasy-spring</artifactId>
104+
<version>${resteasy.version}</version>
105+
<exclusions>
106+
<exclusion>
107+
<groupId>org.jboss.resteasy</groupId>
108+
<artifactId>resteasy-jaxrs</artifactId>
109+
</exclusion>
110+
</exclusions>
111+
</dependency>
112+
113+
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
114+
<dependency>
115+
<groupId>org.springframework</groupId>
116+
<artifactId>spring-web</artifactId>
117+
<version>${spring.version}</version>
118+
</dependency>
119+
<dependency>
120+
<groupId>org.hibernate.validator</groupId>
121+
<artifactId>hibernate-validator</artifactId>
122+
<version>6.0.2.Final</version>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.hibernate.validator</groupId>
126+
<artifactId>hibernate-validator-annotation-processor</artifactId>
127+
<version>6.0.2.Final</version>
128+
</dependency>
129+
<dependency>
130+
<groupId>org.glassfish</groupId>
131+
<artifactId>javax.el</artifactId>
132+
<version>3.0.1-b09</version>
133+
</dependency>
134+
<dependency>
135+
<groupId>junit</groupId>
136+
<artifactId>junit</artifactId>
137+
<version>4.11</version>
138+
<scope>test</scope>
139+
</dependency>
140+
<dependency>
141+
<groupId>org.slf4j</groupId>
142+
<artifactId>slf4j-log4j12</artifactId>
143+
<version>1.6.1</version>
144+
</dependency>
145+
</dependencies>
146+
147+
<build>
148+
<plugins>
149+
<plugin>
150+
<artifactId>maven-war-plugin</artifactId>
151+
<version>${version.war.plugin}</version>
152+
<configuration>
153+
<attachClasses>true</attachClasses>
154+
<classesClassifier>classes</classesClassifier>
155+
</configuration>
156+
</plugin>
157+
<plugin>
158+
<groupId>org.eclipse.jetty</groupId>
159+
<artifactId>jetty-maven-plugin</artifactId>
160+
<version>${version.org.eclipse.jetty}</version>
161+
</plugin>
162+
<plugin>
163+
<artifactId>maven-jar-plugin</artifactId>
164+
<version>${version.jar.plugin}</version>
165+
<configuration>
166+
</configuration>
167+
</plugin>
168+
<!-- WildFly plugin to deploy war -->
169+
<plugin>
170+
<groupId>org.wildfly.plugins</groupId>
171+
<artifactId>wildfly-maven-plugin</artifactId>
172+
<version>${version.wildfly.maven.plugin}</version>
173+
<configuration>
174+
<filename>${project.build.finalName}.war</filename>
175+
<username>admin-jaad</username>
176+
<password>$123456.a</password>
177+
</configuration>
178+
</plugin>
179+
<plugin>
180+
<groupId>org.apache.maven.plugins</groupId>
181+
<artifactId>maven-compiler-plugin</artifactId>
182+
<version>${version.compiler.plugin}</version>
183+
<configuration>
184+
<source>${maven.compiler.source}</source>
185+
<target>${maven.compiler.target}</target>
186+
</configuration>
187+
</plugin>
188+
</plugins>
189+
</build>
190+
</project>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package edu.cibertec.votoelectronico.application;
2+
3+
import org.jboss.resteasy.plugins.providers.sse.SseEventProvider;
4+
import org.jboss.resteasy.plugins.providers.sse.SseEventSinkInterceptor;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.ComponentScan;
8+
import org.springframework.context.annotation.Configuration;
9+
import org.springframework.context.annotation.PropertySource;
10+
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
11+
import org.springframework.core.env.Environment;
12+
import org.springframework.core.io.ClassPathResource;
13+
import org.springframework.core.io.Resource;
14+
15+
@Configuration
16+
@ComponentScan("edu.cibertec.votoelectronico")
17+
@PropertySource("classpath:application.properties")
18+
public class AppConfig {
19+
20+
@Autowired
21+
private Environment env;
22+
23+
@Bean
24+
public static PropertySourcesPlaceholderConfigurer properties() {
25+
PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
26+
27+
Resource[] archivosPropiedades = new Resource[] { new ClassPathResource("application.properties") };
28+
pspc.setLocations(archivosPropiedades);
29+
pspc.setIgnoreUnresolvablePlaceholders(true);
30+
return pspc;
31+
}
32+
33+
public Environment getEnv() {
34+
return env;
35+
}
36+
37+
public void setEnv(Environment env) {
38+
this.env = env;
39+
}
40+
41+
@Bean
42+
public SseEventSinkInterceptor sseEventSinkInterceptor() {
43+
return new SseEventSinkInterceptor();
44+
}
45+
46+
@Bean
47+
public SseEventProvider sseEventOutputProvider() {
48+
return new SseEventProvider();
49+
}
50+
51+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//package edu.cibertec.votoelectronico.application;
2+
//
3+
//import javax.servlet.ServletContext;
4+
//import javax.servlet.ServletException;
5+
//
6+
//import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
7+
//import org.jboss.resteasy.plugins.spring.SpringContextLoader;
8+
//import org.springframework.web.WebApplicationInitializer;
9+
//import org.springframework.web.context.ContextLoader;
10+
//import org.springframework.web.context.ContextLoaderListener;
11+
//import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
12+
//
13+
//public class AppInitializer implements WebApplicationInitializer {
14+
// @Override
15+
// public void onStartup(ServletContext container) throws ServletException {
16+
// container.addListener(new ResteasyBootstrap());
17+
//
18+
// final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
19+
// ContextLoaderListener springListener = new ContextLoaderListener(rootContext) {
20+
// @SuppressWarnings("unused")
21+
// protected ContextLoader createContextLoader() {
22+
// return new SpringContextLoader();
23+
// }
24+
// };
25+
// rootContext.register(AppConfig.class);
26+
// container.addListener(springListener);
27+
// }
28+
//
29+
//}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//package edu.cibertec.votoelectronico.application;
2+
//
3+
//import org.springframework.beans.BeansException;
4+
//import org.springframework.context.ApplicationContext;
5+
//import org.springframework.context.ApplicationContextAware;
6+
//import org.springframework.stereotype.Component;
7+
//
8+
//@Component
9+
//public class AppWebContext implements ApplicationContextAware {
10+
// private static ApplicationContext context;
11+
//
12+
// @Override
13+
// public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
14+
// context = applicationContext;
15+
// }
16+
//
17+
// public static ApplicationContext getContext() {
18+
// return context;
19+
// }
20+
//}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package edu.cibertec.votoelectronico.application;
2+
3+
import java.util.HashSet;
4+
import java.util.Set;
5+
6+
import javax.ws.rs.ApplicationPath;
7+
import javax.ws.rs.core.Application;
8+
9+
import edu.cibertec.votoelectronico.resource.SimpleVotoElectronicoResource;
10+
11+
@ApplicationPath("/v1")
12+
public class JAXRSConfig extends Application {
13+
14+
@Override
15+
public Set<Class<?>> getClasses() {
16+
HashSet<Class<?>> set = new HashSet<Class<?>>();
17+
set.add(SimpleVotoElectronicoResource.class);
18+
return set;
19+
}
20+
21+
}

0 commit comments

Comments
 (0)