Advertisement

05.15.2008 at 08:51AM PDT, ID: 23405645
[x]
Attachment Details

Passing HttpServletRequest to a thread

Asked by tbboyett in Java Programming Language, Java Server Pages (JSP), Java Servlets

I have a servlet that contains a thread, but I'm having issues passing the HttpServletRequest to the thread.
It says that i can not reference a non-final variable inside an inner class defined in a different method.

Any help is greatly appreciatedStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
   Thread t = new Thread(new Runnable()
   {
      public void run()
      { 
         processRequest(request);
      }
   });
   t.start();
}
[+][-]05.15.2008 at 08:58AM PDT, ID: 21575055

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Programming Language, Java Server Pages (JSP), Java Servlets
Sign Up Now!
Solution Provided By: CEHJ
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.15.2008 at 09:00AM PDT, ID: 21575064

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 09:25AM PDT, ID: 21575401

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 09:36AM PDT, ID: 21575546

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628