Hi all,

I have a StatelessAppleController which does some simple checking on the data 
it receives. In most cases, it should sendPage, but there are a few rare 
situations where it should redirect or return a 502 HTTP code. 

This part of the code looks like this:

      if ("explain".equalsIgnoreCase(operation) || 
req.getCocoonRequest().getParameters().size() == 0) {
          // We only need to retrieve the explain record, which is best done 
by a redirect to the server
          res.redirectTo(query);
      }

      DOMParser parser = new DOMParser();

      try {
          parser.parse(query);
      } catch (Exception e) {
  //        logger.fatal("SRUClient received an invalid response from the 
server.");
          res.sendStatus(502);
          e.printStackTrace();
      }

but I get
java.lang.IllegalStateException: It's not possible to call redirectTo() and 
sendStatus() at the same response object.

Surely, this must be possible to achieve, I guess I just did it the wrong way. 
How can I do this?


Kind regards 

Kjetil Kjernsmo
-- 
Senior Knowledge Engineer
Mobile: +47 986 48 234
Email: [EMAIL PROTECTED]   
Web: http://www.computas.com/

|  SHARE YOUR KNOWLEDGE  |

Computas AS  PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 | Fax:+47 6783 
1001


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to