File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
servlet/src/main/java/io/undertow/servlet/attribute Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public class ServletNameAttribute implements ExchangeAttribute {
3535
3636 public static final ExchangeAttribute INSTANCE = new ServletNameAttribute ();
3737 public static final String NAME = "Servlet Name" ;
38+ public static final String UNDEFINED = "No-Servlet" ;
3839
3940 private ServletNameAttribute () {
4041
@@ -43,7 +44,11 @@ private ServletNameAttribute() {
4344 @ Override
4445 public String readAttribute (final HttpServerExchange exchange ) {
4546 ServletRequestContext src = exchange .getAttachment (ServletRequestContext .ATTACHMENT_KEY );
46- return src .getCurrentServlet ().getManagedServlet ().getServletInfo ().getName ();
47+ if (src != null ) {
48+ return src .getCurrentServlet ().getManagedServlet ().getServletInfo ().getName ();
49+ } else {
50+ return UNDEFINED ;
51+ }
4752 }
4853
4954 @ Override
You can’t perform that action at this time.
0 commit comments