On Feb 8, 2011, at 1:49 AM, ute Hoffmann wrote:

> Hallo,
> I get sometimes Error Messages containing DirectActions which do not exist.
> 
> Some of them happen when a page is not yet fully loaded and a javascript is 
> executed
> containing a image, then the image appears in a DirectAction call like this:
> 
> FusszeielundImpressumaendern_b-poster.jpgAction()
> 
> The image is in the page, but the Action not.
> 
> Has someone an explanation for this and perhaps a solution to avoid this?
> 
> Can one catch a java.lang.reflect.InvocationTargetException and if yes, where 
> should I do this?
> In DirectAction.java? In Application?
> I would like to catch all Exceptions originating from non-existing 
> DirectAction Calls if possible.
> 

Does this help (in the application class)? From some ancient code I wrote:

    public WOResponse dispatchRequest(WORequest aRequest) {

        try {
                String uri = aRequest.uri();
                String appURLPrefix = aRequest.applicationURLPrefix();
                String reqHandlerKey = aRequest.requestHandlerKey();

                if ( uri.startsWith(appURLPrefix+"/"+reqHandlerKey+"/") &&
                                (uri.endsWith(".gif") || uri.endsWith(".jpg") 
|| uri.endsWith(".png")) ) {
                        WOResponse imageReplacement = new WOResponse();
                        
imageReplacement.setStatus(WOResponse.HTTP_STATUS_NOT_FOUND);
                        imageReplacement.disableClientCaching();
                        return imageReplacement;
                }
        } catch (Exception e) {
                NSLog.err.appendln("Error while checking request for images we 
don't handle. User likely lost the session.");
        }
                return super.dispatchRequest(aRequest);
    }



kib

"Live as if you were to die tomorrow. Learn as if you were to live forever."
Mahatma Gandhi

Klaus Berkling
Web Application Dev. & Systems Administrator
DynEd International, Inc.
www.dyned.com | blog



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to