Skip to content

Commit

Permalink
#34 - Minor code convention tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cshawaus committed Aug 10, 2020
1 parent 8272f95 commit e35c0e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class FeedService extends SlingSafeMethodsServlet {

@Override
protected void doGet(
final SlingHttpServletRequest request,
final @Nonnull SlingHttpServletResponse response
final @Nonnull SlingHttpServletRequest slingRequest,
final @Nonnull SlingHttpServletResponse slingResponse
) throws IOException {
this.resource = request.getResource();
this.resourceResolver = request.getResourceResolver();
this.request = request;
resource = request.getResource();
resourceResolver = request.getResourceResolver();
request = slingRequest;

try {
pageManager = resourceResolver.adaptTo(PageManager.class);
Expand All @@ -47,15 +47,15 @@ protected void doGet(
boolean feedEnabled = Boolean.TRUE.equals(resourceNode.getProperty("feedEnabled").getBoolean());

if (!feedEnabled || !feedMatchesRequest()) {
response.sendError(501, "This feed doesn't appear to be enabled!");
slingResponse.sendError(501, "This feed doesn't appear to be enabled!");
} else {
handleResponse(response);
handleResponse(slingResponse);
}
} else {
response.sendError(404, "Something unknown appears to have gone wrong while initialising the feed.");
slingResponse.sendError(404, "Something unknown appears to have gone wrong while initialising the feed.");
}
} catch (Exception ex) {
response.sendError(404);
slingResponse.sendError(404);
}
}

Expand Down Expand Up @@ -91,10 +91,10 @@ protected <T> T getStyle(String property, T fallback) {
/**
* Default handler when the feed hasn't been implemented correctly.
*
* @param response {@code SlingHttpServletResponse} instance
* @param slingResponse {@code SlingHttpServletResponse} instance
* @throws IOException
*/
protected void handleResponse(final SlingHttpServletResponse response) throws IOException {
protected void handleResponse(final SlingHttpServletResponse slingResponse) throws IOException {
throw new RuntimeException("Response handler has not been implemented.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ protected boolean feedMatchesRequest() {
}

@Override
protected void handleResponse(SlingHttpServletResponse response) throws IOException {
response.setContentType("application/xml");
protected void handleResponse(SlingHttpServletResponse slingResponse) throws IOException {
slingResponse.setContentType("application/xml");

StringBuilder rss = new StringBuilder();

Expand All @@ -46,6 +46,6 @@ protected void handleResponse(SlingHttpServletResponse response) throws IOExcept
rss.append("</channel>");
rss.append("</rss>");

response.getWriter().write(rss.toString());
slingResponse.getWriter().write(rss.toString());
}
}

0 comments on commit e35c0e9

Please sign in to comment.