Guest User

Untitled

a guest
Apr 12th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.29 KB | None | 0 0
  1. <build>
  2. <finalName>services</finalName>
  3. <plugins>
  4.  
  5. <!-- Enabling and configuring web resources filtering -->
  6. <plugin>
  7. <groupId>org.apache.maven.plugins</groupId>
  8. <artifactId>maven-war-plugin</artifactId>
  9. <version>2.3</version>
  10. </plugin>
  11. </plugins>
  12. <resources>
  13. <resource>
  14. <directory>src/main/java</directory>
  15. <excludes>
  16. <exclude>**/*.java</exclude>
  17. </excludes>
  18. </resource>
  19. <resource>
  20. <directory>src/main/resources</directory>
  21. <excludes>
  22. <exclude>web.xml</exclude>
  23. </excludes>
  24. </resource>
  25. </resources>
  26. </build>
  27.  
  28. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  29. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  30. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  31. version="3.0" metadata-complete="true">
  32.  
  33. <display-name>services</display-name>
  34.  
  35.  
  36. <!-- location of spring xml files. Context-param helps you store the param name and value globally -->
  37. <context-param>
  38. <param-name>contextConfigLocation</param-name>
  39. <param-value>classpath:applicationContext.xml</param-value>
  40. </context-param>
  41.  
  42. <!-- the listener that kick-starts Spring -->
  43. <listener>
  44. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  45. </listener>
  46.  
  47. <servlet>
  48. <servlet-name>Rest service</servlet-name>
  49. <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
  50. <init-param>
  51. <param-name>com.sun.jersey.config.property.packages</param-name>
  52. <param-value>com.application.newsfeed.svc</param-value>
  53. </init-param>
  54. <load-on-startup>1</load-on-startup>
  55.  
  56. </servlet>
  57. <!-- URL patterns -->
  58. <servlet-mapping>
  59. <servlet-name>Rest service</servlet-name>
  60. <url-pattern>/*</url-pattern>
  61. </servlet-mapping>
  62. </web-app>
  63.  
  64. <?xml version="1.0" encoding="UTF-8"?>
  65. <beans xmlns="http://www.springframework.org/schema/beans"
  66. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  67. xmlns:util="http://www.springframework.org/schema/util"
  68. xsi:schemaLocation="http://www.springframework.org/schema/beans
  69. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  70. http://www.springframework.org/schema/context
  71. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  72. http://www.springframework.org/schema/util
  73. http://www.springframework.org/schema/util/spring-util-3.0.xsd
  74. http://www.springframework.org/schema/tx
  75. http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
  76.  
  77. <bean
  78. class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
  79. <property name="targetObject">
  80. <bean
  81. class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
  82. <property name="targetClass" value="java.lang.System" />
  83. <property name="targetMethod" value="getProperties" />
  84. </bean>
  85. </property>
  86.  
  87. <property name="targetMethod" value="putAll" />
  88. <property name="arguments">
  89. <!-- The new Properties -->
  90. <util:properties>
  91. <prop key="jsse.enableSNIExtension">false</prop>
  92. </util:properties>
  93. </property>
  94. </bean>
  95.  
  96. <bean id="userValidation" class = "com.application.newsfeed.dao.impl.ReqValidationDaoImpl" />
  97.  
  98. <bean id="newsfeed" class = "com.application.newsfeed.business.impl.newsfeedBusiness" />
  99.  
  100. <bean id = "transform" class = "com.application.newsfeed.response.impl.transformResponsetoJSON" />
  101.  
  102. <bean id = "getNewsfeeddao" class = "com.curofy.newsfeed.dao.impl.getNewsfeedDaoImpl" />
  103.  
  104. <bean id = "getNewsfeed" class = "com.application.newsfeed.svc.getNewsfeed" />
  105.  
  106. <bean id="appDataSource" class = "org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  107. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  108. <property name="url" value="jdbc:mysql://localhost:3306/db" />
  109. <property name="username" value="root" />
  110. <property name="password" value="sdds" />
  111. <property name="removeAbandoned" value="true" />
  112. <property name="removeAbandonedTimeout" value="60" />
  113. <property name="initialSize" value="20" />
  114. <property name="maxActive" value="30" />
  115. </bean>
  116.  
  117. <bean id="appJdbcTemplate" class = "org.springframework.jdbc.core.JdbcTemplate">
  118. <constructor-arg ref = "appDataSource"> </constructor-arg>
  119.  
  120. </bean>
  121.  
  122. </beans>
  123.  
  124. @Service
  125. @Path("/newsfeed/{username}")
  126. public class getNewsfeed {
  127.  
  128. @Autowired
  129. private ItransformResponsetoJSON transform;
  130.  
  131. @Autowired
  132. private InewsfeedBusiness newsfeed;
  133.  
  134. @GET
  135. public Response getNewsfeed(@PathParam("username") String username, @QueryParam("page") int page) {
  136.  
  137. GetNewsfeedRequestParam requestParams = null;
  138.  
  139. Response response = null;
  140.  
  141.  
  142. try{
  143. requestParams = new GetNewsfeedRequestParam(username,page);
  144. new GetNewsfeedRequestValidator().validateRequest();
  145. List<Newsfeed> newsfeedResponse = newsfeed.getNewsfeed(requestParams);
  146.  
  147. }catch(Exception e){
  148.  
  149. }
  150. return null;
  151.  
  152. }
  153. }
  154.  
  155. When I run this application on server , this is the console log:
  156.  
  157.  
  158. Apr 12, 2016 10:43:50 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
  159. WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:curofy_app' did not find a matching property.
  160. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  161. INFO: Server version: Apache Tomcat/7.0.67
  162. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  163. INFO: Server built: Dec 7 2015 13:07:11 UTC
  164. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  165. INFO: Server number: 7.0.67.0
  166. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  167. INFO: OS Name: Mac OS X
  168. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  169. INFO: OS Version: 10.10.5
  170. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  171. INFO: Architecture: x86_64
  172. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  173. INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/jre
  174. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  175. INFO: JVM Version: 1.8.0_71-b15
  176. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  177. INFO: JVM Vendor: Oracle Corporation
  178. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  179. INFO: CATALINA_BASE: /Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
  180. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  181. INFO: CATALINA_HOME: /Users/pgoel/Downloads/apache-tomcat-7.0.67
  182. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  183. INFO: Command line argument: -Dcatalina.base=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
  184. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  185. INFO: Command line argument: -Dcatalina.home=/Users/pgoel/Downloads/apache-tomcat-7.0.67
  186. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  187. INFO: Command line argument: -Dwtp.deploy=/Users/pgoel/Documents/workspace-sts-3.7.2.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
  188. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  189. INFO: Command line argument: -Djava.endorsed.dirs=/Users/pgoel/Downloads/apache-tomcat-7.0.67/endorsed
  190. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.VersionLoggerListener log
  191. INFO: Command line argument: -Dfile.encoding=UTF-8
  192. Apr 12, 2016 10:43:50 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
  193. 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:.
  194. Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
  195. INFO: Initializing ProtocolHandler ["http-bio-8080"]
  196. Apr 12, 2016 10:43:50 AM org.apache.coyote.AbstractProtocol init
  197. INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  198. Apr 12, 2016 10:43:50 AM org.apache.catalina.startup.Catalina load
  199. INFO: Initialization processed in 471 ms
  200. Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardService startInternal
  201. INFO: Starting service Catalina
  202. Apr 12, 2016 10:43:50 AM org.apache.catalina.core.StandardEngine startInternal
  203. INFO: Starting Servlet Engine: Apache Tomcat/7.0.67
  204. Apr 12, 2016 10:43:51 AM org.apache.catalina.startup.TldConfig execute
  205. 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.
  206. Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
  207. INFO: No Spring WebApplicationInitializer types detected on classpath
  208. Apr 12, 2016 10:43:51 AM org.apache.catalina.core.ApplicationContext log
  209. INFO: Initializing Spring root WebApplicationContext
  210. Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
  211. INFO: Root WebApplicationContext: initialization started
  212. Apr 12, 2016 10:43:51 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  213. INFO: Refreshing Root WebApplicationContext: startup date [Tue Apr 12 10:43:51 IST 2016]; root of context hierarchy
  214. Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  215. INFO: Loading XML bean definitions from class path resource [curofyContext.xml]
  216. Apr 12, 2016 10:43:51 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  217. 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
  218. Apr 12, 2016 10:43:51 AM org.springframework.web.context.ContextLoader initWebApplicationContext
  219. INFO: Root WebApplicationContext: initialization completed in 300 ms
  220. Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.PackagesResourceConfig init
  221. INFO: Scanning for root resource and provider classes in the packages:
  222. com.curofy.newsfeed.svc
  223. Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
  224. INFO: Root resource classes found:
  225. class com.curofy.newsfeed.svc.getNewsfeed
  226. Apr 12, 2016 10:43:51 AM com.sun.jersey.api.core.ScanningResourceConfig init
  227. INFO: No provider classes found.
  228. Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
  229. INFO: Using default applicationContext
  230. Apr 12, 2016 10:43:51 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
  231. INFO: Registering Spring bean, getNewsfeed, of type com.curofy.newsfeed.svc.getNewsfeed as a root resource class
  232. Apr 12, 2016 10:43:51 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
  233. INFO: Initiating Jersey application, version 'Jersey: 1.17 01/17/2013 03:31 PM'
  234. Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
  235. INFO: Starting ProtocolHandler ["http-bio-8080"]
  236. Apr 12, 2016 10:43:52 AM org.apache.coyote.AbstractProtocol start
  237. INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  238. Apr 12, 2016 10:43:52 AM org.apache.catalina.startup.Catalina start
  239. INFO: Server startup in 1473 ms
  240.  
  241. http://localhost:8080/services/newsfeed/pgoel2?page=1
Add Comment
Please, Sign In to add comment