たとえば、属性をHttpServletRequestに設定するサーブレットコードがあります。
request.setAttribute("someValue", someValue());
RequestDispatcher rd = getServletContext().getRequestDispatcher("/SomeJsp.jsp");
rd.forward(this.request, this.response);
return;
上記のコードがスレッドセーフであることを確認するにはどうすればよいですか?
これは私が取得しているスタックトレースです:
java.lang.NullPointerException
at org.apache.catalina.connector.Request.notifyAttributeAssigned(Request.java:1552)
at org.apache.catalina.connector.Request.access$000(Request.java:105)
at org.apache.catalina.connector.Request$3.set(Request.java:3342)
at org.apache.catalina.connector.Request.setAttribute(Request.java:1504)
at org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:541)
at org.apache.catalina.core.ApplicationHttpRequest.setAttribute(ApplicationHttpRequest.java:281)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:286)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at com.mycompany.myapp.servlet.SomeServlet.doRequest(SomeServlet.java:103)
at com.mycompany.myapp.servlet.SomeServlet.doGet(SomeServlet.java:159)