push files
This commit is contained in:
parent
75cd74930c
commit
0264594936
8
.gitignore
vendored
8
.gitignore
vendored
@ -105,3 +105,11 @@
|
|||||||
/Semester 3/Assignments/TermProject1_CalebFontenot copy/target/
|
/Semester 3/Assignments/TermProject1_CalebFontenot copy/target/
|
||||||
/Semester 3/Assignments/TermProject2_CalebFontenot/target/
|
/Semester 3/Assignments/TermProject2_CalebFontenot/target/
|
||||||
/Semester 3/Exams-Quizzes/ProgrammingQuiz1_CalebFontenot/target/
|
/Semester 3/Exams-Quizzes/ProgrammingQuiz1_CalebFontenot/target/
|
||||||
|
/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/target/
|
||||||
|
/Semester 3/Assignments/LabFileUpload/target/
|
||||||
|
/Semester 3/Assignments/LabFileUpload_Dbase/target/
|
||||||
|
/Semester 3/Assignments/LabFileDownload/target/
|
||||||
|
/Semester 3/Assignments/LabFileDownload_Dbases/target/
|
||||||
|
/Semester 3/Exams-Quizzes/Problem2Final2800/target/
|
||||||
|
/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/target/
|
||||||
|
/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/target/
|
||||||
|
1
Semester 3/Assignments/.~lock.dbase.rtf#
Normal file
1
Semester 3/Assignments/.~lock.dbase.rtf#
Normal file
@ -0,0 +1 @@
|
|||||||
|
Caleb Fontenot,caleb,caleb-gaming-laptop-archlinux,29.04.2024 10:04,file:///home/caleb/.config/libreoffice/4;
|
BIN
Semester 3/Assignments/LabFileDownload.zip
Normal file
BIN
Semester 3/Assignments/LabFileDownload.zip
Normal file
Binary file not shown.
21
Semester 3/Assignments/LabFileDownload/nb-configuration.xml
Normal file
21
Semester 3/Assignments/LabFileDownload/nb-configuration.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
48
Semester 3/Assignments/LabFileDownload/pom.xml
Normal file
48
Semester 3/Assignments/LabFileDownload/pom.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>LabFileDownload</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>LabFileDownload-1</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.labfiledownload;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.labfiledownload.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import org.primefaces.model.DefaultStreamedContent;
|
||||||
|
import org.primefaces.model.StreamedContent;
|
||||||
|
import org.primefaces.util.SerializableSupplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Named(value = "downloadBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class DownloadBean implements Serializable
|
||||||
|
{
|
||||||
|
private StreamedContent fileStreamContent;
|
||||||
|
|
||||||
|
private void download()
|
||||||
|
{
|
||||||
|
String directory = "/media/DataEXT4/WebDev/pdf";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Path path = Paths.get(directory + "/" + "book1.pdf");
|
||||||
|
File file = new File(path.toAbsolutePath().toString());
|
||||||
|
InputStream inputStream
|
||||||
|
= new FileInputStream(file.getAbsoluteFile());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.fileStreamContent
|
||||||
|
= DefaultStreamedContent.builder()
|
||||||
|
.name("book1.pdf")
|
||||||
|
.contentType("application/pdf")
|
||||||
|
|
||||||
|
.stream(new SerializableSupplier<InputStream>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public InputStream get()
|
||||||
|
{
|
||||||
|
return inputStream;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
|
||||||
|
System.out.println(e);
|
||||||
|
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Failed to download file.",
|
||||||
|
e.toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamedContent getFileStreamContent()
|
||||||
|
{
|
||||||
|
download();
|
||||||
|
return fileStreamContent;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Download</title>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function showStatus() {
|
||||||
|
PF('statusDialog').show();
|
||||||
|
}
|
||||||
|
function hideStatus() {
|
||||||
|
PF('statusDialog').hide();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<p:growl showDetail="true" life="8000" />
|
||||||
|
<p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false">
|
||||||
|
<p:graphicImage name="images/ajax-loader.gif" />
|
||||||
|
</p:dialog>
|
||||||
|
<p:commandLink value="Download" ajax="false"
|
||||||
|
onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)">
|
||||||
|
<p:graphicImage name="images/fileDownload.png" style="vertical-align:middle; width:32px; height:32px;" />
|
||||||
|
<p:fileDownload value="#{downloadBean.fileStreamContent}" />
|
||||||
|
</p:commandLink>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
BIN
Semester 3/Assignments/LabFileDownload_Dbases.zip
Normal file
BIN
Semester 3/Assignments/LabFileDownload_Dbases.zip
Normal file
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
53
Semester 3/Assignments/LabFileDownload_Dbases/pom.xml
Normal file
53
Semester 3/Assignments/LabFileDownload_Dbases/pom.xml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>LabFileDownload_Dbases</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>LabFileDownload_Dbases</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>8.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.labfiledownload;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.labfiledownload.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.annotation.PreDestroy;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.sql.Blob;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import org.primefaces.model.DefaultStreamedContent;
|
||||||
|
import org.primefaces.model.StreamedContent;
|
||||||
|
import org.primefaces.util.SerializableSupplier;
|
||||||
|
|
||||||
|
@Named(value = "downloadBeanDBase")
|
||||||
|
@SessionScoped
|
||||||
|
public class DownloadBeanDBase implements Serializable
|
||||||
|
{
|
||||||
|
private StreamedContent fileStreamContent;
|
||||||
|
Connection connection;
|
||||||
|
|
||||||
|
public DownloadBeanDBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection = connection();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Failed to connect to the database.",
|
||||||
|
e.toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_WARN,
|
||||||
|
"Failed to close the connection with the database.",
|
||||||
|
e.toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void download()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ResultSet results = getRsultSetFromDatabase();
|
||||||
|
ResultSetMetaData meta = results.getMetaData();
|
||||||
|
results.next();//position the cursor
|
||||||
|
Blob blob = results.getBlob("binary_data");
|
||||||
|
InputStream inputStream = blob.getBinaryStream();
|
||||||
|
this.fileStreamContent
|
||||||
|
= DefaultStreamedContent.builder()
|
||||||
|
.name("TEST 4.pdf")
|
||||||
|
.contentType("application/pdf")
|
||||||
|
.stream(new SerializableSupplier<InputStream>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public InputStream get()
|
||||||
|
{
|
||||||
|
return inputStream;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Failed to download file.",
|
||||||
|
e.toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamedContent getFileStreamContent()
|
||||||
|
{
|
||||||
|
download();
|
||||||
|
return fileStreamContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResultSet getRsultSetFromDatabase() throws SQLException
|
||||||
|
{
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
String sqlStr = "SELECT * from binary_files where key_ai = 2 ";
|
||||||
|
ps = connection.prepareStatement(sqlStr);
|
||||||
|
rs = ps.executeQuery();
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Connection connection()
|
||||||
|
throws SQLException,
|
||||||
|
ClassNotFoundException, InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
String databaseName = "downloads";
|
||||||
|
String userName = "java";
|
||||||
|
String password = "java";
|
||||||
|
String URL2 = "com.mysql.jdbc.Driver";
|
||||||
|
Connection con = null;
|
||||||
|
Class.forName(URL2).newInstance();
|
||||||
|
String ip = "localhost"; //internet connection
|
||||||
|
String url = "jdbc:mysql://" + ip + ":3306/" + databaseName;
|
||||||
|
url += "?allowPublicKeyRetrieval=true&useSSL=false";
|
||||||
|
con = DriverManager.getConnection(url, userName, password);
|
||||||
|
con.setReadOnly(false);
|
||||||
|
return con;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Download from database</title>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function showStatus() {
|
||||||
|
PF('statusDialog').show();
|
||||||
|
}
|
||||||
|
function hideStatus() {
|
||||||
|
PF('statusDialog').hide();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<p:growl showDetail="true" life="8000" />
|
||||||
|
<p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false">
|
||||||
|
<p:graphicImage name="images/ajax-loader.gif" />
|
||||||
|
</p:dialog>
|
||||||
|
<p:commandLink value="Download PDF from database" ajax="false"
|
||||||
|
onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)">
|
||||||
|
<p:graphicImage name="images/fileDownload.png" style="vertical-align:middle; width:32px; height:32px;" />
|
||||||
|
<p:fileDownload value="#{downloadBeanDBase.fileStreamContent}" />
|
||||||
|
</p:commandLink>
|
||||||
|
<p:commandLink value="Download mp3 from database" ajax="false"
|
||||||
|
onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)">
|
||||||
|
<p:graphicImage name="images/fileDownload.png" style="vertical-align:middle; width:32px; height:32px;" />
|
||||||
|
<p:fileDownload value="#{downloadBeanDBase.fileStreamContent}" />
|
||||||
|
</p:commandLink>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
BIN
Semester 3/Assignments/LabFileUpload.zip
Normal file
BIN
Semester 3/Assignments/LabFileUpload.zip
Normal file
Binary file not shown.
22
Semester 3/Assignments/LabFileUpload/nb-configuration.xml
Normal file
22
Semester 3/Assignments/LabFileUpload/nb-configuration.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<netbeans.hint.jdkPlatform>JDK_11</netbeans.hint.jdkPlatform>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
83
Semester 3/Assignments/LabFileUpload/pom.xml
Normal file
83
Semester 3/Assignments/LabFileUpload/pom.xml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>ripoll</groupId>
|
||||||
|
<artifactId>LabFileUpload</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>LabFileUpload-1.0</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
<compilerArguments>
|
||||||
|
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||||
|
<silent>true</silent>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.nio.file.FileAlreadyExistsException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import org.primefaces.event.FileUploadEvent;
|
||||||
|
import org.primefaces.model.file.UploadedFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author lisset
|
||||||
|
*/
|
||||||
|
@Named(value = "fileUploadBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class FieUploadBean implements Serializable {
|
||||||
|
|
||||||
|
private UploadedFile file;
|
||||||
|
|
||||||
|
public UploadedFile getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile(UploadedFile file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleFileUpload(FileUploadEvent event){
|
||||||
|
System.out.println("handleFileUpload");
|
||||||
|
file = event.getFile();
|
||||||
|
|
||||||
|
if (writeToAnyExistingDirectory(file))
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Upload Successful",
|
||||||
|
file.getFileName() + " is uploaded."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Failed to upload.",
|
||||||
|
file.getFileName() + " was not uploaded."));
|
||||||
|
}
|
||||||
|
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null, new FacesMessage(
|
||||||
|
FacesMessage.SEVERITY_INFO,
|
||||||
|
"upload succesful",
|
||||||
|
file.getFileName() + " is uploaded"));
|
||||||
|
writeToAnyExistingDirectory(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean writeToAnyExistingDirectory(UploadedFile f) {
|
||||||
|
Path path = Paths.get("/media/DataEXT4/WebDev/");
|
||||||
|
String s = "";
|
||||||
|
if (Files.exists(path)) {
|
||||||
|
s = path.toString();
|
||||||
|
}
|
||||||
|
try (InputStream input = f.getInputStream()) {
|
||||||
|
String fileName = f.getFileName();
|
||||||
|
Files.copy(input, new File(s, fileName).toPath());
|
||||||
|
} catch (FileAlreadyExistsException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
System.out.println("------ failed to upload file" + e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package ripoll.labfileupload;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package ripoll.labfileupload.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>File Uploads</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form>
|
||||||
|
<p:growl id="growl" life="50000" showSummary="true" showDetail="true"/>
|
||||||
|
<p:fileUpload id="upload"
|
||||||
|
dragDropSupport="true"
|
||||||
|
update="growl"
|
||||||
|
widgetVar="importDevicesWidget"
|
||||||
|
listener="#{fileUploadBean.handleFileUpload}"
|
||||||
|
label="Add a file"
|
||||||
|
uploadLabel="upload all"
|
||||||
|
cancelLabel="cancel all">
|
||||||
|
<p:dataTable>
|
||||||
|
|
||||||
|
</p:dataTable>
|
||||||
|
</p:fileUpload>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
BIN
Semester 3/Assignments/LabFileUpload_Dbase.zip
Normal file
BIN
Semester 3/Assignments/LabFileUpload_Dbase.zip
Normal file
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>JSP</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
53
Semester 3/Assignments/LabFileUpload_Dbase/pom.xml
Normal file
53
Semester 3/Assignments/LabFileUpload_Dbase/pom.xml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>LabFileUpload_Dbase</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>LabFileUpload_Dbase</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>12.0.0</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>8.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.labfileupload;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.labfileupload.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV1
|
||||||
|
*/
|
||||||
|
public class Database
|
||||||
|
{
|
||||||
|
|
||||||
|
public static int saveFile( String directory, String fileName, String extension)
|
||||||
|
{
|
||||||
|
int count = -1;
|
||||||
|
File f = null;
|
||||||
|
Connection con = connection();
|
||||||
|
if (con == null)
|
||||||
|
{
|
||||||
|
System.out.println("cannot connect to database");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
|
||||||
|
String sqlStr = "INSERT INTO binary_files (file_name , file_extension, size_kb, binary_data )VALUES(?,?,?,?)";
|
||||||
|
ps = con.prepareStatement(sqlStr);
|
||||||
|
|
||||||
|
Path path = Paths.get(directory + "/" + fileName);
|
||||||
|
f = path.toFile();
|
||||||
|
long fileLength = f.length();
|
||||||
|
ps.setString(1, fileName);
|
||||||
|
ps.setString(2, extension);
|
||||||
|
ps.setLong(3, fileLength/1000);
|
||||||
|
|
||||||
|
FileInputStream fis = new FileInputStream(f);
|
||||||
|
ps.setBinaryStream(4, fis, fileLength);
|
||||||
|
//execute
|
||||||
|
count = ps.executeUpdate();
|
||||||
|
}
|
||||||
|
catch ( FileNotFoundException e )
|
||||||
|
{
|
||||||
|
System.out.println("method Database:saveFile " + e);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println("method Database:saveFile " + e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( f!= null )
|
||||||
|
f.delete();//delete the uploaded file
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
System.out.println("connection did not close...method Database:saveFile " + e);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static Connection connection() //throws InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
String databaseName = "downloads";
|
||||||
|
String userName = "java";
|
||||||
|
String password = "java";
|
||||||
|
String URL2 = "com.mysql.jdbc.Driver";
|
||||||
|
Connection con = null;
|
||||||
|
try
|
||||||
|
{// Load Sun's jdbc driver
|
||||||
|
Class.forName(URL2).newInstance();
|
||||||
|
System.out.println("JDBC Driver loaded!");
|
||||||
|
}
|
||||||
|
catch (Exception e) // driver not found
|
||||||
|
{
|
||||||
|
System.err.println("Unable to load database driver");
|
||||||
|
System.err.println("Details : " + e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String ip = "localhost"; //internet connection
|
||||||
|
String url = "jdbc:mysql://" + ip + ":3306/" + databaseName;
|
||||||
|
url += "?allowPublicKeyRetrieval=true&useSSL=false";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
con = DriverManager.getConnection(url, userName, password);
|
||||||
|
con.setReadOnly(false);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.err.println(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
System.out.println("connection successfull");
|
||||||
|
return con;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
connection();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.faces.application.FacesMessage;
|
||||||
|
import jakarta.faces.context.FacesContext;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.nio.file.FileAlreadyExistsException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import org.primefaces.event.FileUploadEvent;
|
||||||
|
import org.primefaces.model.file.UploadedFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author asdv5
|
||||||
|
*/
|
||||||
|
@Named(value = "fileUploadBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class FileUploadBean implements Serializable
|
||||||
|
{
|
||||||
|
private UploadedFile file;
|
||||||
|
|
||||||
|
public void handleFileUpload(FileUploadEvent event)
|
||||||
|
{
|
||||||
|
System.out.println("handleFileUpload");
|
||||||
|
UploadedFile file = event.getFile();
|
||||||
|
if (uploadToDatabase(file))
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_INFO,
|
||||||
|
"upload successful",
|
||||||
|
file.getFileName() + " is uploaded."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_ERROR,
|
||||||
|
"Failed to upload.",
|
||||||
|
file.getFileName() + " was not uploaded."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean fileExists(Path path, String fileName)
|
||||||
|
{
|
||||||
|
Path p = Paths.get(path.toString() + "/" + fileName);
|
||||||
|
System.out.println(p);
|
||||||
|
if (Files.exists(p))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the file in Uploaded file into MAC existing directory
|
||||||
|
* /Users/asdv5/user1")
|
||||||
|
*
|
||||||
|
* @param f the file to be uploaded.
|
||||||
|
* @return the filename written, or null if nothing was written
|
||||||
|
*/
|
||||||
|
private String writeToAnyExistingDirectory(UploadedFile f)
|
||||||
|
{
|
||||||
|
InputStream input = null;
|
||||||
|
Path path = Paths.get("/media/DataEXT4/WebDev/");
|
||||||
|
String s = "";
|
||||||
|
String fileName = "";
|
||||||
|
if (Files.exists(path))
|
||||||
|
{
|
||||||
|
s = path.toString();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
input = f.getInputStream();
|
||||||
|
fileName = f.getFileName();
|
||||||
|
Files.copy(input, new File(s, fileName).toPath());
|
||||||
|
System.out.println("---success saving file" + s + " " + fileName);
|
||||||
|
}
|
||||||
|
catch (FileAlreadyExistsException e)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
fileName = f.getFileName();
|
||||||
|
int indexOfLastDot = fileName.lastIndexOf(".");
|
||||||
|
if (indexOfLastDot != -1)
|
||||||
|
{
|
||||||
|
String s1 = fileName.substring(0, indexOfLastDot);
|
||||||
|
s1 += "_" + i;
|
||||||
|
s1 += fileName.substring(indexOfLastDot);
|
||||||
|
fileName = s1;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileName += "_1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (fileExists(path, fileName));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
input.close();
|
||||||
|
input = f.getInputStream();
|
||||||
|
Files.copy(input, new File(s, fileName).toPath());
|
||||||
|
System.out.println("---success saving file" + s + " " + fileName);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
System.out.println(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
System.out.println("---failed to upload file " + e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
System.out.println(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads a file to a database. Firstly writes the file to the user's
|
||||||
|
* directory and then copies it to the database and deletes it from the
|
||||||
|
* user's directory.
|
||||||
|
*
|
||||||
|
* @param f Uploaded file that contains the file to be uploaded
|
||||||
|
* @return true if the file was uploaded, false otherwise.
|
||||||
|
*/
|
||||||
|
private boolean uploadToDatabase(UploadedFile f)
|
||||||
|
{
|
||||||
|
//users's directory
|
||||||
|
String uploadDirectory = "/media/DataEXT4/WebDev/";
|
||||||
|
|
||||||
|
//>if failed to write to user's directory, return false
|
||||||
|
if (writeToAnyExistingDirectory(f) == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//>separate file name from file extension if any
|
||||||
|
String fileName = f.getFileName();
|
||||||
|
int indexOfDot = fileName.lastIndexOf(".");
|
||||||
|
String fileExtension = "";
|
||||||
|
if (indexOfDot != -1)
|
||||||
|
{
|
||||||
|
fileExtension = fileName.substring(indexOfDot);
|
||||||
|
}
|
||||||
|
String fullPathNfileName = uploadDirectory + "/" + fileName;
|
||||||
|
|
||||||
|
//> write to database
|
||||||
|
int count = Database.saveFile(uploadDirectory, fileName, fileExtension);
|
||||||
|
System.out.println(" ...the database server returned: " + Integer.toString(count));
|
||||||
|
Path path = Paths.get(uploadDirectory + "/" + fileName);
|
||||||
|
|
||||||
|
//>delete file from usr's directory
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
Files.deleteIfExists(path);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.addMessage(null,
|
||||||
|
new FacesMessage(
|
||||||
|
FacesMessage.SEVERITY_WARN,
|
||||||
|
file.getFileName(),
|
||||||
|
"Failed to delete an intemmediate file but the file was uploaded to database. "
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
return count >= 0 ? true : false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form>
|
||||||
|
<p:growl id="localForm1Growl" showDetail="true" life="3000"
|
||||||
|
redisplay="true" />
|
||||||
|
<p:fileUpload id="upload" value="#{fileUploadBean}"
|
||||||
|
mode="advanced"
|
||||||
|
process="@this"
|
||||||
|
listener="#{fileUploadBean.handleFileUpload}"
|
||||||
|
dragDropSupport="true"
|
||||||
|
update="localForm1Growl"
|
||||||
|
label="Add a file"
|
||||||
|
uploadLabel=" upload all"
|
||||||
|
cancelLabel="discard all"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
<p:dataTable >
|
||||||
|
<p:column>
|
||||||
|
</p:column >
|
||||||
|
</p:dataTable>
|
||||||
|
</p:fileUpload>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
BIN
Semester 3/Assignments/Problem2Final2800.zip
Normal file
BIN
Semester 3/Assignments/Problem2Final2800.zip
Normal file
Binary file not shown.
BIN
Semester 3/Assignments/TP2_CalebFontenot.zip
Normal file
BIN
Semester 3/Assignments/TP2_CalebFontenot.zip
Normal file
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
42
Semester 3/Assignments/Templates1_CalebFontenot/pom.xml
Normal file
42
Semester 3/Assignments/Templates1_CalebFontenot/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>edu.slcc.asdv.caleb</groupId>
|
||||||
|
<artifactId>Templates1_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>Templates1_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
@Named(value="templatesBean")
|
||||||
|
@ViewScoped
|
||||||
|
public class templatesBean implements Serializable{
|
||||||
|
private String msg = "";
|
||||||
|
|
||||||
|
public String getMsg() { return msg; }
|
||||||
|
public void action(String arg){this.msg = arg;}
|
||||||
|
|
||||||
|
public String createMenu(String menu) {
|
||||||
|
String s = "";
|
||||||
|
for (String menuItems: menu) {
|
||||||
|
s += menuItems;
|
||||||
|
return "I created a menu and return " + s1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.templates1_calebfontenot;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package edu.slcc.asdv.caleb.templates1_calebfontenot.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="jakarta.faces.html"
|
||||||
|
xmlns:ui="jakarta.faces.facelets">
|
||||||
|
<ui:composition>
|
||||||
|
<h:outputText value="#{templatesBean.msg}"/>
|
||||||
|
<h:form>
|
||||||
|
<h:commandButton value="button" action="#{templatesBeanName[action](arg)}"/>
|
||||||
|
</h:form>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="jakarta.faces.html">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:include src="template1.xhtml">
|
||||||
|
<ui:param name="templatesBeanName" value="#{templatesBean}"/>
|
||||||
|
<ui:param name="action" value="action"/>
|
||||||
|
<ui:param name="arg" value="ASDV"/>
|
||||||
|
<ui:param name="createMenuPram" value="createMenu"/>
|
||||||
|
<ui:param name="param1" value="Open file"/>
|
||||||
|
<ui:param name="param2" value="Close File"/>
|
||||||
|
</ui:include>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
45
Semester 3/Assignments/dbase.rtf
Normal file
45
Semester 3/Assignments/dbase.rtf
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{\rtf1\ansi\ansicpg1252\cocoartf2639
|
||||||
|
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||||
|
{\colortbl;\red255\green255\blue255;}
|
||||||
|
{\*\expandedcolortbl;;}
|
||||||
|
\margl1440\margr1440\vieww11520\viewh8400\viewkind0
|
||||||
|
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
||||||
|
|
||||||
|
\f0\fs24 \cf0 -- phpMyAdmin SQL Dump\
|
||||||
|
-- version 5.2.0\
|
||||||
|
-- https://www.phpmyadmin.net/\
|
||||||
|
--\
|
||||||
|
-- Host: localhost:8889\
|
||||||
|
-- Generation Time: Apr 29, 2024 at 02:43 PM\
|
||||||
|
-- Server version: 5.7.39\
|
||||||
|
-- PHP Version: 7.4.33\
|
||||||
|
\
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";\
|
||||||
|
START TRANSACTION;\
|
||||||
|
SET time_zone = "+00:00";\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;\
|
||||||
|
\
|
||||||
|
--\
|
||||||
|
-- Database: `downloads`\
|
||||||
|
--\
|
||||||
|
\
|
||||||
|
-- --------------------------------------------------------\
|
||||||
|
\
|
||||||
|
--\
|
||||||
|
-- Table structure for table `binary_files`\
|
||||||
|
--\
|
||||||
|
\
|
||||||
|
CREATE TABLE `binary_files` (\
|
||||||
|
`key_ai` int(11) NOT NULL,\
|
||||||
|
`file_name` varchar(1000) NOT NULL,\
|
||||||
|
`file_extension` varchar(100) NOT NULL,\
|
||||||
|
`size_kb` bigint(20) NOT NULL,\
|
||||||
|
`binary_data` longblob NOT NULL\
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;\
|
||||||
|
\
|
||||||
|
}
|
37
Semester 3/Assignments/dbase.sql
Normal file
37
Semester 3/Assignments/dbase.sql
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
-- phpMyAdmin SQL Dump
|
||||||
|
-- version 5.2.0
|
||||||
|
-- https://www.phpmyadmin.net/
|
||||||
|
--
|
||||||
|
-- Host: localhost:8889
|
||||||
|
-- Generation Time: Apr 29, 2024 at 02:43 PM
|
||||||
|
-- Server version: 5.7.39
|
||||||
|
-- PHP Version: 7.4.33
|
||||||
|
|
||||||
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
START TRANSACTION;
|
||||||
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Database: `downloads`
|
||||||
|
--
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `binary_files`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `binary_files` (
|
||||||
|
`key_ai` int(11) NOT NULL,
|
||||||
|
`file_name` varchar(1000) NOT NULL,
|
||||||
|
`file_extension` varchar(100) NOT NULL,
|
||||||
|
`size_kb` bigint(20) NOT NULL,
|
||||||
|
`binary_data` longblob NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>edu.slcc.asdv.caleb</groupId>
|
||||||
|
<artifactId>FinalExamProblem2_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>FinalExamProblem2_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import jakarta.json.JsonArray;
|
||||||
|
import jakarta.json.JsonNumber;
|
||||||
|
import jakarta.json.JsonObject;
|
||||||
|
import jakarta.json.JsonString;
|
||||||
|
import jakarta.json.JsonValue;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
@Named(value = "jsonBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class JsonBean implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of JsonBean
|
||||||
|
*/
|
||||||
|
public JsonBean()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public String compute()
|
||||||
|
{
|
||||||
|
String returnString = "";
|
||||||
|
ArrayList<LinkedHashMap<String, String>> personArray = new ArrayList<>();
|
||||||
|
personArray.add(JsonSupplier.createMapOfSupplier("s1", "Jeff", "21", "Sillicon Valley"));
|
||||||
|
personArray.add(JsonSupplier.createMapOfSupplier("s2", "Mary Poppins", "22", "London"));
|
||||||
|
JsonObject jo = JsonSupplier.createJsonObjectForSuppliers(personArray);
|
||||||
|
returnString += navigateTree(jo, null) + "\n";
|
||||||
|
returnString += jo.toString();
|
||||||
|
return returnString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String navigateTree(JsonValue tree, String returnString)
|
||||||
|
{
|
||||||
|
if (returnString == null) {
|
||||||
|
returnString = "";
|
||||||
|
}
|
||||||
|
if (tree == null) {
|
||||||
|
return returnString;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tree.getValueType()) {
|
||||||
|
case OBJECT:
|
||||||
|
JsonObject object = (JsonObject) tree;
|
||||||
|
for (String name : object.keySet()) {
|
||||||
|
returnString += "Key " + name + ": \n";
|
||||||
|
returnString = navigateTree(object.get(name), returnString);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ARRAY:
|
||||||
|
JsonArray array = (JsonArray) tree;
|
||||||
|
for (JsonValue val : array) {
|
||||||
|
returnString = navigateTree(val, returnString);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
JsonString st = (JsonString) tree;
|
||||||
|
returnString += "\tSTRING " + st.getString() + "\n";
|
||||||
|
break;
|
||||||
|
case NUMBER:
|
||||||
|
JsonNumber num = (JsonNumber) tree;
|
||||||
|
returnString += "\tNUMBER " + num.toString() + "\n";
|
||||||
|
break;
|
||||||
|
case TRUE:
|
||||||
|
case FALSE:
|
||||||
|
case NULL:
|
||||||
|
returnString += tree.getValueType().toString() + "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return returnString;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import jakarta.json.Json;
|
||||||
|
import jakarta.json.JsonArrayBuilder;
|
||||||
|
import jakarta.json.JsonObject;
|
||||||
|
import jakarta.json.JsonObjectBuilder;
|
||||||
|
import jakarta.json.JsonReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class JsonSupplier
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a JsonObject by traversing the arrayList of LinkedHashMap
|
||||||
|
*
|
||||||
|
* @param suppliers ArrayList of LinkedHashMap. Each element of the
|
||||||
|
* arrayList is a row of suppliers table. The key of the LinkedHashMap is
|
||||||
|
* the attribute name and the value of the attribute Example ( One liked
|
||||||
|
* hash map is one row from the table) LinkedHashMap 1 : key: snumber,
|
||||||
|
* value: s1 key: sname, value: white key: status, value: 20 key: city,
|
||||||
|
* value London LinkedHashMap 2 : key: snumber, value: s2 key: sname, value:
|
||||||
|
* black key: status, value: 30 key: city, value Paris The value of the map
|
||||||
|
* @return JsonObject
|
||||||
|
*/
|
||||||
|
public static JsonObject createJsonObjectForSuppliers(ArrayList<LinkedHashMap<String, String>> suppliers)
|
||||||
|
{
|
||||||
|
JsonObjectBuilder jsonBuilder = Json.createObjectBuilder();
|
||||||
|
int counter = 1;
|
||||||
|
for (LinkedHashMap<String, String> supplier : suppliers)
|
||||||
|
{
|
||||||
|
// create an array of key-value pairs
|
||||||
|
JsonArrayBuilder arraySupplierBld = Json.createArrayBuilder();
|
||||||
|
|
||||||
|
// create each key-value pair as seperate object and add it to the array
|
||||||
|
Set<Map.Entry<String, String>> entrySet = supplier.entrySet();
|
||||||
|
for (Map.Entry<String, String> entry : entrySet)
|
||||||
|
{
|
||||||
|
arraySupplierBld.add(
|
||||||
|
Json.createObjectBuilder().add(entry.getKey(),
|
||||||
|
entry.getValue()).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
// add supplier-array to object
|
||||||
|
String objectID = "+" + (counter++);
|
||||||
|
|
||||||
|
jsonBuilder.add(objectID, arraySupplierBld);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject allSuppliersJsonObject = jsonBuilder.build();
|
||||||
|
return allSuppliersJsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a JsonObject by reading the String data in JSON format
|
||||||
|
*
|
||||||
|
* @param jsonData Json format data
|
||||||
|
* @return JsonObject
|
||||||
|
*/
|
||||||
|
public static JsonObject createJsonObjectFromString(String jsonData)
|
||||||
|
{
|
||||||
|
JsonReader jsonReader = Json.createReader(new StringReader(jsonData));
|
||||||
|
JsonObject o = jsonReader.readObject();
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a LinkedHashMap of 4 ENTRYies.Keys name: snumber, sname, status
|
||||||
|
* and city. Values of map are the parameters.
|
||||||
|
*
|
||||||
|
* @param snumber value of map
|
||||||
|
* @param sname value of map
|
||||||
|
* @param status value of map
|
||||||
|
* @param city value of map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LinkedHashMap<String, String> createMapOfSupplier(
|
||||||
|
String snumber,
|
||||||
|
String sname,
|
||||||
|
String status,
|
||||||
|
String city
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
LinkedHashMap<String, String> mapSupplier
|
||||||
|
= new LinkedHashMap<String, String>();
|
||||||
|
mapSupplier.put("snumber", snumber);
|
||||||
|
mapSupplier.put("sname", sname);
|
||||||
|
mapSupplier.put("status", status);
|
||||||
|
mapSupplier.put("city", city);
|
||||||
|
|
||||||
|
return mapSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String supplierJasonObject()
|
||||||
|
{
|
||||||
|
ArrayList< LinkedHashMap<String, String>> suppliers = new ArrayList();
|
||||||
|
for (int i = 1; i <= 2; ++i)
|
||||||
|
{
|
||||||
|
LinkedHashMap<String, String> oneSupplierRowOfTable
|
||||||
|
= createMapOfSupplier(
|
||||||
|
"s1" + i,
|
||||||
|
"Johnson" + i,
|
||||||
|
Integer.toString(20 + i),
|
||||||
|
"london" + i);
|
||||||
|
suppliers.add(oneSupplierRowOfTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject j = createJsonObjectForSuppliers(suppliers);
|
||||||
|
return j.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeJsonToTextFile( JsonObject jo)
|
||||||
|
throws FileNotFoundException
|
||||||
|
{
|
||||||
|
String joString = jo.toString();
|
||||||
|
PrintWriter output = new PrintWriter(new FileOutputStream("jo.json", true));
|
||||||
|
output.print(joString);
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
public static JsonObject readTextFileIntoJson( String fileName)
|
||||||
|
throws FileNotFoundException
|
||||||
|
{
|
||||||
|
File file = new java.io.File(fileName);
|
||||||
|
Scanner input = new Scanner(file);
|
||||||
|
String joString = "";
|
||||||
|
while (input.hasNext())
|
||||||
|
{
|
||||||
|
joString += input.next();
|
||||||
|
}
|
||||||
|
input.close();
|
||||||
|
JsonObject jo = createJsonObjectFromString( joString);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.finalexamproblem2_calebfontenot;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package edu.slcc.asdv.caleb.finalexamproblem2_calebfontenot.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="jakarta.faces.html">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
<style>
|
||||||
|
.preformatted {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:outputLabel value="#{jsonBean.compute()}" styleClass="preformatted"/>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
@ -0,0 +1,48 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>edu.slcc.asdv.caleb</groupId>
|
||||||
|
<artifactId>FinalExamProblem3_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>FinalExamProblem3_CalebFontenot-1.0-SNAPSHOT</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<version>14.0.0-RC2</version>
|
||||||
|
<classifier>jakarta</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
|
||||||
|
*/
|
||||||
|
|
||||||
|
package beans;
|
||||||
|
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.enterprise.context.SessionScoped;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
@Named(value="slideMenuBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class slideMenuBean implements Serializable{
|
||||||
|
private boolean menuVisable;
|
||||||
|
public boolean isMenuVisable() { return menuVisable; }
|
||||||
|
public void toggleSlideMenu() { menuVisable = !menuVisable; }
|
||||||
|
private String out;
|
||||||
|
public String getOut() { return out; }
|
||||||
|
public void setOut(String out) { this.out = out; }
|
||||||
|
|
||||||
|
public void handleMenuSelection(int selection) {
|
||||||
|
String selectedMenuItem;
|
||||||
|
switch (selection) {
|
||||||
|
case 0:
|
||||||
|
selectedMenuItem = "save";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
selectedMenuItem = "update";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
selectedMenuItem = "delete";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
selectedMenuItem = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
out = "You selected " + selectedMenuItem;
|
||||||
|
System.out.println(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates a new instance of slideMenuBean */
|
||||||
|
public slideMenuBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package edu.slcc.asdv.caleb.finalexamproblem3_calebfontenot;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package edu.slcc.asdv.caleb.finalexamproblem3_calebfontenot.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="jakarta.faces.html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
<h:head>
|
||||||
|
<title>Facelet Title</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h:form id="f1">
|
||||||
|
<p:commandButton
|
||||||
|
id="id_btn" style="width: 33px; height:33px; margin-left: 5px"
|
||||||
|
value="#{menuBean.selectedMenuItem}"
|
||||||
|
type="button" icon="pi pi-bars">
|
||||||
|
<p:ajax event="click" listener="#{slideMenuBean.toggleSlideMenu}" update="sm1"/>
|
||||||
|
</p:commandButton>
|
||||||
|
<p:slideMenu id="sm1" style="display: #{slideMenuBean.menuVisable ? 'block' : 'none'};">
|
||||||
|
<p:menuitem value="Save" action="#{slideMenuBean.handleMenuSelection(0)}" icon="pi pi-save"/>
|
||||||
|
<p:menuitem value="Update" action="#{slideMenuBean.handleMenuSelection(1)}" icon="pi pi-refresh"/>
|
||||||
|
<p:menuitem value="Delete" action="#{slideMenuBean.handleMenuSelection(2)}" icon="pi pi-trash"/>
|
||||||
|
</p:slideMenu>
|
||||||
|
<p:outputLabel id="ol1" value="#{slideMenuBean.out}"/>
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
42
Semester 3/Exams-Quizzes/Problem2Final2800/pom.xml
Normal file
42
Semester 3/Exams-Quizzes/Problem2Final2800/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>asdv</groupId>
|
||||||
|
<artifactId>Problem2Final2800</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>Problem2Final2800-1</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jakartaee>10.0.0</jakartaee>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.platform</groupId>
|
||||||
|
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||||
|
<version>${jakartaee}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package asdv.problem2final2800;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.ApplicationPath;
|
||||||
|
import jakarta.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Jakarta RESTful Web Services for the application.
|
||||||
|
* @author Juneau
|
||||||
|
*/
|
||||||
|
@ApplicationPath("resources")
|
||||||
|
public class JakartaRestConfiguration extends Application {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package asdv.problem2final2800.resources;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Path("jakartaee10")
|
||||||
|
public class JakartaEE10Resource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
public Response ping(){
|
||||||
|
return Response
|
||||||
|
.ok("ping Jakarta EE")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package beans;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.faces.view.ViewScoped;
|
||||||
|
|
||||||
|
@Named(value = "templatesBean")
|
||||||
|
@ViewScoped
|
||||||
|
public class TemplatesBean implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
private String msgTopDefault = "";
|
||||||
|
private String msgBottomDefault = "";
|
||||||
|
private String msgLeftDefault = "Generate a number between 1 and 100!";
|
||||||
|
private String msgCenterDefault = "No center content ... press the below button!";
|
||||||
|
public String getMsgLeftDefault() { return msgLeftDefault; }
|
||||||
|
public void setMsgLeftDefault(String msgLeftDefault) { this.msgLeftDefault = msgLeftDefault; }
|
||||||
|
public String getMsgTopDefault(){return msgTopDefault;}
|
||||||
|
public void setMsgTopDefault(String msgTopDefault){this.msgTopDefault = msgTopDefault;}
|
||||||
|
public String getMsgBottomDefault(){return msgBottomDefault;}
|
||||||
|
public void setMsgBottomDefault(String msgBottomDefault){this.msgBottomDefault = msgBottomDefault;}
|
||||||
|
public String getMsgCenterDefault(){return msgCenterDefault;}
|
||||||
|
public void setMsgCenterDefault(String msgCenterDefault){this.msgCenterDefault = msgCenterDefault;}
|
||||||
|
public void leftAction() {
|
||||||
|
int randInt = (int) (Math.random() * 100 + 1);
|
||||||
|
this.msgLeftDefault = "" + randInt;
|
||||||
|
}
|
||||||
|
public void topAction(String msg){this.msgTopDefault = msg;}
|
||||||
|
public void bottomAction(String msg){this.msgBottomDefault = msg;
|
||||||
|
System.out.println( this.msgBottomDefault );}
|
||||||
|
|
||||||
|
public void centerAction(){this.msgCenterDefault = "This is default content";}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
|
||||||
|
<!-- Define Persistence Unit -->
|
||||||
|
<persistence-unit name="my_persistence_unit">
|
||||||
|
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
|
||||||
|
bean-discovery-mode="all">
|
||||||
|
</beans>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the
|
||||||
|
terms of the Eclipse Public License v. 2.0, which is available at
|
||||||
|
http://www.eclipse.org/legal/epl-2.0.
|
||||||
|
|
||||||
|
This Source Code may also be made available under the following Secondary
|
||||||
|
Licenses when the conditions for such availability set forth in the
|
||||||
|
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||||
|
version 2 with the GNU Classpath Exception, which is available at
|
||||||
|
https://www.gnu.org/software/classpath/license.html.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
-->
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="6.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd">
|
||||||
|
<context-param>
|
||||||
|
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<session-config>
|
||||||
|
<session-timeout>
|
||||||
|
30
|
||||||
|
</session-timeout>
|
||||||
|
</session-config>
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>faces/index.xhtml</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<h:head>
|
||||||
|
<title></title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<ui:composition template="template/layout.xhtml">
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
#top {
|
||||||
|
position: relative;
|
||||||
|
background-color: #cccccc;
|
||||||
|
padding: 5px;
|
||||||
|
margin: 0px 0px 10px 0px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
#bottom {
|
||||||
|
position: relative;
|
||||||
|
background-color: #cccccc;
|
||||||
|
padding: 5px;
|
||||||
|
margin: 10px 0px 0px 0px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
#left {
|
||||||
|
float: left;
|
||||||
|
background-color: #cccc11;
|
||||||
|
position: relative;
|
||||||
|
padding: 5px;
|
||||||
|
width: 150px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
#right {
|
||||||
|
float: right;
|
||||||
|
position: relative;
|
||||||
|
background-color: #cccc11;
|
||||||
|
padding: 5px;
|
||||||
|
width: 150px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
#content {
|
||||||
|
background-color: #00cc00;
|
||||||
|
padding: 5px;
|
||||||
|
margin: 0px 170px 0px 170px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
body {
|
||||||
|
background-color: #ffffff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: Verdana, "Verdana CE", Arial,
|
||||||
|
"Arial CE", "Lucida Grande CE",
|
||||||
|
lucida, "Helvetica CE",
|
||||||
|
sans-serif;
|
||||||
|
color: #000000;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8' ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
|
||||||
|
<ui:composition>
|
||||||
|
<h:outputText value="#{templatesBean.msgBottomDefault}"/>
|
||||||
|
|
||||||
|
<h:form>
|
||||||
|
<h:commandButton value="Bottom Button"
|
||||||
|
|
||||||
|
action="#{templatesBean[bottomActionName](arg)}"/>
|
||||||
|
</h:form>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user