├── .gitignore ├── ETL ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.sonar.ide.eclipse.core.prefs ├── README.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── assign │ │ │ ├── domain │ │ │ ├── Assignment.java │ │ │ └── UTCourse.java │ │ │ └── service │ │ │ ├── DBLoader.java │ │ │ ├── ETLController.java │ │ │ ├── EavesdropReader.java │ │ │ └── Transformer.java │ └── resources │ │ └── hibernate.cfg.xml │ └── test │ └── java │ └── assign │ └── etl │ └── TestDBLoader.java ├── Eclipse └── README ├── HTTP ├── Base64EncodeDecode.java ├── README.txt ├── RangeRequest.java ├── TestClientSocket.java ├── TestURLConnection.java └── TestUserAgentHeader.java ├── Hibernate ├── README.txt ├── WebContent │ └── WEB-INF │ │ └── web.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── assign │ │ │ ├── domain │ │ │ ├── Assignment.java │ │ │ ├── Homework.java │ │ │ └── UTCourse.java │ │ │ └── service │ │ │ └── DBLoader.java │ └── resources │ │ └── hibernate.cfg.xml │ └── test │ └── java │ └── assign │ └── service │ └── TestDBLoader.java ├── JDBC ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.sonar.ide.eclipse.core.prefs ├── README.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── assign │ │ │ ├── domain │ │ │ └── Course.java │ │ │ ├── resources │ │ │ ├── UTCoursesApplication.java │ │ │ └── UTCoursesResource.java │ │ │ └── services │ │ │ ├── CourseStudentService.java │ │ │ └── CourseStudentServiceImpl.java │ ├── resources │ │ └── schema.ddl │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── assign │ └── services │ └── TestCourseStudentServiceImpl.java ├── JavaScript-Example ├── Heroku │ ├── Procfile │ ├── README │ ├── pom.xml │ └── system.properties ├── README └── js-example │ ├── .classpath │ ├── .project │ ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── js │ │ ├── HelloWorldApplication.java │ │ └── HelloWorldResource.java │ └── webapp │ ├── WEB-INF │ └── web.xml │ ├── ajaxexample.html │ ├── ajaxexample2.html │ ├── myscript.js │ └── test.html ├── JavaScript ├── README └── assignment7 │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── assignment7 │ │ ├── HelloWorldApplication.java │ │ └── HelloWorldResource.java │ └── webapp │ ├── WEB-INF │ └── web.xml │ ├── ajaxexample-snapshot.html │ ├── ajaxexample.html │ ├── myscript.js │ └── test.html ├── Notes └── unit-testing ├── Project Templates └── assignment3 │ ├── .classpath │ ├── .project │ ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs │ ├── WebContent │ ├── META-INF │ │ └── MANIFEST.MF │ └── WEB-INF │ │ └── web.xml │ ├── pom.xml │ └── target │ └── m2e-wtp │ └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── assignment3 │ └── assignment3 │ ├── pom.properties │ └── pom.xml ├── README.md ├── REST-JDBC ├── README.txt ├── WebContent │ └── WEB-INF │ │ └── web.xml ├── pom.xml └── src │ ├── main │ └── java │ │ └── assign │ │ ├── domain │ │ ├── Course.java │ │ ├── Courses.java │ │ ├── NewCourse.java │ │ ├── NotFound.java │ │ ├── Project.java │ │ └── Projects.java │ │ ├── resources │ │ ├── UTCoursesApplication.java │ │ └── UTCoursesResource.java │ │ └── services │ │ ├── CourseStudentService.java │ │ └── CourseStudentServiceImpl.java │ ├── resources │ └── schema.ddl │ └── test │ └── java │ └── assign │ └── services │ └── TestCourseStudentServiceImpl.java ├── REST ├── README └── resteasy │ ├── WebContent │ └── WEB-INF │ │ └── web.xml │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── assign │ │ ├── domain │ │ ├── Course.java │ │ ├── Courses.java │ │ ├── Project.java │ │ └── Projects.java │ │ ├── resources │ │ ├── UTCoursesApplication.java │ │ └── UTCoursesResource.java │ │ └── services │ │ ├── EavesdropService.java │ │ └── EavesdropServiceImpl.java │ └── test │ └── java │ └── assign │ └── resources │ └── TestUTCoursesResource.java ├── React ├── App.css ├── App.js └── README.md ├── Servlets ├── .gitignore ├── README.md ├── TestHttPClientSocket.java ├── TestServerSocket.java ├── TestServlet.java ├── example-pom │ └── pom.xml ├── filter-order-example │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── ErrorHandler.java │ │ ├── FilterA.java │ │ ├── FilterB.java │ │ ├── FilterC.java │ │ ├── ItemNotFound.java │ │ ├── ServletOne.java │ │ ├── ServletThree.java │ │ └── ServletTwo.java ├── hello-world │ ├── .gitignore │ ├── README │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ └── HelloServlet.java ├── mockito-example │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .jsdtscope │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ ├── org.eclipse.wst.validation.prefs │ │ └── org.sonar.ide.eclipse.core.prefs │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ ├── servletContext.xml │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ ├── EditorService.java │ │ │ ├── EmailController.java │ │ │ └── EnglishEditorServiceImpl.java │ │ └── test │ │ └── java │ │ ├── TestEmailController.java │ │ └── TestEnglishEditorServiceImpl.java ├── query-parameters │ ├── .gitignore │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ └── TestQueryParameters.java ├── servlet-unit-test │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ ├── CalculatorService.java │ │ │ ├── CalculatorServiceImpl.java │ │ │ ├── HelloServlet.java │ │ │ ├── JSoupService.java │ │ │ └── JSoupServiceImpl.java │ │ └── test │ │ └── java │ │ ├── TestCalculatorServiceImpl.java │ │ └── TestHelloServlet.java ├── session-example │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .jsdtscope │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ └── org.eclipse.wst.jsdt.ui.superType.name │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ └── TestSession.java ├── spring-email-service │ ├── .gitignore │ ├── .project │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ ├── servletContext.xml │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── EditorService.java │ │ ├── EmailController.java │ │ ├── EnglishEditorServiceImpl.java │ │ └── SpanishEditorServiceImpl.java ├── test-jsoup-1 │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .jsdtscope │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ ├── org.eclipse.wst.validation.prefs │ │ └── org.sonar.ide.eclipse.core.prefs │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── JSoupHandler.java │ │ ├── JSoupServlet.java │ │ └── TestJSoupServlet.java ├── test-load-on-startup │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .jsdtscope │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ └── org.eclipse.wst.jsdt.ui.superType.name │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ └── TestingLoadOnStartup.java ├── test-servlet.sh ├── test-thread-servlet │ ├── .gitignore │ ├── WebContent │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ └── TestingThreadServlet.java └── url-rewriting │ ├── WebContent │ ├── META-INF │ │ └── MANIFEST.MF │ └── WEB-INF │ │ └── web.xml │ ├── pom.xml │ └── src │ └── TestSession.java ├── Vagrantfile ├── XMLParsing ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ └── org.eclipse.wst.jsdt.ui.superType.name ├── README.md ├── jaxb-example │ ├── .classpath │ ├── .project │ ├── .settings │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── pom.xml │ ├── src │ │ ├── JAXBExample.java │ │ ├── Response.java │ │ └── Row.java │ └── target │ │ └── classes │ │ ├── JAXBExample.class │ │ ├── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ │ └── jaxb-example │ │ │ └── jaxb-example │ │ │ ├── pom.properties │ │ │ └── pom.xml │ │ ├── Response.class │ │ └── Row.class └── src │ ├── DOMParser.java │ ├── RegexParser.java │ ├── SAXParser.java │ ├── XPathParser.java │ ├── cs378.html │ ├── cs378.not_well_formed.html │ ├── cs378.xml │ ├── heat_irclogs.html │ └── heat_output.xml ├── assignment-templates ├── assignment3 │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── .jsdtscope │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ ├── org.eclipse.wst.common.component │ │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ │ ├── org.eclipse.wst.common.project.facet.core.xml │ │ ├── org.eclipse.wst.jsdt.ui.superType.container │ │ ├── org.eclipse.wst.jsdt.ui.superType.name │ │ └── org.eclipse.wst.validation.prefs │ ├── README │ ├── WebContent │ │ └── WEB-INF │ │ │ ├── beans.xml │ │ │ └── web.xml │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── assign │ │ │ ├── domain │ │ │ ├── Course.java │ │ │ ├── Courses.java │ │ │ ├── Project.java │ │ │ └── Projects.java │ │ │ ├── resources │ │ │ ├── UTCoursesApplication.java │ │ │ └── UTCoursesResource.java │ │ │ └── services │ │ │ └── EavesdropService.java │ │ └── test │ │ └── java │ │ └── assign │ │ └── resources │ │ └── TestUTCoursesResource.java └── assignment4 │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs │ ├── README.txt │ ├── WebContent │ └── WEB-INF │ │ └── web.xml │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── assign │ │ ├── domain │ │ ├── Course.java │ │ ├── Courses.java │ │ ├── NewCourse.java │ │ ├── NotFound.java │ │ ├── Project.java │ │ └── Projects.java │ │ ├── resources │ │ ├── UTCoursesApplication.java │ │ ├── UTCoursesResource.java │ │ └── UTCoursesResource.java~ │ │ └── services │ │ ├── CourseStudentService.java │ │ └── CourseStudentServiceImpl.java │ ├── resources │ └── schema.ddl │ └── test │ └── java │ └── assign │ ├── resources │ └── TestUTCoursesResource.java │ └── services │ └── TestCourseStudentServiceImpl.java ├── flask ├── .DS_Store ├── README.md ├── application.py ├── commands.txt ├── lesson.json ├── lesson1.json ├── myapp.log ├── requirements.txt ├── start-app.sh ├── static │ └── scripts │ │ └── musicmarketplace.js ├── stop-app.sh ├── templates │ ├── index.html │ └── musicmarketplace.html ├── test.py ├── test.sh └── wsgi.py ├── html-css-js ├── bootstrap-examples.html ├── chakra.png ├── france-bootstrap.html ├── france.html ├── iframe.html ├── index.html ├── india.html ├── learnmusic.html ├── star.png ├── texas.html ├── tic-tac-toe-css.html └── tic-tac-toe.html ├── logging-example ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ └── org.sonar.ide.eclipse.core.prefs ├── pom.xml └── src │ └── test │ └── java │ └── TestLogger.java ├── musicmarketplace-google-oauth ├── README.md ├── oauthexample.py ├── requirements.txt ├── static │ └── scripts │ │ └── musicmarketplace.js └── templates │ ├── index.html │ ├── login.html │ └── musicmarketplace.html ├── musicmarketplace ├── README.md ├── application.py ├── requirements.txt ├── start-app.sh ├── static │ ├── scripts │ │ └── musicmarketplace.js │ └── styles │ │ └── musicmarketplace.css ├── stop-app.sh ├── templates │ ├── index.html │ └── musicmarketplace.html └── wsgi.py ├── photo-portal ├── assignment1 │ ├── photo-portal-template.html │ └── react │ │ ├── App.css │ │ ├── App.js │ │ ├── index.html │ │ ├── index.js │ │ └── steps.txt ├── assignment2 │ ├── README │ ├── application.py │ ├── requirements.txt │ ├── static │ │ ├── images │ │ │ └── longhorn.png │ │ └── scripts │ │ │ └── photo-portal.js │ └── templates │ │ ├── adminindex.html │ │ └── photo-portal.html ├── assignment3 │ ├── README │ ├── application.py │ ├── requirements.txt │ ├── static │ │ ├── images │ │ │ └── longhorn.png │ │ └── scripts │ │ │ └── photo-portal.js │ └── templates │ │ ├── adminindex.html │ │ ├── index.html │ │ └── photo-portal.html └── assignment4 │ ├── README │ ├── admin.json │ ├── application.py │ ├── requirements.txt │ ├── static │ ├── images │ │ └── longhorn.png │ └── scripts │ │ └── photo-portal.js │ └── templates │ ├── adminindex.html │ ├── google-oauth-client-secrets-file-missing.html │ ├── index.html │ └── photo-portal.html └── weather-portal-templates ├── assignment2 ├── README ├── application.py ├── requirements.txt ├── static │ ├── images │ │ └── longhorn.png │ └── scripts │ │ └── inputhandler.js └── templates │ ├── adminindex.html │ ├── index.html │ └── welcome.html ├── assignment3 ├── README ├── admin.json ├── application.py ├── austin.json ├── dallas.json ├── houston.json ├── requirements.txt ├── san-antonio.json ├── static │ ├── images │ │ └── longhorn.png │ └── scripts │ │ └── inputhandler.js ├── steps.txt ├── templates │ ├── adminindex.html │ ├── index.html │ └── welcome.html ├── user-city-austin.json ├── user-city-dallas.json ├── user-city-san-antonio.json └── user.json ├── assignment4-template ├── README ├── admin.json ├── application.py ├── austin.json ├── dallas.json ├── data.orig │ ├── Austin │ ├── Dallas │ └── Houston ├── data.test │ └── Austin ├── data │ ├── Austin │ └── Dallas ├── houston.json ├── requirements.txt ├── san-antonio.json ├── static │ ├── images │ │ └── longhorn.png │ └── scripts │ │ └── inputhandler.js ├── steps.txt ├── templates │ ├── adminindex.html │ ├── index.html │ ├── not-found.html │ └── welcome.html ├── test-requests.py ├── user-city-austin.json ├── user-city-dallas.json ├── user-city-san-antonio.json ├── user1.json ├── user2.json └── weatherportal.db.1 └── assignment5 ├── README ├── admin.json ├── application.py ├── requirements.txt ├── static ├── images │ └── longhorn.png └── scripts │ └── inputhandler.js ├── steps-https.txt ├── steps.txt ├── templates ├── adminindex.html ├── google-oauth-client-secrets-file-missing.html ├── index.html ├── not-found.html └── welcome.html ├── user-city-austin.json ├── user-city-dallas.json ├── user-city-san-antonio.json ├── user.json ├── user1.json └── user2.json /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | 3 | -------------------------------------------------------------------------------- /ETL/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ETL/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | assignment6 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.jem.workbench.JavaEMFNature 36 | org.eclipse.wst.common.modulecore.ModuleCoreNature 37 | org.sonar.ide.eclipse.core.sonarNature 38 | org.eclipse.m2e.core.maven2Nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.common.project.facet.core.nature 41 | org.eclipse.wst.jsdt.core.jsNature 42 | 43 | 44 | -------------------------------------------------------------------------------- /ETL/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /ETL/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /ETL/.settings/org.sonar.ide.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | extraProperties= 3 | projectKey=assignment6\:assignment6 4 | serverUrl=http\://localhost\:9000 5 | version=2 6 | -------------------------------------------------------------------------------- /ETL/src/main/java/assign/service/ETLController.java: -------------------------------------------------------------------------------- 1 | package assign.etl; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class ETLController { 7 | 8 | EavesdropReader reader; 9 | Transformer transformer; 10 | DBLoader loader; 11 | 12 | public ETLController() { 13 | transformer = new Transformer(); 14 | loader = new DBLoader(); 15 | } 16 | 17 | public static void main(String[] args) { 18 | ETLController etlController = new ETLController(); 19 | etlController.performETLActions(); 20 | } 21 | 22 | private void performETLActions() { 23 | try { 24 | 25 | String source = "http://eavesdrop.openstack.org/meetings/solum/"; 26 | reader = new EavesdropReader(source); 27 | 28 | // Read data 29 | Map> data = reader.readData(); 30 | 31 | // Transform data 32 | Map> transformedData = transformer.transform(data); 33 | 34 | // Load data 35 | loader.loadData(transformedData); 36 | 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ETL/src/main/java/assign/service/EavesdropReader.java: -------------------------------------------------------------------------------- 1 | package assign.etl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.logging.*; 7 | 8 | public class EavesdropReader { 9 | 10 | String url; 11 | Logger logger; 12 | 13 | public EavesdropReader(String url) { 14 | this.url = url; 15 | 16 | logger = Logger.getLogger("EavesdropReader"); 17 | } 18 | 19 | /* 20 | * Return a map where the contents of map is a single entry: 21 | * 22 | */ 23 | public Map> readData() { 24 | 25 | logger.info("Inside readData."); 26 | 27 | Map> data = new HashMap>(); 28 | 29 | // Read and parse data from this.url 30 | 31 | return data; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ETL/src/main/java/assign/service/Transformer.java: -------------------------------------------------------------------------------- 1 | package assign.etl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.logging.*; 7 | 8 | public class Transformer { 9 | 10 | Logger logger; 11 | 12 | public Transformer() { 13 | logger = Logger.getLogger("Transformer"); 14 | } 15 | 16 | public Map> transform(Map> data) { 17 | // Transform the passed in data as required; 18 | // return the transformed data; 19 | 20 | logger.info("Inside transform."); 21 | 22 | Map> newData = new HashMap>(); 23 | 24 | // transform data into newData 25 | 26 | return newData; 27 | } 28 | } -------------------------------------------------------------------------------- /Eclipse/README: -------------------------------------------------------------------------------- 1 | Eclipse tips: 2 | 3 | 1) How to change Java font: 4 | Preferences -> General -> Appearance -> Colors and Fonts -> Java Editor Text Font 5 | 6 | 2) How to change console font: 7 | Preferences -> General -> Appearance -> Colors and Fonts -> Debug -> Console font 8 | 9 | 3) How to change size of Package explorer (on Mac OS X): 10 | - Download and run TinkerTool (http://www.bresink.com/osx/TinkerTool.html) 11 | - Change Help Tags 12 | 13 | 4) How to change font size of xml files: 14 | - Preferences -> General -> Appearance -> Colors and Fonts -> Text Font -------------------------------------------------------------------------------- /HTTP/Base64EncodeDecode.java: -------------------------------------------------------------------------------- 1 | public class Base64EncodeDecode { 2 | 3 | /* 4 | * Reference http://ykchee.blogspot.com/2014/03/base64-in-java-8-its-not-too-late-to.html 5 | * 6 | */ 7 | public void testJava8Base64Encode() throws Exception { 8 | String usernamePassword = "Aladdin:open sesame"; 9 | byte[] randomBinaryData = usernamePassword.getBytes("UTF-8"); 10 | 11 | java.util.Base64.Encoder encoder = java.util.Base64.getEncoder(); 12 | byte[] encoded = encoder.encode(randomBinaryData); 13 | 14 | String encodedString = new String(encoded); 15 | 16 | System.out.println("Encoded string:[" + encodedString + "]"); 17 | } 18 | 19 | public static void main(String [] args) { 20 | Base64EncodeDecode test = new Base64EncodeDecode(); 21 | try { 22 | test.testJava8Base64Encode(); 23 | } catch (Exception exp) { 24 | exp.printStackTrace(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Hibernate/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Resteasy 9 | 10 | org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 11 | 12 | 13 | 14 | 15 | Resteasy 16 | /resteasy-hibernate 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /JDBC/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JDBC/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /JDBC/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JDBC 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.jem.workbench.JavaEMFNature 36 | org.eclipse.wst.common.modulecore.ModuleCoreNature 37 | org.sonar.ide.eclipse.core.sonarNature 38 | org.eclipse.m2e.core.maven2Nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.common.project.facet.core.nature 41 | org.eclipse.wst.jsdt.core.jsNature 42 | 43 | 44 | -------------------------------------------------------------------------------- /JDBC/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /JDBC/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /JDBC/.settings/org.sonar.ide.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | extraProperties= 3 | projectKey=assignment5\:assignment5 4 | serverUrl=http\://localhost\:9000 5 | version=2 6 | -------------------------------------------------------------------------------- /JDBC/src/main/java/assign/domain/Course.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Course { 12 | 13 | String name; 14 | String course_num; 15 | int course_id; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getCourseNum() { 26 | return course_num; 27 | } 28 | 29 | public void setCourseNum(String course_num) { 30 | this.course_num = course_num; 31 | } 32 | 33 | public int getCourseId() { 34 | return course_id; 35 | } 36 | 37 | public void setCourseId(int course_id) { 38 | this.course_id = course_id; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /JDBC/src/main/java/assign/resources/UTCoursesApplication.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 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 | import javax.ws.rs.core.Context; 9 | 10 | import org.jboss.resteasy.core.Dispatcher; 11 | 12 | @ApplicationPath("/assignment5") 13 | public class UTCoursesApplication extends Application { 14 | 15 | private Set singletons = new HashSet(); 16 | private Set> classes = new HashSet>(); 17 | 18 | public UTCoursesApplication() { 19 | } 20 | 21 | @Override 22 | public Set> getClasses() { 23 | classes.add(UTCoursesResource.class); 24 | return classes; 25 | } 26 | 27 | @Override 28 | public Set getSingletons() { 29 | return singletons; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /JDBC/src/main/java/assign/services/CourseStudentService.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | import assign.domain.Course; 4 | 5 | public interface CourseStudentService { 6 | 7 | public Course addCourse(Course c) throws Exception; 8 | 9 | public Course getCourse(int courseId) throws Exception; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /JDBC/src/main/resources/schema.ddl: -------------------------------------------------------------------------------- 1 | create table courses(name varchar(255) NOT NULL, course_num varchar(20) NOT NULL, course_id int NOT NULL AUTO_INCREMENT, PRIMARY KEY(course_id)); 2 | 3 | create table students(name varchar(255) NOT NULL, student_id int AUTO_INCREMENT, course_id int, PRIMARY KEY(student_id), FOREIGN KEY(course_id) REFERENCES courses(course_id)); 4 | 5 | insert into courses(name, course_num) values("Data Management", "CS347"); 6 | 7 | insert into students(name) values("Student 2"); 8 | 9 | insert into students(name, course_id) values("Student 4", (select course_id from courses where course_num="CS378")); 10 | 11 | select * from (students join courses on students.course_id = courses.course_id) where courses.course_num="CS378"; 12 | 13 | select * from (students join courses on students.course_id = courses.course_id); 14 | 15 | select * from (students left outer join courses on students.course_id = courses.course_id); 16 | 17 | select * from (students right outer join courses on students.course_id = courses.course_id); -------------------------------------------------------------------------------- /JDBC/src/test/java/assign/services/TestCourseStudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | 8 | import assign.domain.Course; 9 | 10 | public class TestCourseStudentServiceImpl { 11 | 12 | CourseStudentService csService = null; 13 | 14 | @Before 15 | public void setUp() { 16 | String dburl = "jdbc:mysql://localhost:3306/student_courses"; 17 | String dbusername = "devdatta"; 18 | String dbpassword = ""; 19 | csService = new CourseStudentServiceImpl(dburl, dbusername, dbpassword); 20 | } 21 | 22 | @Test 23 | public void testCourseAddition() { 24 | try { 25 | Course c = new Course(); 26 | c.setName("Introduction to Computer Science."); 27 | c.setCourseNum("CS101"); 28 | c = csService.addCourse(c); 29 | 30 | Course c1 = csService.getCourse(c.getCourseId()); 31 | 32 | assertEquals(c1.getName(), c.getName()); 33 | assertEquals(c1.getCourseNum(), c.getCourseNum()); 34 | assertEquals(c1.getCourseId(), c.getCourseId()); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /JavaScript-Example/Heroku/Procfile: -------------------------------------------------------------------------------- 1 | web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war -------------------------------------------------------------------------------- /JavaScript-Example/Heroku/README: -------------------------------------------------------------------------------- 1 | Deploying web app on Heroku (PaaS approach) 2 | 3 | 1. Signup for a Heroku Account 4 | - https://www.heroku.com/ 5 | 6 | 2. Install Heroku CLI 7 | - https://devcenter.heroku.com/articles/heroku-command-line 8 | 9 | 3. Copy Procfile, pom.xml, and system.properties from Heroku folder inside JavaScript-Example to js-example/ 10 | 11 | 4. Copy js-example to a temporary folder 12 | - cp js-example /tmp/. 13 | 14 | 5. Switch to the js-example folder in the temporary location 15 | - cd /tmp/js-example 16 | 17 | 6. Setup up application on Heroku 18 | - heroku create 19 | 20 | 7. Initialize the application with source code 21 | - git init 22 | - git add . 23 | - git commit -m “Deploying app to Heroku” 24 | 25 | 8. Deploy to Heroku 26 | - git push heroku master 27 | 28 | 9. Test the application 29 | - https://.herokuapp.com/test.html 30 | - https://.herokuapp.com/ajaxexample.html 31 | 32 | References: 33 | - https://devcenter.heroku.com/articles/deploy-a-java-web-application-that-launches-with-jetty-runner -------------------------------------------------------------------------------- /JavaScript-Example/Heroku/system.properties: -------------------------------------------------------------------------------- 1 | java.runtime.version=1.8 2 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | js-example 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.jem.workbench.JavaEMFNature 36 | org.eclipse.wst.common.modulecore.ModuleCoreNature 37 | org.eclipse.jdt.core.javanature 38 | org.eclipse.m2e.core.maven2Nature 39 | org.eclipse.wst.common.project.facet.core.nature 40 | org.eclipse.wst.jsdt.core.jsNature 41 | 42 | 43 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.compliance=1.6 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.6 9 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /JavaScript-Example/js-example/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/java/js/HelloWorldApplication.java: -------------------------------------------------------------------------------- 1 | package js; 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 | @ApplicationPath("/app") 10 | public class HelloWorldApplication extends Application { 11 | 12 | private Set singletons = new HashSet(); 13 | private Set> classes = new HashSet>(); 14 | 15 | public HelloWorldApplication() { 16 | } 17 | 18 | @Override 19 | public Set> getClasses() { 20 | classes.add(HelloWorldResource.class); 21 | return classes; 22 | } 23 | 24 | @Override 25 | public Set getSingletons() { 26 | return singletons; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/java/js/HelloWorldResource.java: -------------------------------------------------------------------------------- 1 | package js; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.Produces; 6 | 7 | @Path("/path") 8 | public class HelloWorldResource { 9 | 10 | public HelloWorldResource() { 11 | 12 | } 13 | 14 | @GET 15 | @Path("/helloworld-resource") 16 | @Produces("text/html") 17 | public String helloWorld() { 18 | System.out.println("Inside helloworld"); 19 | return "Hello world "; 20 | } 21 | 22 | @GET 23 | @Path("/helloworld-austin") 24 | @Produces("text/html") 25 | public String helloAustin() { 26 | System.out.println("Inside helloAustin"); 27 | return "Hello Austin "; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | javax.ws.rs.Application 9 | js.HelloWorldApplication 10 | 11 | 12 | 13 | Resteasy 14 | 15 | org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 16 | 17 | 18 | 19 | 20 | Resteasy 21 | /app 22 | 23 | 24 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/webapp/ajaxexample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | 33 | 34 | 35 |

Let AJAX change this text

36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/webapp/myscript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | 5 | function myFunction() { 6 | var x, text; 7 | 8 | // Get the value of input field with id="numb" 9 | 10 | x = document.getElementById("numb").value; 11 | 12 | // If x is Not a Number or less than one or greater than 10 13 | 14 | if (isNaN(x) || x < 1 || x > 10) { 15 | text = "Invalid input."; 16 | } else { 17 | text = "Correct input."; 18 | } 19 | document.getElementById("demo").innerHTML = text; 20 | 21 | console.log("Testing console."); 22 | console.log(text); 23 | } -------------------------------------------------------------------------------- /JavaScript-Example/js-example/src/main/webapp/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Please input a number between 1 and 10:

11 | 12 | 13 | 14 | 15 | 16 |

17 | 18 | 19 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/java/assignment7/HelloWorldApplication.java: -------------------------------------------------------------------------------- 1 | package assignment7; 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 | @ApplicationPath("/assignment7") 10 | public class HelloWorldApplication extends Application { 11 | 12 | private Set singletons = new HashSet(); 13 | private Set> classes = new HashSet>(); 14 | 15 | public HelloWorldApplication() { 16 | } 17 | 18 | @Override 19 | public Set> getClasses() { 20 | classes.add(HelloWorldResource.class); 21 | return classes; 22 | } 23 | 24 | @Override 25 | public Set getSingletons() { 26 | return singletons; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/java/assignment7/HelloWorldResource.java: -------------------------------------------------------------------------------- 1 | package assignment7; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.Produces; 6 | 7 | @Path("/helloworld") 8 | public class HelloWorldResource { 9 | 10 | public HelloWorldResource() { 11 | 12 | } 13 | 14 | @GET 15 | @Path("/helloworld") 16 | @Produces("text/html") 17 | public String helloWorld() { 18 | System.out.println("Inside helloworld"); 19 | return "Hello world "; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | javax.ws.rs.Application 9 | assignment7.HelloWorldApplication 10 | 11 | 12 | 13 | Resteasy 14 | 15 | org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 16 | 17 | 18 | 19 | 20 | Resteasy 21 | /assignment7 22 | 23 | 24 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/webapp/ajaxexample-snapshot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | 33 | 34 | 35 |

Let AJAX change this text

36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/webapp/ajaxexample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | 33 | 34 | 35 |

Let AJAX change this text

36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/webapp/myscript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | 5 | function myFunction() { 6 | var x, text; 7 | 8 | // Get the value of input field with id="numb" 9 | 10 | x = document.getElementById("numb").value; 11 | 12 | // If x is Not a Number or less than one or greater than 10 13 | 14 | if (isNaN(x) || x < 1 || x > 10) { 15 | text = "Invalid input."; 16 | } else { 17 | text = "Correct input."; 18 | } 19 | document.getElementById("demo").innerHTML = text; 20 | 21 | console.log("Testing console."); 22 | console.log(text); 23 | } -------------------------------------------------------------------------------- /JavaScript/assignment7/src/main/webapp/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Please input a number between 1 and 10:

11 | 12 | 13 | 14 | 15 | 16 |

17 | 18 | 19 | -------------------------------------------------------------------------------- /Notes/unit-testing: -------------------------------------------------------------------------------- 1 | 1) Unit test example in repose 2 | 3 | https://github.com/rackerlabs/repose/blob/master/repose-aggregator/commons/utilities/src/main/java/org/openrepose/commons/utils/servlet/http/MutableHttpServletRequest.java 4 | 5 | https://github.com/rackerlabs/repose/blob/master/repose-aggregator/commons/utilities/src/test/java/org/openrepose/commons/utils/servlet/http/MutableHttpServletRequestTest.java 6 | 7 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | assignment3 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.jem.workbench.JavaEMFNature 37 | org.eclipse.wst.common.modulecore.ModuleCoreNature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.jsdt.core.jsNature 41 | 42 | 43 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.8 9 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Project Templates/assignment3/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Project Templates/assignment3/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Project Templates/assignment3/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | assignment3 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /Project Templates/assignment3/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: Brandon 3 | Build-Jdk: 1.8.0_101 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /Project Templates/assignment3/target/m2e-wtp/web-resources/META-INF/maven/assignment3/assignment3/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon Oct 10 12:17:35 CDT 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=assignment3 5 | m2e.projectName=assignment3 6 | m2e.projectLocation=C\:\\Users\\Brandon\\Documents\\GitHub\\ModernWebApps\\Project Templates\\assignment3 7 | artifactId=assignment3 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Code examples for Modern Web Apps course 2 | ----------------------------------------- 3 | 4 | 1) HTTP: 5 | - Examples demonstrating HTTP protocol 6 | 7 | 2) Servlets: 8 | - Examples demonstrating Java Servlets 9 | 10 | 3) logging-example: 11 | - Examples demonstrating how to use Java's logging framework 12 | 13 | 4) XMLParsing: 14 | - Examples demonstrating various XML parsing techniques and libraries. 15 | Specifically, examples are provided for SAX, DOM, XPath parsing. 16 | An example is provided for parsing HTML as well (using JSoup library). 17 | 18 | 5) REST: 19 | - Examples demonstrating REST methods (GET, POST, PUT, DELETE) 20 | 21 | 22 | 6) JDBC: 23 | - Examples demonstrating using and interacting with SQL database (MySQL) 24 | through Java database connectivity 25 | 26 | 7) ORM: 27 | - Examples demonstrating using Hibernate object-relational-mapping framework 28 | to interact with SQL database 29 | 30 | 8) JavaScript: 31 | - Examples demonstrating use of JavaScript to build UI for Web applications 32 | 33 | 34 | In each folder there is a README explaining how to run the examples. 35 | 36 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/Course.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "course") 6 | public class Course { 7 | 8 | private String name; 9 | private String department; 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | public String getDepartment() { 16 | return department; 17 | } 18 | 19 | public void setDepartment(String department) { 20 | this.department = department; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/Courses.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | 8 | @XmlRootElement(name = "courses") 9 | public class Courses { 10 | 11 | private List courses = null; 12 | 13 | public List getCourses() { 14 | return courses; 15 | } 16 | 17 | public void setCourses(List courses) { 18 | this.courses = courses; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/NewCourse.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class NewCourse { 12 | 13 | String name; 14 | String course_num; 15 | int course_id; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getCourseNum() { 26 | return course_num; 27 | } 28 | 29 | public void setCourseNum(String course_num) { 30 | this.course_num = course_num; 31 | } 32 | 33 | public int getCourseId() { 34 | return course_id; 35 | } 36 | 37 | public void setCourseId(int course_id) { 38 | this.course_id = course_id; 39 | } 40 | } -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/NotFound.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlAccessType; 4 | import javax.xml.bind.annotation.XmlAccessorType; 5 | import javax.xml.bind.annotation.XmlRootElement; 6 | 7 | @XmlRootElement(name = "output") 8 | @XmlAccessorType(XmlAccessType.FIELD) 9 | public class NotFound { 10 | 11 | String error; 12 | 13 | public String getError() { 14 | return error; 15 | } 16 | 17 | public void setError(String error) { 18 | this.error = error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/Project.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Project { 12 | 13 | String name; 14 | 15 | List link = null; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public List getLink() { 26 | return link; 27 | } 28 | 29 | public void setLink(List link) { 30 | this.link = link; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/domain/Projects.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | import javax.xml.bind.annotation.XmlAccessType; 8 | 9 | @XmlRootElement(name = "projects") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Projects { 12 | 13 | private List project = null; 14 | 15 | public List getProjects() { 16 | return project; 17 | } 18 | 19 | public void setProjects(List projects) { 20 | this.project = projects; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/resources/UTCoursesApplication.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 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 | @ApplicationPath("/ut") 10 | public class UTCoursesApplication extends Application { 11 | 12 | private Set singletons = new HashSet(); 13 | private Set> classes = new HashSet>(); 14 | 15 | public UTCoursesApplication() { 16 | } 17 | 18 | @Override 19 | public Set> getClasses() { 20 | classes.add(UTCoursesResource.class); 21 | return classes; 22 | } 23 | 24 | @Override 25 | public Set getSingletons() { 26 | return singletons; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /REST-JDBC/src/main/java/assign/services/CourseStudentService.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | import assign.domain.Course; 4 | import assign.domain.NewCourse; 5 | 6 | public interface CourseStudentService { 7 | 8 | public NewCourse addCourse(NewCourse c) throws Exception; 9 | 10 | public NewCourse getCourse(int courseId) throws Exception; 11 | 12 | public NewCourse getCourse_correct(int courseId) throws Exception; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /REST-JDBC/src/resources/schema.ddl: -------------------------------------------------------------------------------- 1 | create table courses(name varchar(255) NOT NULL, course_num varchar(20) NOT NULL, course_id int NOT NULL AUTO_INCREMENT, PRIMARY KEY(course_id)); 2 | 3 | create table students(name varchar(255) NOT NULL, student_id int AUTO_INCREMENT, course_id int, PRIMARY KEY(student_id), FOREIGN KEY(course_id) REFERENCES courses(course_id)); 4 | 5 | insert into courses(name, course_num) values("Data Management", "CS347"); 6 | 7 | insert into students(name) values("Student 2"); 8 | 9 | insert into students(name, course_id) values("Student 4", (select course_id from courses where course_num="CS378")); 10 | 11 | select * from (students join courses on students.course_id = courses.course_id) where courses.course_num="CS378"; 12 | 13 | select * from (students join courses on students.course_id = courses.course_id); 14 | 15 | select * from (students left outer join courses on students.course_id = courses.course_id); 16 | 17 | select * from (students right outer join courses on students.course_id = courses.course_id); -------------------------------------------------------------------------------- /REST/README: -------------------------------------------------------------------------------- 1 | Setting up and running the project in Eclipse. 2 | ---------------------------------------------- 3 | 1) Import assignment4 project as follows: 4 | - In "Package Explorer" view: 5 | - Import -> Existing Projects into Workspace 6 | 7 | 2) Build: 8 | - Project -> Build Project 9 | 10 | 3) Run on Server 11 | 12 | 4) Try out following urls: 13 | 14 | http://localhost:8080/resteasy/ut/listing/courses 15 | 16 | http://localhost:8080/resteasy/ut/listing/helloworld 17 | 18 | http://localhost:8080/resteasy/ut/listing/projects 19 | 20 | 21 | On Error: 22 | ---------- 23 | 24 | Check that the "Java Build Path" for your project has Maven Dependencies set in the Deployment Assembly. 25 | 26 | How to check (or set it)? 27 | 28 | - Right click on project in the Package Explorer view 29 | - Choose "Build Path" 30 | - Choose "Configure Build Path" 31 | - Choose "Deployment Assembly" 32 | - Choose "Add" 33 | - Choose "Java Build Path Entries" 34 | - Choose "Maven Dependencies" 35 | 36 | 37 | Example code from RESTful Java with JAX-RS 2.0 available at 38 | https://github.com/oreillymedia/restful_java_jax-rs_2_0 39 | 40 | Once you clone it and unzip the required file, the code examples are available in: 41 | /examples/oreilly-jaxrs-2.0-workbook/ 42 | -------------------------------------------------------------------------------- /REST/resteasy/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | javax.ws.rs.Application 9 | assign.resources.UTCoursesApplication 10 | 11 | 12 | 13 | Resteasy 14 | 15 | org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 16 | 17 | 18 | 19 | 20 | Resteasy 21 | /resteasy 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/domain/Course.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "course") 6 | public class Course { 7 | 8 | private String name; 9 | private String department; 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | public String getDepartment() { 16 | return department; 17 | } 18 | 19 | public void setDepartment(String department) { 20 | this.department = department; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/domain/Courses.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | 8 | @XmlRootElement(name = "abc") 9 | @XmlAccessorType 10 | public class Courses { 11 | 12 | private List courseList = null; 13 | 14 | public List getCourseList() { 15 | return courseList; 16 | } 17 | 18 | public void setCourseList(List courses) { 19 | this.courseList = courses; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/domain/Project.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Project { 12 | 13 | String name; 14 | 15 | List link = null; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public List getLink() { 26 | return link; 27 | } 28 | 29 | public void setLink(List link) { 30 | this.link = link; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/domain/Projects.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | import javax.xml.bind.annotation.XmlAccessType; 8 | 9 | @XmlRootElement(name = "projects") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Projects { 12 | 13 | private List project = null; 14 | 15 | public List getProjects() { 16 | return project; 17 | } 18 | 19 | public void setProjects(List projects) { 20 | this.project = projects; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/resources/UTCoursesApplication.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 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 | import assign.services.EavesdropService; 9 | 10 | @ApplicationPath("/ut") 11 | public class UTCoursesApplication extends Application { 12 | 13 | private Set singletons = new HashSet(); 14 | private Set> classes = new HashSet>(); 15 | 16 | public UTCoursesApplication() { 17 | } 18 | 19 | @Override 20 | public Set> getClasses() { 21 | classes.add(UTCoursesResource.class); 22 | return classes; 23 | } 24 | 25 | @Override 26 | public Set getSingletons() { 27 | return singletons; 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/services/EavesdropService.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | public interface EavesdropService { 4 | public String getData(); 5 | } 6 | -------------------------------------------------------------------------------- /REST/resteasy/src/main/java/assign/services/EavesdropServiceImpl.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | public class EavesdropServiceImpl implements EavesdropService { 4 | public String getData() { 5 | return "Hello from Eavesdrop service."; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /React/App.css: -------------------------------------------------------------------------------- 1 | .Column-layout { 2 | height:100vh; 3 | width:33%; 4 | float:left 5 | } 6 | 7 | .App { 8 | text-align: center; 9 | } 10 | 11 | .App-logo { 12 | height: 40vmin; 13 | pointer-events: none; 14 | } 15 | 16 | @media (prefers-reduced-motion: no-preference) { 17 | .App-logo { 18 | animation: App-logo-spin infinite 20s linear; 19 | } 20 | } 21 | 22 | .App-header { 23 | background-color: #282c34; 24 | min-height: 100vh; 25 | display: flex; 26 | flex-direction: column; 27 | align-items: center; 28 | justify-content: center; 29 | font-size: calc(10px + 2vmin); 30 | color: white; 31 | } 32 | 33 | .App-link { 34 | color: #61dafb; 35 | } 36 | 37 | @keyframes App-logo-spin { 38 | from { 39 | transform: rotate(0deg); 40 | } 41 | to { 42 | transform: rotate(360deg); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /React/App.js: -------------------------------------------------------------------------------- 1 | import './App.css'; 2 | import { useState } from 'react'; 3 | 4 | export default function App() { 5 | return ( 6 | 7 | ); 8 | } 9 | 10 | function France() { 11 | 12 | const [totalclicks, setTotalclicks] = useState(0); 13 | var myclicks; 14 | 15 | function addClick(clickcount) { 16 | myclicks = totalclicks + clickcount; 17 | setTotalclicks(myclicks); 18 | alert("Total clicks:" + myclicks); 19 | } 20 | 21 | return ( 22 | <> 23 |
24 | 25 | 26 | 27 |
28 | 29 | ); 30 | } 31 | 32 | function Column({color, onClick}) { 33 | 34 | const [clicks, setClicks] = useState(0); 35 | var myclicks; 36 | 37 | function handleClick(color) { 38 | myclicks = clicks + 1; 39 | setClicks(myclicks); 40 | alert("My color is " + color + " click:" + myclicks); 41 | onClick(1); 42 | } 43 | 44 | return ( 45 |
handleClick(color)}>
46 | ); 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /React/README.md: -------------------------------------------------------------------------------- 1 | ============= 2 | React example 3 | ============= 4 | 5 | This example shows rendering of the flag of France with React. 6 | The example handles mouse clicks maintaining separate counts for 7 | the number of clicks on each vertical section of the flag, and 8 | a counter for overall clicks. 9 | 10 | 1. Install nodejs and npm 11 | 2. Use create-react-app to create application template 12 | - npx create-react-app my-app 13 | 3. Save files 14 | - App.js into my-app/src/App.js 15 | - App.css into my-app/src/App.css 16 | 4. Start the app 17 | - cd my-app 18 | - npm start 19 | 5. The application should be accessible on: 20 | http://localhost:5009 21 | -------------------------------------------------------------------------------- /Servlets/.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings 4 | pom~ -------------------------------------------------------------------------------- /Servlets/example-pom/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | assignment1-server 4 | assignment1-server 5 | 1 6 | war 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.1 13 | 14 | 1.7 15 | 1.7 16 | 17 | 18 | 19 | maven-war-plugin 20 | 2.4 21 | 22 | WebContent 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.servlet 31 | javax.servlet-api 32 | 3.1.0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | filter-order-example 4 | filter-order-example 5 | 1 6 | war 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.1 13 | 14 | 1.7 15 | 1.7 16 | 17 | 18 | 19 | maven-war-plugin 20 | 2.4 21 | 22 | WebContent 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.servlet 31 | javax.servlet-api 32 | 3.1.0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/FilterA.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.Filter; 2 | import javax.servlet.FilterChain; 3 | import javax.servlet.FilterConfig; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.ServletRequest; 6 | import javax.servlet.ServletResponse; 7 | import java.io.IOException; 8 | 9 | public class FilterA implements Filter 10 | { 11 | @Override 12 | public void doFilter(ServletRequest request, ServletResponse response, 13 | FilterChain chain) throws IOException, ServletException 14 | { 15 | System.out.println("Entering FilterA.doFilter()."); 16 | chain.doFilter(request, response); 17 | System.out.println("Leaving FilterA.doFilter()."); 18 | } 19 | 20 | @Override 21 | public void init(FilterConfig config) throws ServletException { } 22 | 23 | @Override 24 | public void destroy() { } 25 | } 26 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/FilterB.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.Filter; 2 | import javax.servlet.FilterChain; 3 | import javax.servlet.FilterConfig; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.ServletRequest; 6 | import javax.servlet.ServletResponse; 7 | import java.io.IOException; 8 | 9 | public class FilterB implements Filter 10 | { 11 | @Override 12 | public void doFilter(ServletRequest request, ServletResponse response, 13 | FilterChain chain) throws IOException, ServletException 14 | { 15 | System.out.println("Entering FilterB.doFilter()."); 16 | /* 17 | * Do the work 18 | */ 19 | 20 | chain.doFilter(request, response); 21 | System.out.println("Leaving FilterB.doFilter()."); 22 | } 23 | 24 | @Override 25 | public void init(FilterConfig config) throws ServletException { } 26 | 27 | @Override 28 | public void destroy() { } 29 | } 30 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/FilterC.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.Filter; 2 | import javax.servlet.FilterChain; 3 | import javax.servlet.FilterConfig; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.ServletRequest; 6 | import javax.servlet.ServletResponse; 7 | import java.io.IOException; 8 | 9 | public class FilterC implements Filter 10 | { 11 | @Override 12 | public void doFilter(ServletRequest request, ServletResponse response, 13 | FilterChain chain) throws IOException, ServletException 14 | { 15 | System.out.println("Entering FilterC.doFilter()."); 16 | //chain.doFilter(request, response); 17 | System.out.println("Leaving FilterC.doFilter()."); 18 | } 19 | 20 | @Override 21 | public void init(FilterConfig config) throws ServletException { } 22 | 23 | @Override 24 | public void destroy() { } 25 | } 26 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/ItemNotFound.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.ServletException; 2 | 3 | public class ItemNotFound extends ServletException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public ItemNotFound() { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/ServletOne.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.ServletException; 2 | import javax.servlet.annotation.WebServlet; 3 | import javax.servlet.http.HttpServlet; 4 | import javax.servlet.http.HttpServletRequest; 5 | import javax.servlet.http.HttpServletResponse; 6 | import java.io.IOException; 7 | 8 | @WebServlet(name = "servletOne", urlPatterns = "/servletOne") 9 | public class ServletOne extends HttpServlet 10 | { 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 1L; 15 | 16 | @Override 17 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 18 | throws ServletException, IOException 19 | { 20 | System.out.println("Entering ServletOne.doGet()."); 21 | //response.getWriter().write("Servlet One"); 22 | System.out.println("Leaving ServletOne.doGet()."); 23 | throw new ItemNotFound(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/ServletThree.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.ServletException; 2 | import javax.servlet.annotation.WebServlet; 3 | import javax.servlet.http.HttpServlet; 4 | import javax.servlet.http.HttpServletRequest; 5 | import javax.servlet.http.HttpServletResponse; 6 | import java.io.IOException; 7 | 8 | @WebServlet(name = "servletThree", urlPatterns = "/servletThree") 9 | public class ServletThree extends HttpServlet 10 | { 11 | @Override 12 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 13 | throws ServletException, IOException 14 | { 15 | System.out.println("Entering ServletThree.doGet()."); 16 | response.getWriter().write("Servlet Three"); 17 | System.out.println("Leaving ServletThree.doGet()."); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Servlets/filter-order-example/src/ServletTwo.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.ServletException; 2 | import javax.servlet.annotation.WebServlet; 3 | import javax.servlet.http.HttpServlet; 4 | import javax.servlet.http.HttpServletRequest; 5 | import javax.servlet.http.HttpServletResponse; 6 | import java.io.IOException; 7 | 8 | @WebServlet(name = "servletTwo", urlPatterns = "/servletTwo") 9 | public class ServletTwo extends HttpServlet 10 | { 11 | @Override 12 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 13 | throws ServletException, IOException 14 | { 15 | System.out.println("Entering ServletTwo.doGet()."); 16 | response.getWriter().write("Servlet Two"); 17 | System.out.println("Leaving ServletTwo.doGet()."); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Servlets/hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/hello-world/README: -------------------------------------------------------------------------------- 1 | Hello World Servlet 2 | 3 | Steps to run in Eclipse: 4 | 5 | 1) File -> Import -> Maven -> Existing Maven Projects 6 | 2) Browse to the directory where you have cloned the repo and 7 | select the hello-world project 8 | 3) In Project Explorer / Package Explorer menu, right click the 9 | project and then Maven -> Update Project 10 | 4) Once Maven has finished downloading the dependencies, right click 11 | on the project and choose Run As -> Run on Server 12 | 5) Run on the configured Tomcat instance 13 | 14 | Browse to http://localhost:8080/hello-world/helloworld 15 | 16 | You should see the "Hello world." printed in the browser window. 17 | 18 | Note that the Servlet is available at the following: 19 | 20 | http://localhost:8080// 21 | 22 | The context-root is the value of "Web Project Settings" 23 | 24 | url-pattern is defined in web.xml -------------------------------------------------------------------------------- /Servlets/hello-world/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/hello-world/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Hello world servlet 9 | 10 | 11 | hello-world-servlet 12 | HelloServlet 13 | 14 | 15 | hello-world-servlet 16 | /helloworld 17 | 18 | 19 | -------------------------------------------------------------------------------- /Servlets/hello-world/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | hello-world 4 | hello-world 5 | 1 6 | war 7 | 8 | assignment1 9 | src 10 | 11 | 12 | maven-compiler-plugin 13 | 3.1 14 | 15 | 1.7 16 | 1.7 17 | 18 | 19 | 20 | maven-war-plugin 21 | 2.4 22 | 23 | WebContent 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | javax.servlet 32 | javax.servlet-api 33 | 3.1.0 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Servlets/hello-world/src/HelloServlet.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | public class HelloServlet extends HttpServlet { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | @Override 18 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 19 | throws ServletException, IOException 20 | { 21 | response.getWriter().println("Hello world."); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding/=UTF-8 5 | encoding/src=UTF-8 6 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 10 | org.eclipse.jdt.core.compiler.release=disabled 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Servlets/mockito-example/.settings/org.sonar.ide.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | extraProperties= 3 | projectKey=mockito-example\:mockito-example 4 | serverUrl=http\://localhost\:9000 5 | version=2 6 | -------------------------------------------------------------------------------- /Servlets/mockito-example/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/mockito-example/WebContent/WEB-INF/servletContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Servlets/mockito-example/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Spring Application 9 | 10 | 11 | springDispatcher 12 | org.springframework.web.servlet.DispatcherServlet 13 | 14 | contextConfigLocation 15 | /WEB-INF/servletContext.xml 16 | 17 | 1 18 | 19 | 20 | springDispatcher 21 | / 22 | 23 | 24 | -------------------------------------------------------------------------------- /Servlets/mockito-example/src/main/java/EditorService.java: -------------------------------------------------------------------------------- 1 | 2 | public interface EditorService { 3 | 4 | public String composeEmail(); 5 | 6 | public String getName(); 7 | 8 | public String getResponseFromEavesDrop(String projectName); 9 | 10 | public void thisIsVoidFunction(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Servlets/mockito-example/src/test/java/TestEnglishEditorServiceImpl.java: -------------------------------------------------------------------------------- 1 | import java.io.ByteArrayInputStream; 2 | import java.io.InputStream; 3 | import java.net.URLConnection; 4 | import java.nio.charset.StandardCharsets; 5 | 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import static org.junit.Assert.*; 10 | import static org.mockito.Mockito.*; 11 | 12 | public class TestEnglishEditorServiceImpl { 13 | 14 | EnglishEditorServiceImpl englishEditor = null; 15 | 16 | @Before 17 | public void setUp() { 18 | englishEditor = new EnglishEditorServiceImpl(); 19 | } 20 | 21 | @Test 22 | public void testReadDataFromEavesdrop() { 23 | 24 | try { 25 | String exampleString = ""; 26 | exampleString += ""; 27 | exampleString += ""; 28 | 29 | URLConnection connection = mock(URLConnection.class); // Create mock dependency: mock() 30 | 31 | InputStream i = new ByteArrayInputStream(exampleString.getBytes(StandardCharsets.UTF_8)); 32 | 33 | when(connection.getInputStream()).thenReturn(i); // Setting up the expectations 34 | 35 | String result = englishEditor.readDataFromEavesdrop(connection); 36 | 37 | assertEquals(exampleString, result); 38 | 39 | verify(connection).getInputStream(); 40 | 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Servlets/query-parameters/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/query-parameters/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/query-parameters/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Testing threads application 9 | 10 | 11 | testingQueryParams 12 | TestQueryParameters 13 | 14 | 15 | testingQueryParams 16 | /queryparam 17 | 18 | 19 | -------------------------------------------------------------------------------- /Servlets/query-parameters/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | query-parameters 4 | query-parameters 5 | 1 6 | war 7 | 8 | assignment1 9 | src 10 | 11 | 12 | maven-compiler-plugin 13 | 3.1 14 | 15 | 1.7 16 | 1.7 17 | 18 | 19 | 20 | maven-war-plugin 21 | 2.4 22 | 23 | WebContent 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | javax.servlet 32 | javax.servlet-api 33 | 3.1.0 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Servlets/servlet-unit-test/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/servlet-unit-test/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Hello world servlet 9 | 10 | 11 | hello-world-servlet 12 | HelloServlet 13 | 14 | 15 | hello-world-servlet 16 | /helloworld 17 | 18 | 19 | -------------------------------------------------------------------------------- /Servlets/servlet-unit-test/src/main/java/CalculatorService.java: -------------------------------------------------------------------------------- 1 | 2 | public interface CalculatorService { 3 | 4 | public String calculate(String[] values, String operator); 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Servlets/servlet-unit-test/src/main/java/CalculatorServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | public class CalculatorServiceImpl implements CalculatorService { 3 | 4 | @Override 5 | public String calculate(String[] values, String operator) { 6 | String ret = ""; 7 | if (values != null && operator != null) { 8 | long result = Long.parseLong(values[0]); 9 | for(int i=1; i getElements() throws Exception; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Servlets/servlet-unit-test/src/main/java/JSoupServiceImpl.java: -------------------------------------------------------------------------------- 1 | import java.util.List; 2 | 3 | public class JSoupServiceImpl implements JSoupService { 4 | 5 | @Override 6 | public List getElements() throws Exception { 7 | // TODO Auto-generated method stub 8 | return null; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Servlets/session-example/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Servlets/session-example/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/session-example/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | session-example 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.jem.workbench.JavaEMFNature 37 | org.eclipse.wst.common.modulecore.ModuleCoreNature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.jsdt.core.jsNature 41 | 42 | 43 | -------------------------------------------------------------------------------- /Servlets/session-example/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Servlets/session-example/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 10 | org.eclipse.jdt.core.compiler.release=disabled 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /Servlets/session-example/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Servlets/session-example/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Servlets/session-example/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Servlets/session-example/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Servlets/session-example/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/session-example/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Session Example 9 | 10 | 11 | session 12 | TestSession 13 | 14 | 15 | session 16 | /session 17 | 18 | 19 | 20 | session 21 | /session1 22 | 23 | 24 | 32 | 33 | -------------------------------------------------------------------------------- /Servlets/session-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | session-example 4 | session-example 5 | 1 6 | war 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.1 13 | 14 | 1.7 15 | 1.7 16 | 17 | 18 | 19 | maven-war-plugin 20 | 2.4 21 | 22 | WebContent 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.servlet 31 | javax.servlet-api 32 | 3.1.0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/WebContent/WEB-INF/servletContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Spring Application 9 | 10 | 11 | springDispatcher 12 | org.springframework.web.servlet.DispatcherServlet 13 | 14 | contextConfigLocation 15 | /WEB-INF/servletContext.xml 16 | 17 | 1 18 | 19 | 20 | springDispatcher 21 | / 22 | 23 | 24 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/src/EditorService.java: -------------------------------------------------------------------------------- 1 | 2 | public interface EditorService { 3 | 4 | public String composeEmail(); 5 | 6 | public String getName(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/src/EnglishEditorServiceImpl.java: -------------------------------------------------------------------------------- 1 | public class EnglishEditorServiceImpl implements EditorService { 2 | 3 | String name = "English editor"; 4 | 5 | public String composeEmail() { 6 | return "Hello world."; 7 | } 8 | 9 | public String getName() { 10 | return this.name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Servlets/spring-email-service/src/SpanishEditorServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | public class SpanishEditorServiceImpl implements EditorService { 3 | 4 | String name = "Spanish editor"; 5 | public String composeEmail() { 6 | return "hola mundo"; 7 | } 8 | 9 | public String getName() { 10 | return this.name; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.8 9 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/.settings/org.sonar.ide.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | extraProperties= 3 | projectKey=test-jsoup-1\:test-jsoup-1 4 | serverUrl=http\://localhost\:9000 5 | version=2 6 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | JSoup Example 9 | 10 | 11 | JSoup 12 | JSoupServlet 13 | 14 | 15 | JSoup 16 | /testjsoup 17 | 18 | 19 | -------------------------------------------------------------------------------- /Servlets/test-jsoup-1/src/JSoupHandler.java: -------------------------------------------------------------------------------- 1 | import java.io.IOException; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.select.Elements; 6 | 7 | public class JSoupHandler { 8 | 9 | public Elements getElements(String source) { 10 | 11 | Document doc = null; 12 | try { 13 | doc = Jsoup.connect(source).get(); 14 | } catch (IOException e) { 15 | e.printStackTrace(); 16 | } 17 | if (doc != null) { 18 | Elements links = doc.select("body a"); 19 | return links; 20 | } 21 | else { 22 | return null; 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | test-load-on-startup 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.jem.workbench.JavaEMFNature 37 | org.eclipse.wst.common.modulecore.ModuleCoreNature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.jsdt.core.jsNature 41 | 42 | 43 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/test-load-on-startup/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | test-load-on-startup 4 | test-load-on-startup 5 | 1 6 | war 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.1 13 | 14 | 1.7 15 | 1.7 16 | 17 | 18 | 19 | maven-war-plugin 20 | 2.4 21 | 22 | WebContent 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.servlet 31 | javax.servlet-api 32 | 3.1.0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Servlets/test-servlet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in {1..1000} 4 | do 5 | curl -i http://localhost:8080/test-thread-servlet/threadServlet -H "X-User-Agent: TestRunner" 6 | done -------------------------------------------------------------------------------- /Servlets/test-thread-servlet/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /Servlets/test-thread-servlet/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/test-thread-servlet/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Testing threads application 9 | 10 | 11 | testingThreadServlet 12 | TestingThreadServlet 13 | 14 | 15 | testingThreadServlet 16 | /threadServlet 17 | 18 | 19 | -------------------------------------------------------------------------------- /Servlets/test-thread-servlet/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | test-thread-servlet 4 | test-thread-servlet 5 | 1 6 | war 7 | 8 | src 9 | 10 | 11 | maven-compiler-plugin 12 | 3.1 13 | 14 | 1.7 15 | 1.7 16 | 17 | 18 | 19 | maven-war-plugin 20 | 2.4 21 | 22 | WebContent 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.servlet 31 | javax.servlet-api 32 | 3.1.0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Servlets/url-rewriting/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Servlets/url-rewriting/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Session Example 9 | 10 | 11 | session 12 | TestSession 13 | 14 | 15 | session 16 | /session 17 | 18 | 19 | 20 | session 21 | /session1 22 | 23 | 24 | 25 | 28 | 29 | URL 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Servlets/url-rewriting/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | url-rewriting 4 | url-rewriting 5 | 1 6 | war 7 | 8 | src 9 | url-rewriting 10 | 11 | 12 | maven-compiler-plugin 13 | 3.1 14 | 15 | 1.7 16 | 1.7 17 | 18 | 19 | 20 | maven-war-plugin 21 | 2.4 22 | 23 | WebContent 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | javax.servlet 32 | javax.servlet-api 33 | 3.1.0 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Servlets/url-rewriting/src/TestSession.java: -------------------------------------------------------------------------------- 1 | import java.io.IOException; 2 | import java.io.PrintWriter; 3 | 4 | import javax.servlet.ServletException; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | 10 | public class TestSession extends HttpServlet { 11 | 12 | @Override 13 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 14 | throws ServletException, IOException 15 | { 16 | HttpSession session = request.getSession(true); 17 | String url = request.getRequestURL().toString(); 18 | if (session.isNew()) { 19 | String encodedURL = response.encodeURL(url); 20 | writeResponse(response, "stranger", encodedURL); 21 | } 22 | else { 23 | String encodedURL = response.encodeURL(url); 24 | writeResponse(response, "friend", encodedURL); 25 | } 26 | } 27 | 28 | private void writeResponse(HttpServletResponse response, String you, String url) throws IOException { 29 | PrintWriter pw = response.getWriter(); 30 | pw.println(""); 31 | pw.println("Hello, " + you); 32 | if (you.equalsIgnoreCase("stranger")) { 33 | pw.println("
Be a friend. Click here "); 34 | } 35 | pw.println(""); 36 | } 37 | } -------------------------------------------------------------------------------- /XMLParsing/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /XMLParsing/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /XMLParsing/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | XMLParsing 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /XMLParsing/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /XMLParsing/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /XMLParsing/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XMLParsing/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /XMLParsing/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /XMLParsing/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /XMLParsing/README.md: -------------------------------------------------------------------------------- 1 | Examples to demonstrate XML/HTML parsing 2 | 3 | 1) DOMParser.java 4 | - DOM based parsing 5 | 6 | 2) SAXParser.java 7 | - SAX based parsing 8 | 9 | 3) XPathParser.java 10 | - XPath based parsing 11 | 12 | 4) RegexParser.java 13 | - Parsing using Java regular expressions 14 | 15 | 5) JSoupParser.java 16 | - Parsing using jsoup library 17 | 18 | 19 | Sample xml and html files available in the src directory 20 | 21 | To try out example you will have to first compile the code: 22 | 23 | e.g.: 24 | 25 | javac DOMParser.java 26 | 27 | java DOMParser cs378.xml 28 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jaxb-example 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 14 | org.eclipse.jdt.core.compiler.release=disabled 15 | org.eclipse.jdt.core.compiler.source=1.8 16 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | jaxb-example 4 | jaxb-example 5 | 0.0.1-SNAPSHOT 6 | 7 | src 8 | 9 | 10 | maven-compiler-plugin 11 | 3.8.0 12 | 13 | 1.8 14 | 1.8 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | com.sun.xml.bind 24 | jaxb-core 25 | 2.2.8-b01 26 | 27 | 28 | com.sun.xml.bind 29 | jaxb-impl 30 | 2.2-promoted-b65 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/src/JAXBExample.java: -------------------------------------------------------------------------------- 1 | import java.io.IOException; 2 | import java.net.MalformedURLException; 3 | import java.net.URL; 4 | 5 | import javax.xml.bind.JAXBContext; 6 | import javax.xml.bind.JAXBException; 7 | import javax.xml.bind.Unmarshaller; 8 | 9 | public class JAXBExample { 10 | 11 | 12 | private static void unMarshalingExample() throws JAXBException, MalformedURLException, IOException 13 | { 14 | JAXBContext jaxbContext = JAXBContext.newInstance(Response.class); 15 | Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); 16 | 17 | //We had written this file in marshalling example 18 | Response cameraNodes = (Response) jaxbUnmarshaller.unmarshal( 19 | new URL("http://www.cs.utexas.edu/~devdatta/traffic_camera_data.xml").openStream()); 20 | 21 | for(Row camera : cameraNodes.getRowList()) 22 | { 23 | System.out.print(camera.getCameraStatus()); 24 | System.out.println(camera.getIpCommStatus()); 25 | } 26 | } 27 | 28 | public static void main(String[] args) throws MalformedURLException, JAXBException, IOException { 29 | JAXBExample.unMarshalingExample(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/src/Response.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.List; 3 | 4 | import javax.xml.bind.annotation.XmlElement; 5 | import javax.xml.bind.annotation.XmlRootElement; 6 | 7 | @XmlRootElement(name = "response") 8 | public class Response 9 | { 10 | @XmlElement(name = "row") 11 | private List rowList = new ArrayList(); 12 | 13 | public List getRowList() { 14 | return rowList; 15 | } 16 | 17 | public void setRow(List rowList) { 18 | this.rowList = rowList; 19 | } 20 | } -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/src/Row.java: -------------------------------------------------------------------------------- 1 | import javax.xml.bind.annotation.XmlElement; 2 | import javax.xml.bind.annotation.XmlRootElement; 3 | 4 | @XmlRootElement(name = "row") 5 | public class Row { 6 | private String cameraStatus; 7 | private String ipCommStatus; 8 | 9 | @XmlElement(name="camera_status") 10 | public String getCameraStatus() { 11 | return cameraStatus; 12 | } 13 | 14 | public void setCameraStatus(String cameraStatus) { 15 | this.cameraStatus = cameraStatus; 16 | } 17 | 18 | @XmlElement(name="ip_comm_status") 19 | public String getIpCommStatus() { 20 | return ipCommStatus; 21 | } 22 | 23 | public void setIpCommStatus(String ipCommStatus) { 24 | this.ipCommStatus = ipCommStatus; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/JAXBExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/XMLParsing/jaxb-example/target/classes/JAXBExample.class -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: devdatta 3 | Build-Jdk: 1.8.0_144 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/META-INF/maven/jaxb-example/jaxb-example/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Thu Sep 19 14:10:06 CDT 2019 3 | version=0.0.1-SNAPSHOT 4 | groupId=jaxb-example 5 | m2e.projectName=jaxb-example 6 | m2e.projectLocation=/Users/devdatta/Documents/workspace/jaxb-example 7 | artifactId=jaxb-example 8 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/META-INF/maven/jaxb-example/jaxb-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | jaxb-example 4 | jaxb-example 5 | 0.0.1-SNAPSHOT 6 | 7 | src 8 | 9 | 10 | maven-compiler-plugin 11 | 3.8.0 12 | 13 | 1.8 14 | 1.8 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | com.sun.xml.bind 24 | jaxb-core 25 | 2.2.8-b01 26 | 27 | 28 | com.sun.xml.bind 29 | jaxb-impl 30 | 2.2-promoted-b65 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/Response.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/XMLParsing/jaxb-example/target/classes/Response.class -------------------------------------------------------------------------------- /XMLParsing/jaxb-example/target/classes/Row.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/XMLParsing/jaxb-example/target/classes/Row.class -------------------------------------------------------------------------------- /XMLParsing/src/XPathParser.java: -------------------------------------------------------------------------------- 1 | import javax.xml.xpath.XPath; 2 | import javax.xml.xpath.XPathConstants; 3 | import javax.xml.xpath.XPathFactory; 4 | 5 | import org.w3c.dom.Node; 6 | import org.w3c.dom.NodeList; 7 | import org.xml.sax.InputSource; 8 | 9 | 10 | /* 11 | * http://docs.oracle.com/javase/7/docs/api/javax/xml/xpath/package-summary.html 12 | */ 13 | public class XPathParser { 14 | 15 | public static void main(String [] args) throws Exception { 16 | if (args.length < 1) { 17 | System.out.println("Usage:"); 18 | System.out.println("java XPathParser "); 19 | System.exit(0); 20 | } 21 | 22 | String fileName = args[0]; 23 | 24 | XPath xpath = XPathFactory.newInstance().newXPath(); 25 | String expression = "/html/body/cs378/assignments/assignment"; 26 | //String expression = "response/meetings/a [href]"; 27 | //String expression = "html/body/table/tr/a [href]"; 28 | InputSource inputSource = new InputSource(fileName); 29 | NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET); 30 | 31 | for(int i=0; i 2 | 3 | 4 | 5 | 6 | Caching Proxy 7 | Servlet 8 | REST GET 9 | REST POST, PUT, DELETE 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /XMLParsing/src/cs378.not_well_formed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Caching Proxy 7 | Servlet 8 | REST GET 9 | REST POST, PUT, DELETE 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /XMLParsing/src/cs378.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Caching Proxy Server 4 | Servlet 5 | OpenStack 6 | 7 | 8 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | resteasy 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 10 | org.eclipse.jdt.core.compiler.release=disabled 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /assignment-templates/assignment3/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/README: -------------------------------------------------------------------------------- 1 | Import this project in Eclipse and deploy it. 2 | 3 | You can try following URLs to check the functionality of this application 4 | 5 | http://localhost:8080/assignment3/ut/listing/helloworld 6 | http://localhost:8080/assignment3/ut/listing/courses 7 | http://localhost:8080/assignment3/ut/listing/projects 8 | http://localhost:8080/assignment3/ut/listing/helloeavesdrop 9 | 10 | 11 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/WebContent/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | javax.ws.rs.Application 9 | assign.resources.UTCoursesApplication 10 | 11 | 12 | 13 | Resteasy 14 | 15 | org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 16 | 17 | 18 | 19 | 20 | Resteasy 21 | /assignment3 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/domain/Course.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "course") 6 | public class Course { 7 | 8 | private String name; 9 | private String department; 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | public String getDepartment() { 16 | return department; 17 | } 18 | 19 | public void setDepartment(String department) { 20 | this.department = department; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/domain/Courses.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | 8 | @XmlRootElement(name = "courses") 9 | @XmlAccessorType 10 | public class Courses { 11 | 12 | private List courses = null; 13 | 14 | public List getCourses() { 15 | return courses; 16 | } 17 | 18 | public void setCourses(List courses) { 19 | this.courses = courses; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/domain/Project.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Project { 12 | 13 | String name; 14 | 15 | List link = null; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public List getLink() { 26 | return link; 27 | } 28 | 29 | public void setLink(List link) { 30 | this.link = link; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/domain/Projects.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | import javax.xml.bind.annotation.XmlAccessType; 8 | 9 | @XmlRootElement(name = "projects") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Projects { 12 | 13 | private List project = null; 14 | 15 | public List getProjects() { 16 | return project; 17 | } 18 | 19 | public void setProjects(List projects) { 20 | this.project = projects; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/resources/UTCoursesApplication.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 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 | @ApplicationPath("/ut") 10 | public class UTCoursesApplication extends Application { 11 | 12 | private Set singletons = new HashSet(); 13 | private Set> classes = new HashSet>(); 14 | 15 | public UTCoursesApplication() { 16 | } 17 | 18 | @Override 19 | public Set> getClasses() { 20 | classes.add(UTCoursesResource.class); 21 | return classes; 22 | } 23 | 24 | @Override 25 | public Set getSingletons() { 26 | return singletons; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/main/java/assign/services/EavesdropService.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | public class EavesdropService { 4 | 5 | public String getData() { 6 | return "Hello from Eavesdrop service."; 7 | } 8 | 9 | public String parseData(String input) { 10 | if (input != null) { 11 | return input; 12 | } else { 13 | return ""; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /assignment-templates/assignment3/src/test/java/assign/resources/TestUTCoursesResource.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.mockito.Mockito.mock; 5 | import static org.mockito.Mockito.when; 6 | 7 | import org.junit.Test; 8 | 9 | import assign.domain.Course; 10 | import assign.services.EavesdropService; 11 | 12 | public class TestUTCoursesResource { 13 | 14 | @Test 15 | public void unitTest1() { 16 | UTCoursesResource utCourseResource = new UTCoursesResource(); 17 | EavesdropService mockEavesdrop = mock(EavesdropService.class); 18 | utCourseResource.setEavesdropService(mockEavesdrop); 19 | when(mockEavesdrop.getData()).thenReturn(null); 20 | 21 | Course c = utCourseResource.getCourse("1"); 22 | assertEquals(null, c.getName()); 23 | } 24 | 25 | @Test 26 | public void functionalTest1() { 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | resteasy-jdbc 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /assignment-templates/assignment4/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/Course.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "course") 6 | public class Course { 7 | 8 | private String name; 9 | private String department; 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | public String getDepartment() { 16 | return department; 17 | } 18 | 19 | public void setDepartment(String department) { 20 | this.department = department; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | } -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/Courses.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | 8 | @XmlRootElement(name = "courses") 9 | public class Courses { 10 | 11 | private List courses = null; 12 | 13 | public List getCourses() { 14 | return courses; 15 | } 16 | 17 | public void setCourses(List courses) { 18 | this.courses = courses; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/NewCourse.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "new_course") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class NewCourse { 12 | 13 | String name; 14 | String course_num; 15 | int course_id; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getCourseNum() { 26 | return course_num; 27 | } 28 | 29 | public void setCourseNum(String course_num) { 30 | this.course_num = course_num; 31 | } 32 | 33 | public int getCourseId() { 34 | return course_id; 35 | } 36 | 37 | public void setCourseId(int course_id) { 38 | this.course_id = course_id; 39 | } 40 | } -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/NotFound.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import javax.xml.bind.annotation.XmlAccessType; 4 | import javax.xml.bind.annotation.XmlAccessorType; 5 | import javax.xml.bind.annotation.XmlRootElement; 6 | 7 | @XmlRootElement(name = "output") 8 | @XmlAccessorType(XmlAccessType.FIELD) 9 | public class NotFound { 10 | 11 | String error; 12 | 13 | public String getError() { 14 | return error; 15 | } 16 | 17 | public void setError(String error) { 18 | this.error = error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/Project.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessType; 6 | import javax.xml.bind.annotation.XmlAccessorType; 7 | import javax.xml.bind.annotation.XmlRootElement; 8 | 9 | @XmlRootElement(name = "project") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Project { 12 | 13 | String name; 14 | 15 | List link = null; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public List getLink() { 26 | return link; 27 | } 28 | 29 | public void setLink(List link) { 30 | this.link = link; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/domain/Projects.java: -------------------------------------------------------------------------------- 1 | package assign.domain; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.bind.annotation.XmlAccessorType; 6 | import javax.xml.bind.annotation.XmlRootElement; 7 | import javax.xml.bind.annotation.XmlAccessType; 8 | 9 | @XmlRootElement(name = "projects") 10 | @XmlAccessorType(XmlAccessType.FIELD) 11 | public class Projects { 12 | 13 | private List project = null; 14 | 15 | public List getProjects() { 16 | return project; 17 | } 18 | 19 | public void setProjects(List projects) { 20 | this.project = projects; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/resources/UTCoursesApplication.java: -------------------------------------------------------------------------------- 1 | package assign.resources; 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 | @ApplicationPath("/ut") 10 | public class UTCoursesApplication extends Application { 11 | 12 | private Set singletons = new HashSet(); 13 | private Set> classes = new HashSet>(); 14 | 15 | public UTCoursesApplication() { 16 | } 17 | 18 | @Override 19 | public Set> getClasses() { 20 | classes.add(UTCoursesResource.class); 21 | return classes; 22 | } 23 | 24 | @Override 25 | public Set getSingletons() { 26 | return singletons; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/main/java/assign/services/CourseStudentService.java: -------------------------------------------------------------------------------- 1 | package assign.services; 2 | 3 | import assign.domain.Course; 4 | import assign.domain.NewCourse; 5 | 6 | public interface CourseStudentService { 7 | 8 | public NewCourse addCourse(NewCourse c) throws Exception; 9 | 10 | public NewCourse getCourse(int courseId) throws Exception; 11 | 12 | public NewCourse getCourse_correct(int courseId) throws Exception; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /assignment-templates/assignment4/src/resources/schema.ddl: -------------------------------------------------------------------------------- 1 | create database ; 2 | 3 | use ...; 4 | 5 | create table courses(name varchar(255) NOT NULL, course_num varchar(20) NOT NULL, course_id int NOT NULL AUTO_INCREMENT, PRIMARY KEY(course_id)); 6 | 7 | -------------------------------------------------------------------------------- /flask/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/flask/.DS_Store -------------------------------------------------------------------------------- /flask/README.md: -------------------------------------------------------------------------------- 1 | Steps 2 | ------ 3 | 4 | 1. Create Virtual Environment 5 | ```python3 -m venv venv``` 6 | 7 | 2. Activate Virtual Environment 8 | ```source venv/bin/activate``` 9 | 10 | 3. Install dependencies 11 | ```pip3 install -r requirements.txt``` 12 | 13 | 4. Run web app 14 | 15 | - When developing (Use Flask's built-in web server): 16 | ```python3 application.py``` 17 | 18 | - In production (Use Gunicorn): 19 | ```./start-app.sh``` 20 | 21 | 5. Access web app 22 | 23 | ```curl http://localhost:5003``` 24 | 25 | --or-- 26 | 27 | Open http://localhost:5003 in browser 28 | 29 | Enter any username/password and hit submit button (the web app does not support login functionality yet). 30 | 31 | 32 | 6. Debug web app 33 | 34 | - Put breakpoint in code: 35 | ```import pdb; pdb.set_trace()``` 36 | 37 | - Check logs: 38 | ```more myapp.log``` 39 | 40 | 7. Stop web app 41 | 42 | - If running directly using python interpreter 43 | ```Hit Cntrl+C``` 44 | 45 | - If running using Gunicorn 46 | ```./stop-app.sh``` 47 | 48 | 8. Run tests against the REST API 49 | 50 | ```./test.sh``` 51 | -------------------------------------------------------------------------------- /flask/lesson.json: -------------------------------------------------------------------------------- 1 | {"name": "Guitar Hero", "instrument": "Guitar", "demo_url": "https:123", "days": "MWF", "timings": "3.30 - 4.00pm" } 2 | -------------------------------------------------------------------------------- /flask/lesson1.json: -------------------------------------------------------------------------------- 1 | {"name": "Guitar Hero", "instrument": "Guitar", "demo_url": "https:223", "days": "MWF", "timings": "3.30 - 4.00pm" } 2 | -------------------------------------------------------------------------------- /flask/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | gunicorn 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | SQLAlchemy 8 | -------------------------------------------------------------------------------- /flask/start-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gunicorn --bind 0.0.0.0:5003 wsgi:app & 4 | -------------------------------------------------------------------------------- /flask/stop-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ps -eaf | grep "gunicorn --bind 0.0.0.0:5003" | grep -v grep | awk '{print $2}' | xargs kill -9 4 | -------------------------------------------------------------------------------- /flask/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Use a test database 4 | export MUSIC_MARKETPLACE_DB='test.db' 5 | 6 | # Start the REST API in background 7 | python3 application.py & 8 | pid=$! 9 | #echo $pid 10 | 11 | # Wait for the REST API to become ready 12 | sleep 5 13 | 14 | # Exercise the REST API programmatically 15 | python3 test.py 16 | 17 | # Shutdown the REST API process and all its children 18 | pkill -9 -P $pid 19 | 20 | # Delete the db file 21 | rm test.db -------------------------------------------------------------------------------- /flask/wsgi.py: -------------------------------------------------------------------------------- 1 | from application import app 2 | 3 | if __name__ == "__main__": 4 | app.run() 5 | -------------------------------------------------------------------------------- /html-css-js/chakra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/html-css-js/chakra.png -------------------------------------------------------------------------------- /html-css-js/france.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Modern Web Apps 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /html-css-js/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Modern Web Apps 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /html-css-js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Modern Web Apps 9 | 10 | 11 | 12 |
13 |
14 |

Welcome to Modern Web Apps

15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /html-css-js/india.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Modern Web Apps 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /html-css-js/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/html-css-js/star.png -------------------------------------------------------------------------------- /html-css-js/texas.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Modern Web Apps 9 | 10 | 11 | 12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /logging-example/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /logging-example/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /logging-example/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /logging-example/.settings/org.sonar.ide.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | extraProperties= 3 | projectKey=logging-example\:logging-example 4 | serverUrl=http\://localhost\:9000 5 | version=2 6 | -------------------------------------------------------------------------------- /logging-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | logging-example 4 | logging-example 5 | 0.0.1-SNAPSHOT 6 | war 7 | 8 | 9 | 10 | junit 11 | junit 12 | 4.13.1 13 | 14 | 15 | -------------------------------------------------------------------------------- /musicmarketplace-google-oauth/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | gunicorn 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | SQLAlchemy 8 | bcrypt 9 | google-api-python-client 10 | google-auth 11 | google-auth-oauthlib 12 | google-auth-httplib2 13 | -------------------------------------------------------------------------------- /musicmarketplace/README.md: -------------------------------------------------------------------------------- 1 | Steps 2 | ------ 3 | 4 | 1. Create Virtual Environment 5 | ```python3 -m venv venv``` 6 | 7 | 2. Activate Virtual Environment 8 | ```source venv/bin/activate``` 9 | 10 | 3. Install dependencies 11 | ```pip3 install -r requirements.txt``` 12 | 13 | 4. Run web app 14 | 15 | - When developing (Use Flask's built-in web server): 16 | ```python3 application.py``` 17 | 18 | - In production (Use Gunicorn): 19 | ```./start-app.sh``` 20 | 21 | 5. Access web app 22 | 23 | Open ```http://localhost:5003``` in browser 24 | 25 | 26 | 6. Debug web app 27 | 28 | - Put breakpoint in code: 29 | ```import pdb; pdb.set_trace()``` 30 | 31 | - Check logs: 32 | ```more myapp.log``` 33 | 34 | 7. Stop web app 35 | 36 | - If running directly using python interpreter 37 | ```Hit Cntrl+C``` 38 | 39 | - If running using Gunicorn 40 | ```./stop-app.sh``` 41 | 42 | 43 | -------------------------------------------------------------------------------- /musicmarketplace/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | gunicorn 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | -------------------------------------------------------------------------------- /musicmarketplace/start-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gunicorn --bind 0.0.0.0:5003 wsgi:app & 4 | -------------------------------------------------------------------------------- /musicmarketplace/static/styles/musicmarketplace.css: -------------------------------------------------------------------------------- 1 | .button { 2 | background-color:#fcba03; 3 | width: 150px; 4 | height: 45px; 5 | padding: 10px; 6 | margin: 12px; 7 | font-size: 15pt; 8 | font-family: Arial; 9 | } 10 | .label { 11 | margin: 15px; 12 | float:left; 13 | font-size: 16pt; 14 | } 15 | .input { 16 | margin: 15px; 17 | width: 200px; 18 | height: 20px; 19 | } 20 | .select { 21 | margin: 15px; 22 | width: 200px; 23 | height: 20px; 24 | } 25 | -------------------------------------------------------------------------------- /musicmarketplace/stop-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ps -eaf | grep "gunicorn --bind 0.0.0.0:5003" | grep -v grep | awk '{print $2}' | xargs kill -9 4 | -------------------------------------------------------------------------------- /musicmarketplace/wsgi.py: -------------------------------------------------------------------------------- 1 | from application import app 2 | 3 | if __name__ == "__main__": 4 | app.run() 5 | -------------------------------------------------------------------------------- /photo-portal/assignment1/react/App.css: -------------------------------------------------------------------------------- 1 | .Column-layout { 2 | height:100vh; 3 | width:33%; 4 | float:left 5 | } 6 | 7 | .App { 8 | text-align: center; 9 | } 10 | 11 | .App-logo { 12 | height: 40vmin; 13 | pointer-events: none; 14 | } 15 | 16 | @media (prefers-reduced-motion: no-preference) { 17 | .App-logo { 18 | animation: App-logo-spin infinite 20s linear; 19 | } 20 | } 21 | 22 | .App-header { 23 | background-color: #282c34; 24 | min-height: 100vh; 25 | display: flex; 26 | flex-direction: column; 27 | align-items: center; 28 | justify-content: center; 29 | font-size: calc(10px + 2vmin); 30 | color: white; 31 | } 32 | 33 | .App-link { 34 | color: #61dafb; 35 | } 36 | 37 | @keyframes App-logo-spin { 38 | from { 39 | transform: rotate(0deg); 40 | } 41 | to { 42 | transform: rotate(360deg); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /photo-portal/assignment1/react/index.js: -------------------------------------------------------------------------------- 1 | import 'bootstrap'; 2 | import 'bootstrap/dist/css/bootstrap.css'; 3 | import 'bootstrap/dist/js/bootstrap.js'; 4 | import $ from 'jquery'; 5 | import Popper from 'popper.js'; 6 | 7 | import React from 'react'; 8 | import ReactDOM from 'react-dom/client'; 9 | import './index.css'; 10 | import App from './App'; 11 | import reportWebVitals from './reportWebVitals'; 12 | 13 | const root = ReactDOM.createRoot(document.getElementById('root')); 14 | root.render( 15 | 16 | 17 | 18 | ); 19 | 20 | // If you want to start measuring performance in your app, pass a function 21 | // to log results (for example: reportWebVitals(console.log)) 22 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 23 | reportWebVitals(); 24 | -------------------------------------------------------------------------------- /photo-portal/assignment1/react/steps.txt: -------------------------------------------------------------------------------- 1 | 1. Install nodejs and npm 2 | 2. npm i --save bootstrap jquery popper.js 3 | 3. npm install bootstrap 4 | 4. npx create-react-app my-app 5 | 5. cp App.js my-app/src/. 6 | 6. cp index.html my-app/public/. 7 | 7. cp App.css my-app/src/. 8 | 8. cp index.js my-app/src/. 9 | 10 | -------------------------------------------------------------------------------- /photo-portal/assignment2/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. pip3 install -r requirements.txt 9 | 4. python3 application.py 10 | 11 | 12 | Try 13 | --- 14 | 1. Open application url: 15 | -http://localhost:5009/admin 16 | 2. Access the web app in the browser 17 | 3. Login/Logout using any string as username/password 18 | 4. Login again using same user. 19 | 20 | Stop 21 | ---- 22 | 1. Ctrl+C in the window where application.py was started 23 | 24 | 25 | -------------------------------------------------------------------------------- /photo-portal/assignment2/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | -------------------------------------------------------------------------------- /photo-portal/assignment2/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/photo-portal/assignment2/static/images/longhorn.png -------------------------------------------------------------------------------- /photo-portal/assignment2/static/scripts/photo-portal.js: -------------------------------------------------------------------------------- 1 | // Requirement 5.2 2 | function validate_data() { 3 | // hint: https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/value 4 | // Get the search_select value and search_input value 5 | // Use document.getElementById() 6 | // return false if the data validation checks fail. Also raise appropriate alert. 7 | // return true if the data validation checks pass. 8 | } 9 | 10 | function show_photo_details(photo_name, date_taken, tags) { 11 | alert("Photo:" + photo_name + " date_taken:" + date_taken + " tags:" + tags); 12 | } 13 | 14 | 15 | // Requirement 4.3 - Implement the preview_photo method that displays the photo in modal 16 | function preview_photo(photo_name) { 17 | 18 | } 19 | 20 | 21 | function show_settings() { 22 | alert("Settings called."); 23 | } 24 | 25 | function logout() { 26 | document.getElementById("settings-and-logout-form").submit(); 27 | } 28 | -------------------------------------------------------------------------------- /photo-portal/assignment3/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. pip3 install -r requirements.txt 9 | 4. python3 application.py 10 | 11 | 12 | Try 13 | --- 14 | 1. Open application url: 15 | -http://localhost:5009/ 16 | 2. Access the web app in the browser 17 | 4. Login/Logout 18 | 5. Login again using same user. 19 | 20 | Stop 21 | ---- 22 | 1. Ctrl+C in the window where application.py was started 23 | 24 | 25 | -------------------------------------------------------------------------------- /photo-portal/assignment3/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | SQLAlchemy 8 | -------------------------------------------------------------------------------- /photo-portal/assignment3/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/photo-portal/assignment3/static/images/longhorn.png -------------------------------------------------------------------------------- /photo-portal/assignment4/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. For Google OAuth: 9 | - pip3.7 install --only-binary :all: greenlet 10 | - pip3.7 install --only-binary :all: pyopenssl 11 | - pip3.7 install --only-binary :all: bcrypt 12 | 3. pip3.7 install -r requirements.txt 13 | 4. python3.7 application.py 14 | 15 | 16 | Try 17 | --- 18 | 1. Open application url: 19 | -http://localhost:5009/ 20 | 21 | 2. Add Admin user (this will work after adding POST REST API) 22 | - curl -k https://localhost:5009/users -X POST -H "Content-Type: application/json" --data @admin.json 23 | 24 | 3. Get users (this will work after adding GET REST API) 25 | - curl -k https://localhost:5009/users 26 | 27 | 4. From the application url, login as Admin1 user. 28 | 29 | Stop 30 | ---- 31 | 1. Ctrl+C in the window where application.py was started 32 | 33 | 34 | -------------------------------------------------------------------------------- /photo-portal/assignment4/admin.json: -------------------------------------------------------------------------------- 1 | {"name": "Admin1", "password": "Admin1", "user_type": "admin"} 2 | -------------------------------------------------------------------------------- /photo-portal/assignment4/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | Jinja2==3.0.1 5 | Werkzeug==2.0.0 6 | pyyaml 7 | SQLAlchemy 8 | google-api-python-client 9 | google-auth 10 | google-auth-oauthlib 11 | google-auth-httplib2 12 | cffi 13 | -------------------------------------------------------------------------------- /photo-portal/assignment4/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/photo-portal/assignment4/static/images/longhorn.png -------------------------------------------------------------------------------- /weather-portal-templates/assignment2/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. pip3 install -r requirements.txt 9 | 4. python3 application.py 10 | 11 | 12 | Try 13 | --- 14 | 1. Open application url: http://localhost:5009/ 15 | 2. Provide any username/password (no checks yet) 16 | 3. Register cities 17 | 4. Logout 18 | 5. Login again using same user. 19 | 20 | Stop 21 | ---- 22 | 1. Ctrl+C in the window where application.py was started 23 | 24 | 25 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment2/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | gunicorn 5 | Jinja2==3.0.1 6 | Werkzeug==2.0.0 7 | pyyaml 8 | SQLAlchemy 9 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment2/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/weather-portal-templates/assignment2/static/images/longhorn.png -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/README: -------------------------------------------------------------------------------- 1 | WeatherPortal Web App 2 | ===================== 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. pip3 install -r requirements.txt 9 | 4. python3 application.py 10 | 11 | 12 | Try REST API 13 | ------------ 14 | 1. Use the curl commands for "/admin" endpoint from steps.txt 15 | 16 | 17 | Stop 18 | ---- 19 | 1. Ctrl+C in the window where application.py was started 20 | 21 | 22 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/admin.json: -------------------------------------------------------------------------------- 1 | {"name": "Admin1", "password": "Admin1"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/austin.json: -------------------------------------------------------------------------------- 1 | {"name": "Austin", "url": "http://austin-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/dallas.json: -------------------------------------------------------------------------------- 1 | {"name": "Dallas", "url": "http://dallas-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/houston.json: -------------------------------------------------------------------------------- 1 | {"name": "Houston", "url": "http://houston-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | gunicorn 5 | Jinja2==3.0.1 6 | Werkzeug==2.0.0 7 | pyyaml 8 | SQLAlchemy 9 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/san-antonio.json: -------------------------------------------------------------------------------- 1 | {"name": "San Antonio", "url": "http://san-antonio-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/weather-portal-templates/assignment3/static/images/longhorn.png -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/user-city-austin.json: -------------------------------------------------------------------------------- 1 | {"name": "Austin", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/user-city-dallas.json: -------------------------------------------------------------------------------- 1 | {"name": "Dallas", "month": "July", "year": "2023", "weather_params": "TMAX,TMIN,SNOW"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/user-city-san-antonio.json: -------------------------------------------------------------------------------- 1 | {"name": "San Antonio", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment3/user.json: -------------------------------------------------------------------------------- 1 | {"name": "User1", "password": "User1"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. pip3 install -r requirements.txt 9 | 4. python3 application.py 10 | 11 | 12 | Try 13 | --- 14 | 1. Open application url: http://localhost:5009/ 15 | 2. Provide any username/password (no checks yet) 16 | 3. Register cities 17 | 4. Logout 18 | 5. Login again using same user. 19 | 20 | Stop 21 | ---- 22 | 1. Ctrl+C in the window where application.py was started 23 | 24 | 25 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/admin.json: -------------------------------------------------------------------------------- 1 | {"name": "Admin1", "password": "Admin1"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/austin.json: -------------------------------------------------------------------------------- 1 | {"name": "Austin", "url": "https://www.cs.utexas.edu/~devdatta/Austin.txt"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/dallas.json: -------------------------------------------------------------------------------- 1 | {"name": "Dallas", "url": "https://www.cs.utexas.edu/~devdatta/Dallas.txt"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/houston.json: -------------------------------------------------------------------------------- 1 | {"name": "Houston", "url": "http://houston-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | gunicorn 5 | Jinja2==3.0.1 6 | Werkzeug==2.0.0 7 | pyyaml 8 | SQLAlchemy 9 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/san-antonio.json: -------------------------------------------------------------------------------- 1 | {"name": "San Antonio", "url": "http://san-antonio-url.html"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/weather-portal-templates/assignment4-template/static/images/longhorn.png -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/test-requests.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | r = requests.get('https://www.cs.utexas.edu/~devdatta/Houston.txt') 4 | 5 | print(r.text) 6 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/user-city-austin.json: -------------------------------------------------------------------------------- 1 | {"name": "Austin", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/user-city-dallas.json: -------------------------------------------------------------------------------- 1 | {"name": "Dallas", "month": "July", "year": "2023", "weather_params": "TMAX,TMIN,SNOW"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/user-city-san-antonio.json: -------------------------------------------------------------------------------- 1 | {"name": "San Antonio", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/user1.json: -------------------------------------------------------------------------------- 1 | {"name": "abc", "password": "abc"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/user2.json: -------------------------------------------------------------------------------- 1 | {"name": "devdatta", "password": "devdatta"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment4-template/weatherportal.db.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/weather-portal-templates/assignment4-template/weatherportal.db.1 -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/README: -------------------------------------------------------------------------------- 1 | WRF Web App 2 | ============ 3 | 4 | Run 5 | ---- 6 | 1. python3 -m venv venv 7 | 2. source venv/bin/activate 8 | 3. For Google OAuth: 9 | - pip3 install --only-binary :all: greenlet 10 | - pip3 install --only-binary :all: pyopenssl 11 | 3. pip3 install -r requirements.txt 12 | 4. python3 application.py 13 | 14 | 15 | Try 16 | --- 17 | 1. Open application url: 18 | - Non ssl: http://localhost:5009/ 19 | - Ssl: https://localhost:5009/ 20 | 2. Use REST API to: 21 | - register admin 22 | - register users 23 | - register cities 24 | 3. Access the web app in the browser to test OAuth integration 25 | 4. Logout 26 | 5. Login again using same user. 27 | 28 | Stop 29 | ---- 30 | 1. Ctrl+C in the window where application.py was started 31 | 32 | 33 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/admin.json: -------------------------------------------------------------------------------- 1 | {"name": "Admin1", "password": "Admin1"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.21.0 2 | Flask==2.0.1 3 | flask-login 4 | gunicorn 5 | Jinja2==3.0.1 6 | Werkzeug==2.0.0 7 | pyyaml 8 | SQLAlchemy 9 | google-api-python-client 10 | google-auth 11 | google-auth-oauthlib 12 | google-auth-httplib2 13 | bcrypt 14 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/static/images/longhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devdattakulkarni/ModernWebApps/9def2b217c75e75a624ff03a999cfe36f3b247a5/weather-portal-templates/assignment5/static/images/longhorn.png -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user-city-austin.json: -------------------------------------------------------------------------------- 1 | {"name": "Austin", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user-city-dallas.json: -------------------------------------------------------------------------------- 1 | {"name": "Dallas", "month": "July", "year": "2023", "weather_params": "TMAX,TMIN,SNOW"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user-city-san-antonio.json: -------------------------------------------------------------------------------- 1 | {"name": "San Antonio", "month": "August", "year": "2023", "weather_params": "TMAX,TMIN"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user.json: -------------------------------------------------------------------------------- 1 | {"name": "User1", "password": "User1"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user1.json: -------------------------------------------------------------------------------- 1 | {"name": "abc", "password": "abc"} 2 | -------------------------------------------------------------------------------- /weather-portal-templates/assignment5/user2.json: -------------------------------------------------------------------------------- 1 | {"name": "devdatta", "password": "devdatta"} 2 | --------------------------------------------------------------------------------