diff --git a/YahooServlet.java b/YahooServlet.java new file mode 100644 index 0000000..b3b0a57 --- /dev/null +++ b/YahooServlet.java @@ -0,0 +1,29 @@ +package com.origamisoftware.teach.advanced.services; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Calendar; +import javax.servlet.http.*; + +/** + * BasicServlet request data from the web service that is used by the WebStockService + */ +public class YahooServlet extends HttpServlet{ + private String symbol; + private Calendar d1, d2; + + public YahooServlet(String symbol, Calendar from, Calendar until){ + this.symbol = symbol; + this.d1 = from; + this.d2 = until; + } + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + + PrintWriter out = response.getWriter(); + out.println(""); + out.println(""); + out.println("http://finance.yahoo.com/d/quotes.csv?s="+ symbol + "&f=" + d1 + d2); + out.println(""); + out.println(""); + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index a6da30f..9429aac 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,124 @@ - - 4.0.0 - edu.isaacVazquez.advancedjava - isaacVazquez-app - jar - 1.0-SNAPSHOT - isaacVazquez-app - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - + + 4.0.0 + com.origamisoftware.teach.effective + week-6-stock-ticker-solution + jar + 1.0-SNAPSHOT + week-6-stock-ticker-solution + http://maven.apache.org + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + -Xlint + ${project.build.sourceEncoding} + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + true + + + + + + + + + + junit + junit + 4.10 + jar + + + + mysql + mysql-connector-java + 5.1.6 + + + + javax.validation + validation-api + 1.0.0.GA + + + + org.mockito + mockito-all + 1.9.5 + + + + org.apache.httpcomponents + httpcore + 4.4 + + + + org.apache.ibatis + ibatis-sqlmap + 2.3.4.726 + + + + org.hibernate + hibernate-core + 4.2.6.Final + + + + org.hibernate.javax.persistence + hibernate-jpa-2.0-api + 1.0.1.Final + + + + com.yahoofinance-api + YahooFinanceAPI + x.y.z + + + + javax.servlet + jstl + 1.2 + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + javax.servlet.jsp.jstl + jstl-api + 1.2 + + + org.hibernate + hibernate-core + 4.2.6.Final + + + diff --git a/stockQuote.jsp b/stockQuote.jsp new file mode 100644 index 0000000..2f2d8cb --- /dev/null +++ b/stockQuote.jsp @@ -0,0 +1,46 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + + + + + + Stock Quote Request + + +

+ Please enter StockQuery information:
+

+

+

+ Retrieve Data form the Database: +

+
+ Stock Symbol :
+ Stock Date From :
+ Stock Date Until :
+ Stock Date Interval :
+ + +
+

+ Retrieve Data form the Yahoo Finance Web App: +

+
+ Stock Symbol :
+ Stock Date From : '>
+ Stock Date Until : '>
+ + +
+ + + diff --git a/stockQuoteResults.jsp b/stockQuoteResults.jsp new file mode 100644 index 0000000..b738c10 --- /dev/null +++ b/stockQuoteResults.jsp @@ -0,0 +1,28 @@ + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ page import="javax.servlet.http.*" %> + + + + + + + + + + Stock Quote Query Results + + +

Your Stock Quote

+ +Symbol: <%= StockQuery.getSymbol() %> +Date From: <%= StockQuery.getFrom() %> +Date Until: <%= StockQuery.getUntil() %> +Interval in Minutes: <%= Interval.getMinutes() %> + +<%= +YahooServlet.doGet(HttpServletRequest request, HttpServletResponse response) +%> +Thank you! + +