Skip to content
Snippets Groups Projects
Commit 7d2af12b authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

[misc] Spare one return

parent 8e7893a8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment