Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@
import javax.servlet.http.HttpServletRequestWrapper;

class PathMatchingHttpServletRequestWrapper extends HttpServletRequestWrapper {
private final Map<String, Object> localAttributes = new HashMap<>();
private Map<String, Object> localAttributes;

public PathMatchingHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
}

@Override
public Object getAttribute(String name) {
final Object ret = localAttributes.get(name);
if (ret == null) {
return super.getAttribute(name);
if (localAttributes != null) {
final Object ret = localAttributes.get(name);
if (ret != null) {
return ret;
}
}
return ret;
return super.getAttribute(name);
}

@Override
public void setAttribute(String name, Object o) {
if (localAttributes == null) {
localAttributes = new HashMap<>();
}
localAttributes.put(name, o);
}

@Override
public void removeAttribute(String name) {
localAttributes.remove(name);
if (localAttributes != null) {
localAttributes.remove(name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@
import java.util.Map;

class PathMatchingHttpServletRequestWrapper extends HttpServletRequestWrapper {
private final Map<String, Object> localAttributes = new HashMap<>();
private Map<String, Object> localAttributes;

public PathMatchingHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
}

@Override
public Object getAttribute(String name) {
final Object ret = localAttributes.get(name);
if (ret == null) {
return super.getAttribute(name);
if (localAttributes != null) {
final Object ret = localAttributes.get(name);
if (ret != null) {
return ret;
}
}
return ret;
return super.getAttribute(name);
}

@Override
public void setAttribute(String name, Object o) {
if (localAttributes == null) {
localAttributes = new HashMap<>();
}
localAttributes.put(name, o);
}

@Override
public void removeAttribute(String name) {
localAttributes.remove(name);
if (localAttributes != null) {
localAttributes.remove(name);
}
}
}
Loading