Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
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
XWiki
xwiki-platform
Commits
7d2af12b
Commit
7d2af12b
authored
3 years ago
by
Thomas Mortagne
Browse files
Options
Downloads
Patches
Plain Diff
[misc] Spare one return
parent
8e7893a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiFilter.java
+15
-17
15 additions, 17 deletions
...er/src/main/java/org/xwiki/rest/internal/XWikiFilter.java
with
15 additions
and
17 deletions
xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiFilter.java
+
15
−
17
View file @
7d2af12b
...
...
@@ -59,28 +59,26 @@ protected int beforeHandle(Request request, Response response)
(
ComponentManager
)
getContext
().
getAttributes
().
get
(
Constants
.
XWIKI_COMPONENT_MANAGER
);
XWikiContext
xwikiContext
=
Utils
.
getXWikiContext
(
componentManager
);
EntityReferenceSerializer
<
String
>
serializer
;
try
{
serializer
=
componentManager
.
getInstance
(
EntityReferenceSerializer
.
TYPE_STRING
);
EntityReferenceSerializer
<
String
>
serializer
=
componentManager
.
getInstance
(
EntityReferenceSerializer
.
TYPE_STRING
);
/*
* We add headers to the response to allow applications to verify if the authentication is still valid. We
* are also adding the XWiki version at the same moment.
*/
Series
<
Header
>
responseHeaders
=
(
Series
<
Header
>)
response
.
getAttributes
().
get
(
HeaderConstants
.
ATTRIBUTE_HEADERS
);
if
(
responseHeaders
==
null
)
{
responseHeaders
=
new
Series
<>(
Header
.
class
);
response
.
getAttributes
().
put
(
HeaderConstants
.
ATTRIBUTE_HEADERS
,
responseHeaders
);
}
responseHeaders
.
add
(
"XWiki-User"
,
serializer
.
serialize
(
xwikiContext
.
getUserReference
()));
responseHeaders
.
add
(
"XWiki-Version"
,
xwikiContext
.
getWiki
().
getVersion
());
}
catch
(
ComponentLookupException
e
)
{
getLogger
()
.
warning
(
"Failed to lookup the entity reference serializer: "
+
ExceptionUtils
.
getRootCauseMessage
(
e
));
return
CONTINUE
;
}
/*
* We add headers to the response to allow applications to verify if the authentication is still valid. We are
* also adding the XWiki version at the same moment.
*/
Series
<
Header
>
responseHeaders
=
(
Series
<
Header
>)
response
.
getAttributes
().
get
(
HeaderConstants
.
ATTRIBUTE_HEADERS
);
if
(
responseHeaders
==
null
)
{
responseHeaders
=
new
Series
<>(
Header
.
class
);
response
.
getAttributes
().
put
(
HeaderConstants
.
ATTRIBUTE_HEADERS
,
responseHeaders
);
}
responseHeaders
.
add
(
"XWiki-User"
,
serializer
.
serialize
(
xwikiContext
.
getUserReference
()));
responseHeaders
.
add
(
"XWiki-Version"
,
xwikiContext
.
getWiki
().
getVersion
());
return
CONTINUE
;
}
...
...
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