Skip to content
Open

Site #26

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/.metadata/
*.exe
*.classpath
*.idea
Binary file added EShop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions STS/eshop/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
/build/
/.settings/
*.classpath
12 changes: 12 additions & 0 deletions STS/eshop/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
7 changes: 7 additions & 0 deletions STS/eshop/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions STS/eshop/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="eshop">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="eshop"/>
<property name="java-output-path" value="/eshop/build/classes"/>
</wb-module>
</project-modules>
10 changes: 10 additions & 0 deletions STS/eshop/.settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
1 change: 1 addition & 0 deletions STS/eshop/.settings/org.eclipse.wst.jsdt.ui.superType.name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
22 changes: 22 additions & 0 deletions STS/eshop/WebContent/E-Shop.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="stylesheet" TYPE="text/css"
HREF="<%=request.getContextPath()%>/css/style.css" TITLE="style" />
<title>E-Shop project</title>
</head>
<body>
<%@ include file="header.jsp"%>
<div class="container">
<%@ include file="leftMenu.jsp"%>
<div class="content" align="center">
<h1>${result}</h1>
</div>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions STS/eshop/WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

Binary file added STS/eshop/WebContent/WEB-INF/lib/antlr-2.7.7.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added STS/eshop/WebContent/WEB-INF/lib/dom4j-1.6.1.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added STS/eshop/WebContent/WEB-INF/lib/jstl.jar
Binary file not shown.
Binary file added STS/eshop/WebContent/WEB-INF/lib/jta-1.1.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added STS/eshop/WebContent/WEB-INF/lib/standard.jar
Binary file not shown.
38 changes: 33 additions & 5 deletions STS/eshop/WebContent/WEB-INF/spring-dispatcher-servlet.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema//context/spring-context.xsd">
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<context:component-scan base-package="com.eshop.controller" />

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
Expand Down Expand Up @@ -43,18 +46,43 @@
<bean id="ShowTableDB" class="com.eshop.model.ShowTableDB">
<constructor-arg ref="jdbcTemplate" />
</bean>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>

<bean id="userService" class="com.eshop.service.UserService" />

<bean id="passwordValidator" class="com.eshop.service.PasswordValidator" />

<bean id="dataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driver" ref="driver" />
<property name="url" value="jdbc:mysql://localhost:3306/eshop" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>


<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.eshop.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
</props>
</property>
</bean>

<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

<bean id="driver" class="com.mysql.jdbc.Driver" />
</beans>
41 changes: 41 additions & 0 deletions STS/eshop/WebContent/WEB-INF/spring-security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">

<http auto-config="true" use-expressions="true">
<intercept-url pattern="/css/**" access="permitAll" />
<intercept-url pattern="/login" access="permitAll" />
<intercept-url pattern="/logout" access="permitAll" />
<intercept-url pattern="/registration" access="permitAll" />
<intercept-url pattern="/adduser" access="permitAll" />
<intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')"/>
<form-login login-processing-url="/j_spring_security_check"
login-page="/login" authentication-failure-url="/login?login_error=t"
default-target-url="/"
username-parameter="login" password-parameter="password"/>
<logout logout-success-url="/" logout-url="/logout" />
</http>

<authentication-manager>
<authentication-provider>
<jdbc-user-service id="userService"
data-source-ref="dataSource"
users-by-username-query="select login, password, enabled from users where login=?"
authorities-by-username-query="select login, role from users where login=?"/>
</authentication-provider>
</authentication-manager>

<beans:bean id="dataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<beans:property name="driver" ref="driver" />
<beans:property name="url" value="jdbc:mysql://localhost:3306/eshop" />
<beans:property name="username" value="root" />
<beans:property name="password" value="root" />
</beans:bean>
<beans:bean id="driver" class="com.mysql.jdbc.Driver" />
</beans:beans>
47 changes: 34 additions & 13 deletions STS/eshop/WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Eshop-AG</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<display-name>E-Shop</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
24 changes: 24 additions & 0 deletions STS/eshop/WebContent/backup.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="stylesheet" TYPE="text/css"
HREF="<%=request.getContextPath()%>/css/style.css" TITLE="style" />
<title>Insert title here</title>
</head>
<body>
<div class="header">E-Shop project:Backup</div>
<div class="container">
<%@ include file="leftMenu.jsp"%>
<div class="content" align="center">
<form method="post" action="BackupDB">
Path <input type="text" name="path" id="path" value="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Uploads">
<input type="submit" value="ok">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
</div>
</div>
</body>
</html>
25 changes: 25 additions & 0 deletions STS/eshop/WebContent/createtable.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="stylesheet" TYPE="text/css"
HREF="<%=request.getContextPath()%>/css/style.css" TITLE="style" />
<title>E-Shop project</title>
</head>
<body>
<%@ include file="header.jsp"%>
<div class="container">
<%@ include file="leftMenu.jsp"%>
<div class="content" align="center">
<h1>${result}</h1>
<form action="createDataTable" method="post">
Please enter name of new purchase <input type="text" id="tableName" name="tableName" />
<input type="submit" value="OK"></input>
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
</div>
</div>
</body>
</html>
10 changes: 10 additions & 0 deletions STS/eshop/WebContent/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ h1 {
}

.menu_left {
font-face: Arial,Helvetica,Sans-serif
background-color: #fff;
box-shadow: 1px 1px 5px #036969;
float: left;
Expand All @@ -81,6 +82,11 @@ h1 {
color: #036969;
}

a.header {
text-decoration: none;
color: #fff;
}

.content {
background-color: #fff;
box-shadow: 1px 1px 5px #036969;
Expand All @@ -95,4 +101,8 @@ h1 {
border-top-right-radius: 0px;
border-top: none;
margin-bottom: 30px;
}

.error {
color: red;
}
25 changes: 25 additions & 0 deletions STS/eshop/WebContent/deletetable.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL="stylesheet" TYPE="text/css"
HREF="<%=request.getContextPath()%>/css/style.css" TITLE="style" />
<title>E-Shop project</title>
</head>
<body>
<%@ include file="header.jsp"%>
<div class="container">
<%@ include file="leftMenu.jsp"%>
<div class="content" align="center">
<h1>${result}</h1>
<form action="deleteDataTable" method="post">
Please enter #purchase you want to cancel <input type="text" id="tableName" name="tableName" />
<input type="submit" value="OK"></input>
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
</div>
</div>
</body>
</html>
Loading