Skip to content

Commit

Permalink
Optimize GrailsWebRequest instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed May 14, 2013
1 parent 83197dd commit 2f7c38d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -292,7 +292,11 @@ public Locale getLocale() {
}
// Expose current RequestAttributes to current thread.
previousRequestAttributes = RequestContextHolder.currentRequestAttributes();
requestAttributes = new GrailsWebRequest(processedRequest, response, getServletContext());
if(previousRequestAttributes instanceof GrailsWebRequest) {
requestAttributes = new GrailsWebRequest(processedRequest, response, ((GrailsWebRequest)previousRequestAttributes).getAttributes());
} else {
requestAttributes = new GrailsWebRequest(processedRequest, response, getServletContext());
}
if( previousRequestAttributes != null) {
copyParamsFromPreviousRequest(previousRequestAttributes, requestAttributes);
}
Expand Down
Expand Up @@ -75,6 +75,11 @@ public class GrailsWebRequest extends DispatcherServletWebRequest implements Par
private String baseUrl;

private EncodingStateRegistry encodingStateRegistry;

public GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, GrailsApplicationAttributes attributes) {
super(request, response);
this.attributes = attributes;
}

public GrailsWebRequest(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) {
super(request, response);
Expand Down

0 comments on commit 2f7c38d

Please sign in to comment.