Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <build>
- <finalName>services</finalName>
- <plugins>
- <!-- Enabling and configuring web resources filtering -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.3</version>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <excludes>
- <exclude>web.xml</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
- <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0" metadata-complete="true">
- <display-name>services</display-name>
- <!-- location of spring xml files. Context-param helps you store the param name and value globally -->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext.xml</param-value>
- </context-param>
- <!-- the listener that kick-starts Spring -->
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <servlet>
- <servlet-name>Rest service</servlet-name>
- <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
- <init-param>
- <param-name>com.sun.jersey.config.property.packages</param-name>
- <param-value>com.application.newsfeed.svc</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <!-- URL patterns -->
- <servlet-mapping>
- <servlet-name>Rest service</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
- </web-app>
- <?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:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util-3.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
- <bean
- class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="targetObject">
- <bean
- class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="targetClass" value="java.lang.System" />
- <property name="targetMethod" value="getProperties" />
- </bean>
- </property>
- <property name="targetMethod" value="putAll" />
- <property name="arguments">
- <!-- The new Properties -->
- <util:properties>
- <prop key="jsse.enableSNIExtension">false</prop>
- </util:properties>
- </property>
- </bean>
- <bean id="userValidation" class = "com.application.newsfeed.dao.impl.ReqValidationDaoImpl" />
- <bean id="newsfeed" class = "com.application.newsfeed.business.impl.newsfeedBusiness" />
- <bean id = "transform" class = "com.application.newsfeed.response.impl.transformResponsetoJSON" />
- <bean id = "getNewsfeeddao" class = "com.curofy.newsfeed.dao.impl.getNewsfeedDaoImpl" />
- <bean id = "getNewsfeed" class = "com.application.newsfeed.svc.getNewsfeed" />
- <bean id="appDataSource" class = "org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:3306/db" />
- <property name="username" value="root" />
- <property name="password" value="sdds" />
- <property name="removeAbandoned" value="true" />
- <property name="removeAbandonedTimeout" value="60" />
- <property name="initialSize" value="20" />
- <property name="maxActive" value="30" />
- </bean>
- <bean id="appJdbcTemplate" class = "org.springframework.jdbc.core.JdbcTemplate">
- <constructor-arg ref = "appDataSource"> </constructor-arg>
- </bean>
- </beans>
- @Service
- @Path("/newsfeed/{username}")
- public class getNewsfeed {
- @Autowired
- private ItransformResponsetoJSON transform;
- @Autowired
- private InewsfeedBusiness newsfeed;
- @GET
- public Response getNewsfeed(@PathParam("username") String username, @QueryParam("page") int page) {
- GetNewsfeedRequestParam requestParams = null;
- Response response = null;
- try{
- requestParams = new GetNewsfeedRequestParam(username,page);
- new GetNewsfeedRequestValidator().validateRequest();
- List<Newsfeed> newsfeedResponse = newsfeed.getNewsfeed(requestParams);
- }catch(Exception e){
- }
- return null;
- }
- }
- When I run this application on server , this is the console log:
- Apr 12, 2016 10:43:50 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
- WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:curofy_app' did not find a matching property.
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Server version: Apache Tomcat/7.0.67
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Server built: Dec 7 2015 13:07:11 UTC
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Server number: 7.0.67.0
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: OS Name: Mac OS X
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: OS Version: 10.10.5
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Architecture: x86_64
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/jre
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: JVM Version: 1.8.0_71-b15
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: JVM Vendor: Oracle Corporation
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: CATALINA_BASE: /Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: CATALINA_HOME: /Users/pgoel/Downloads/apache-tomcat-7.0.67
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Command line argument: -Dcatalina.base=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Command line argument: -Dcatalina.home=/Users/pgoel/Downloads/apache-tomcat-7.0.67
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Command line argument: -Dwtp.deploy=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Command line argument: -Djava.endorsed.dirs=/Users/pgoel/Downloads/apache-tomcat-7.0.67/endorsed
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
- INFO: Command line argument: -Dfile.encoding=UTF-8
- Apr 12, 2016 10:43:50 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
- INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/pgoel/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
- Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
- INFO: Initializing ProtocolHandler ["http-bio-8080"]
- Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
- INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
- Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.Catalina load
- INFO: Initialization processed in 471 ms
- Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardService startInternal
- INFO: Starting service Catalina
- Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardEngine startInternal
- INFO: Starting Servlet Engine: Apache Tomcat/7.0.67
- Apr 12, 2016 10:43:51 AM org.apache.catalina.startup.TldConfig execute
- INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
- Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
- INFO: No Spring WebApplicationInitializer types detected on classpath
- Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
- INFO: Initializing Spring root WebApplicationContext
- Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
- INFO: Root WebApplicationContext: initialization started
- Apr 12, 2016 10:43:51 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
- INFO: Refreshing Root WebApplicationContext: startup date [Tue Apr 12 10:43:51 IST 2016]; root of context hierarchy
- Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
- INFO: Loading XML bean definitions from class path resource [curofyContext.xml]
- Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
- INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3af05cbe: defining beans [org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,userValidation,newsfeed,transform,getNewsfeeddao,getNewsfeed,curofyDataSource,curofyJdbcTemplate]; root of factory hierarchy
- Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
- INFO: Root WebApplicationContext: initialization completed in 300 ms
- Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.PackagesResourceConfig init
- INFO: Scanning for root resource and provider classes in the packages:
- com.curofy.newsfeed.svc
- Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
- INFO: Root resource classes found:
- class com.curofy.newsfeed.svc.getNewsfeed
- Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig init
- INFO: No provider classes found.
- Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
- INFO: Using default applicationContext
- Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
- INFO: Registering Spring bean, getNewsfeed, of type com.curofy.newsfeed.svc.getNewsfeed as a root resource class
- Apr 12, 2016 10:43:51 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
- INFO: Initiating Jersey application, version 'Jersey: 1.17 01/17/2013 03:31 PM'
- Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
- INFO: Starting ProtocolHandler ["http-bio-8080"]
- Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
- INFO: Starting ProtocolHandler ["ajp-bio-8009"]
- Apr 12, 2016 10:43:52 AM org.apache.catalina.startup.Catalina start
- INFO: Server startup in 1473 ms
- http://localhost:8080/services/newsfeed/pgoel2?page=1
Add Comment
Please, Sign In to add comment