Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20240528-BJava
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
20240528-BJava
Commits
0125c32c
Commit
0125c32c
authored
Jun 28, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Przykład JS - początek
parent
cf669e3a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
3 deletions
+27
-3
ProductController_v0.java
...ep/alternatywne_dostepy_do_bazy/ProductController_v0.java
+1
-1
RootController.java
...Spring/src/main/java/sklep/controller/RootController.java
+6
-0
SecurityConfig.java
...epSpring/src/main/java/sklep/security/SecurityConfig.java
+2
-2
wykonaj_skrypt.jsp
...ring/src/main/webapp/WEB-INF/templates/wykonaj_skrypt.jsp
+18
-0
jquery-3.7.1.min.js
PC33-SklepSpring/src/main/webapp/jquery-3.7.1.min.js
+0
-0
No files found.
PC33-SklepSpring/src/main/java/sklep/alternatywne_dostepy_do_bazy/ProductController_v0.java
View file @
0125c32c
...
...
@@ -16,7 +16,7 @@ public class ProductController_v0 {
@ResponseBody
public
String
readAll
()
{
StringBuilder
sb
=
new
StringBuilder
(
"Lista produktów:\n"
);
try
(
Connection
c
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/sklep"
,
"
kurs
"
,
"abc123"
);
try
(
Connection
c
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/sklep"
,
"
alx
"
,
"abc123"
);
Statement
stmt
=
c
.
createStatement
();
ResultSet
rs
=
stmt
.
executeQuery
(
"SELECT * FROM products ORDER BY product_id"
))
{
...
...
PC33-SklepSpring/src/main/java/sklep/controller/RootController.java
View file @
0125c32c
...
...
@@ -35,4 +35,10 @@ public class RootController {
}
return
"whoami"
;
}
@GetMapping
(
"/skrypt"
)
public
String
wykonajSkrypt
()
{
return
"wykonaj_skrypt"
;
}
}
PC33-SklepSpring/src/main/java/sklep/security/SecurityConfig.java
View file @
0125c32c
...
...
@@ -36,9 +36,9 @@ public class SecurityConfig {
.
authorizeHttpRequests
(
authz
->
authz
// zezwalamy na działanie przekierowań wewnętrznych (szablony) i błędów
.
dispatcherTypeMatchers
(
DispatcherType
.
FORWARD
,
DispatcherType
.
ERROR
).
permitAll
()
.
requestMatchers
(
"/"
,
"/hello"
,
"/czas"
).
permitAll
()
.
requestMatchers
(
"/"
,
"/hello"
,
"/czas"
,
"/skrypt"
).
permitAll
()
.
requestMatchers
(
mvc
.
pattern
(
"/whoami"
)).
permitAll
()
.
requestMatchers
(
mvc
.
pattern
(
"/*.css"
)
).
permitAll
()
.
requestMatchers
(
"/*.css"
,
"/*.js"
).
permitAll
()
.
requestMatchers
(
mvc
.
pattern
(
"/alt?/**"
)).
authenticated
()
// zalogowany jako ktokolwiek
// kolejność reguł ma znaczenie - pierwsza reguła, do której pasuje zapytanie, jest decydująca
// np. /products/new wymaga uprawnień managera, chociaż to zapytanie pasowałoby te z do /products/**
...
...
PC33-SklepSpring/src/main/webapp/WEB-INF/templates/wykonaj_skrypt.jsp
0 → 100644
View file @
0125c32c
<
%@
page
contentType=
"text/html;charset=UTF-8"
language=
"java"
%
>
<html>
<head>
<title>
Title
</title>
<script
src=
"jquery-3.7.1.min.js"
></script>
<script>
$
(
document
).
ready
(
function
(
event
)
{
alert
(
"Start"
)
})
</script>
</head>
<body>
<h1>
Stronka ze skryptem
</h1>
</body>
</html>
PC33-SklepSpring/src/main/webapp/jquery-3.7.1.min.js
0 → 100644
View file @
0125c32c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment