Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
f87590c8
Commit
f87590c8
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
#4
First version for http filter
parent
7bc89f74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierfrontend/src/main/java/de/unikoblenz/fgbks/dmn/frontend/HttpFilter.java
+40
-0
40 additions, 0 deletions
...ain/java/de/unikoblenz/fgbks/dmn/frontend/HttpFilter.java
with
40 additions
and
0 deletions
dmnverifierfrontend/src/main/java/de/unikoblenz/fgbks/dmn/frontend/HttpFilter.java
0 → 100644
+
40
−
0
View file @
f87590c8
package
de.unikoblenz.fgbks.dmn.frontend
;
import
java.io.IOException
;
import
java.net.URI
;
import
javax.ws.rs.container.ContainerRequestContext
;
import
javax.ws.rs.container.ContainerRequestFilter
;
import
javax.ws.rs.container.PreMatching
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.UriInfo
;
import
javax.ws.rs.ext.Provider
;
@Provider
@PreMatching
public
class
HttpFilter
implements
ContainerRequestFilter
{
@Override
public
void
filter
(
ContainerRequestContext
reqContext
)
throws
IOException
{
System
.
out
.
println
(
"-- request info --"
);
UriInfo
uriInfo
=
reqContext
.
getUriInfo
();
System
.
out
.
println
(
uriInfo
.
getRequestUri
().
toString
());
System
.
out
.
println
(
reqContext
.
getMethod
());
log
(
uriInfo
,
reqContext
.
getHeaders
());
reqContext
.
abortWith
(
Response
.
noContent
().
build
());
reqContext
.
setRequestUri
(
URI
.
create
(
"/index.html"
));
System
.
out
.
println
(
"-- request info --"
);
uriInfo
=
reqContext
.
getUriInfo
();
System
.
out
.
println
(
uriInfo
.
getRequestUri
().
toString
());
System
.
out
.
println
(
reqContext
.
getMethod
());
log
(
uriInfo
,
reqContext
.
getHeaders
());
}
private
void
log
(
UriInfo
uriInfo
,
MultivaluedMap
<
String
,
?>
headers
)
{
System
.
out
.
println
(
"Path: "
+
uriInfo
.
getPath
());
System
.
out
.
println
(
"HEADERS:"
);
headers
.
entrySet
().
forEach
(
h
->
System
.
out
.
println
(
h
.
getKey
()
+
": "
+
h
.
getValue
()));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment