Thanks for you reply, Tyler! But I'm still having trouble.

I must be doing something wrong, I'll attach some more details. My screen class extends a "WeakScreen" object which does include a method to add some common elements, but does not touch data.setStatusCode. I do see a spurious hit to the web server root that I cannot explain just now, maybe it is relevant?

The URL is http://contact.bitblaster.com an old information page from before I let my app control subdomain access.

Thanks for any help or clues!


My code:


public void doBuildTemplate( RunData data, Context context )
{
   [snip - misc and sundry app logic I could share but seems irrelevant]
   [construct a "PageViewer" object which handles subdomains]

   // Check for 404 error, adjust response code as required...
   if ( pv.getCurrentPage().equals("404") ) {
      Log.debug("SET STATUS 404: NOT FOUND!");
      data.setStatusCode(404);
   }
   try {
      super.doBuildTemplate(data, context);
      [snip... etc, just stock screen class final stuff]
}



apache access.log:
"GET /p/s/p/template/X1.vm/s/contact HTTP/1.1" 200 864 "-"
"GET / HTTP/1.1" 200 864 "-"
"GET /p/includes/kustomLayoutBlankfile.css HTTP/1.1" 304 0

turbine.log debugger log:
-- ERROR -- (PageViewer) no subdomain contact
-- DEBUG -- Activity: X1 displayed screen|A|Error
-- DEBUG -- SET STATUS 404: NOT FOUND!
-- DEBUG -- (MyCommon) could not get cookie list



At 11:55 PM -0700 2/18/03, Tyler Burd wrote:
Hi Johnny,

In your screen class, you should have the method:
public final void doBuildTemplate(RunData data, Context context) throws
Exception

This is where you perform any particular business logic and add
information to the context.  You can use the RunData parameter to set
the HTTP response code, like this:
data.setStatusCode(404);

-Tyler

-----Original Message-----
From: Johnny Quazar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 18, 2003 10:17 PM
To: Turbine Users List
Subject: returning 404 not 200


Hi All,


Is there a way to affect the HTTP response code? I'm trapping certain
conditions and sending back a custom error message "no such content"
and I'd like to tell the browser (and the webcrawlers) 404 Page Does
Not Exist and not 200 Success.

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



Reply via email to