Hi Christoph, Server side exceptions are caught by ULCSession. It then sends stop communication message along with the exception text to the client and stops the app on the server side. The client displays the exception and shuts down.
As a developer, you should be careful about intercepting server side exceptions it may result into inconsistency between the client and the server state. However, just intercepting the message to log it should be ok. To catch exceptions on server side you will need to extend ULCSession. Please see the snippet at the end. Please note that in ULC 2008, the SessionProvider can be specified in the ULCApplicationConfiguration file. PS: Kindly consider purchasing Premium Support (http://www.canoo.com/ulc/products/support.html) for guaranteed response time: Thanks and regards, Janak ----------------------------------------- Janak Mulani email: [EMAIL PROTECTED] url: http://www.canoo.com Beyond AJAX - Java Rich Internet Applications http://www.canoo.com/ulc ----------------------------------------- > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Christoph Brill > Sent: Monday, November 24, 2008 4:25 AM > To: [email protected] > Subject: [ULC-developer] ULC and UncaughtExceptionHandler > > Hi list, > > I'm used to have an UncaughtExceptionHandler registered in Swing > Clients. Is there a similar mechanism possible in ULC? From > what I guess > ULC registers it's own UncaughtExceptionHandler (to cleanly shut down > the client<->server connection I guess). Is there some way to append a > handler to this lister? > > My plan is to allow all kind of errors to be caugt and to > show an error > dialog instead of crashing the application. > > Regards, > Christoph > > _______________________________________________ > ULC-developer mailing list > [email protected] > http://lists.canoo.com/mailman/listinfo/ulc-developer ------------------------------ import com.ulcjava.base.application.AbstractApplication; import com.ulcjava.base.application.ULCBoxPane; import com.ulcjava.base.application.ULCButton; import com.ulcjava.base.application.ULCFrame; import com.ulcjava.base.application.event.ActionEvent; import com.ulcjava.base.application.event.IActionListener; import com.ulcjava.base.development.DevelopmentRunner; import com.ulcjava.base.development.DevelopmentRunnerContainerServices; import com.ulcjava.base.development.DevelopmentRunnerSessionProvider; import com.ulcjava.base.server.DefaultSessionProvider; import com.ulcjava.base.server.IContainerServices; import com.ulcjava.base.server.ULCSession; import com.ulcjava.base.shared.ICallable; import com.ulcjava.base.shared.internal.Request; public class ServerSideExceptionInterception extends AbstractApplication { public void start() { ULCBoxPane content = new ULCBoxPane(true); ULCButton scp = new ULCButton("Error"); scp.addActionListener(new IActionListener() { public void actionPerformed(ActionEvent event) { String s = null; s.equals(""); } }); content.add(ULCBoxPane.BOX_EXPAND_EXPAND, scp); ULCFrame frame = new ULCFrame("ExceptionSnippet"); frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE); frame.add(content); frame.setSize(300, 300); frame.setVisible(true); } public static void main(String[] args) { DevelopmentRunner.setSessionProvider(new SessionProvider()); DevelopmentRunner .setApplicationClass(ServerSideExceptionInterception.class); DevelopmentRunner.run(); } public static class SessionProvider extends DevelopmentRunnerSessionProvider { public ULCSession createSession() { return new MySession(DevelopmentRunner.getApplicationClass().getName(), new DevelopmentRunnerContainerServices()); } } public static class MySession extends ULCSession { public MySession(String applicationClassName, IContainerServices containerServices) { super(applicationClassName, containerServices); } protected void processRequest(ICallable target, Request request) { try { super.processRequest(target, request); } catch (Exception e) { System.out.println("Logginging exception:"); e.printStackTrace(); throw new RuntimeException(e); } } } } _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
