diff --git a/src/main/java/de/thm/arsnova/SessionController.java b/src/main/java/de/thm/arsnova/SessionController.java index d92affcf28e512f190b3dfa9b715aef8c29668e6..513355932cbaff8b68936022f3f012fb8538b484 100644 --- a/src/main/java/de/thm/arsnova/SessionController.java +++ b/src/main/java/de/thm/arsnova/SessionController.java @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; import de.thm.arsnova.entities.Session; import de.thm.arsnova.services.ISessionService; @@ -66,6 +67,7 @@ public class SessionController { } @RequestMapping(value="/session/{sessionkey}", method=RequestMethod.GET) + @ResponseBody public Session getSession(@PathVariable String sessionkey, HttpServletResponse response) { Session session = sessionService.getSession(sessionkey); if (session != null) return session; @@ -75,6 +77,7 @@ public class SessionController { } @RequestMapping(value="/session", method=RequestMethod.POST) + @ResponseBody public Session postNewSession(@RequestBody Session session, HttpServletResponse response) { Session newSession = sessionService.saveSession(session); if (session != null) { diff --git a/src/main/java/de/thm/arsnova/services/SessionService.java b/src/main/java/de/thm/arsnova/services/SessionService.java index ee141d02a72fc310fd85ca369150ff912c749fee..55a22c3ef5cf006dad2cfb1580befe195cad4286 100644 --- a/src/main/java/de/thm/arsnova/services/SessionService.java +++ b/src/main/java/de/thm/arsnova/services/SessionService.java @@ -74,18 +74,21 @@ public class SessionService implements ISessionService { public static final Logger logger = LoggerFactory.getLogger(SessionService.class); - @Value("#{props['couchdb.host']}") + @Value("${couchdb.host}") public final void setDatabaseHost(String databaseHost) { + logger.info(databaseHost); this.databaseHost = databaseHost; } - @Value("#{props['couchdb.port']}") + @Value("${couchdb.port}") public final void setDatabasePort(String databasePort) { + logger.info(databasePort); this.databasePort = Integer.parseInt(databasePort); } - @Value("#{props['couchdb.name']}") + @Value("${couchdb.name}") public final void setDatabaseName(String databaseName) { + logger.info(databaseName); this.databaseName = databaseName; } diff --git a/src/main/webapp/WEB-INF/api-servlet.xml b/src/main/webapp/WEB-INF/api-servlet.xml deleted file mode 100644 index 345e7710c3025c033b0669bda35c8a7e8cd16e29..0000000000000000000000000000000000000000 --- a/src/main/webapp/WEB-INF/api-servlet.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" - xmlns:security="http://www.springframework.org/schema/security" - xmlns:mvc="http://www.springframework.org/schema/mvc" - xmlns:task="http://www.springframework.org/schema/task" - xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd - http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd - http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd"> - - <context:component-scan base-package="de.thm.arsnova" /> - <context:annotation-config /> - - <mvc:annotation-driven /> - <task:annotation-driven /> - - <bean - class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> - <bean - class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> - <property name="messageConverters"> - <list> - <bean - class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> - </list> - </property> - </bean> - - <bean - class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> - <property name="mediaTypes"> - <map> - <entry key="json" value="application/json" /> - </map> - </property> - - <property name="defaultViews"> - <list> - <bean - class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /> - </list> - </property> - </bean> - -</beans> diff --git a/src/main/webapp/WEB-INF/arsnova-servlet.xml b/src/main/webapp/WEB-INF/arsnova-servlet.xml index 1c79a718e925e751bcc9b2a483d5f9c162162f24..065ede7792c55e5eda6ce96cd5a496b46dee550f 100644 --- a/src/main/webapp/WEB-INF/arsnova-servlet.xml +++ b/src/main/webapp/WEB-INF/arsnova-servlet.xml @@ -1,26 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:security="http://www.springframework.org/schema/security" - xmlns:mvc="http://www.springframework.org/schema/mvc" - xmlns:p="http://www.springframework.org/schema/p" - xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd - http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> - - <context:component-scan base-package="de.thm.arsnova" /> - <context:annotation-config /> - - <mvc:resources mapping="/**" location="/" /> - - <mvc:annotation-driven /> - - <bean id="viewResolver" - class="org.springframework.web.servlet.view.InternalResourceViewResolver" - p:viewClass="org.springframework.web.servlet.view.JstlView" - p:prefix="/WEB-INF/views/" - p:suffix=".jsp" /> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + <!-- ARSnova Root Context: defines shared resources visible to all OTHER web components --> </beans> diff --git a/src/main/webapp/WEB-INF/spring/spring-main.xml b/src/main/webapp/WEB-INF/spring/spring-main.xml index 688a7fd235090578595fe4911afa2e8f7e62541f..8f11efeb740cd5cd0a770ac82213869d6943d29e 100644 --- a/src/main/webapp/WEB-INF/spring/spring-main.xml +++ b/src/main/webapp/WEB-INF/spring/spring-main.xml @@ -2,9 +2,12 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task" + xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd"> <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" @@ -16,14 +19,48 @@ </list> </property> </bean> - - <util:properties id="props" - location="file:///etc/arsnova/arsnova.properties" /> - + <import resource="spring-security.xml" /> <context:component-scan base-package="de.thm.arsnova" /> - <context:annotation-config /> + <mvc:annotation-driven /> + <mvc:resources mapping="/**" location="/" /> + + <task:annotation-driven /> + + <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> + <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> + <property name="messageConverters"> + <list> + <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> + </list> + </property> + </bean> + + <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> + <property name="mediaTypes"> + <map> + <entry key="html" value="text/html"/> + <entry key="json" value="application/json" /> + </map> + </property> + <property name="viewResolvers"> + <list> + <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"> + <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> + <property name="prefix" value="/WEB-INF/jsp/"/> + <property name="suffix" value=".jsp"/> + </bean> + </list> + </property> + <property name="defaultViews"> + <list> + <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"> + <property name="prefixJson" value="false"/> + </bean> + </list> + </property> + </bean> <bean id="socketServer" class="de.thm.arsnova.socket.ARSnovaSocketIOServer" init-method="startServer" destroy-method="stopServer" scope="singleton" diff --git a/src/main/webapp/WEB-INF/spring/spring-security.xml b/src/main/webapp/WEB-INF/spring/spring-security.xml index 40e16c9403d8c9522bd3e985d925e8aef9d61737..bc0a0d1f6e629cbbc656576614030fb60241d57e 100644 --- a/src/main/webapp/WEB-INF/spring/spring-security.xml +++ b/src/main/webapp/WEB-INF/spring/spring-security.xml @@ -9,10 +9,6 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> - <context:component-scan base-package="de.thm.arsnova" /> - <context:annotation-config /> - - <security:authentication-manager alias="authenticationManager"> <security:authentication-provider ref="facebookAuthProvider" /> <security:authentication-provider ref="twitterAuthProvider" /> diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index b289f01050151c8304e43791c624c8ca66fcb4ad..cb7155c3f6a2b9bee0e57ce1f858802cb0d86ba3 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -22,15 +22,6 @@ <servlet-name>arsnova</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> - <servlet> - <servlet-name>api</servlet-name> - <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> - <load-on-startup>1</load-on-startup> - </servlet> - <servlet-mapping> - <servlet-name>api</servlet-name> - <url-pattern>/api/*</url-pattern> - </servlet-mapping> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>