Re: Error page for AJAX requests

2014-09-26 Thread Martin Grigorov
Hi,

Check org.apache.wicket.settings.ExceptionSettings#setAjaxErrorHandlingStrategy

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Sep 26, 2014 at 1:25 PM, Wayne W waynemailingli...@gmail.com
wrote:

 Hi all,

 we've recently moved to Wicket 6.17 from 1.4 and I'm having trouble with
 NOT showing the default wicket error page when a runtime exception is
 thrown from an AjaxLink.

 I've set the following in the application:

 getApplicationSettings().setInternalErrorPage(ErrorPage.class);

 getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.
 SHOW_INTERNAL_ERROR_PAGE);


 but it does't seem to have any effect. We override
 AbstractRequestCycleListener and specifically IRequestHandler
 onException(RequestCycle cycle, Exception e) to perform different error
 pages depending on the nature of the exception (for example entitynotfound
 exception). We check here to see if its an ajax request like this:


 if(cycle.getRequest() instanceof WebRequest  ((WebRequest)
 cycle.getRequest()).isAjax()) {

 return null; // let wicket take care of it.

 }


 Is there anyway for ajax requests I can do something like this (which is
 what we return for non-ajax requests):


 return new RenderPageRequestHandler(new PageProvider(new ErrorPage(page,
 e)));


 many thanks



Re: Error page stack trace

2014-06-04 Thread Paul Bors
Why? You don't have access to your own log file?


On Wed, Jun 4, 2014 at 10:43 AM, Entropy blmulholl...@gmail.com wrote:

 We set our error page via setInternalErrorPage on IApplicationSettings in
 1.6.  I'd like to bury the stack trace in a comment in the rendered page in
 our staging and dev environments to save time.  But I have no idea how to
 get the originating trace in the error page.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Error page stack trace

2014-06-04 Thread Sven Meier

Hi,

easiest solution is to use a custom requestCycleListener to store the 
exception in a thread-local.

You can access this variable from your custom internalErrorPage.

Hope this helps
Sven


On 06/04/2014 04:43 PM, Entropy wrote:

We set our error page via setInternalErrorPage on IApplicationSettings in
1.6.  I'd like to bury the stack trace in a comment in the rendered page in
our staging and dev environments to save time.  But I have no idea how to
get the originating trace in the error page.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Error page stack trace

2014-06-04 Thread Paul Bors
Btw, this is what you want:

http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/request/cycle/AbstractRequestCycleListener.html#onException%28org.apache.wicket.request.cycle.RequestCycle,%20java.lang.Exception%29

Add your own IRequestCycleListener (AbstractRequestCycleListener) with
org.apache.wicket.Application.getRequestCycleListeners().add() and
implement its #onException(RequestCycle, Exception) then drop that in your
HTML comment.


On Wed, Jun 4, 2014 at 11:31 AM, Paul Bors p...@bors.ws wrote:

 Why? You don't have access to your own log file?


 On Wed, Jun 4, 2014 at 10:43 AM, Entropy blmulholl...@gmail.com wrote:

 We set our error page via setInternalErrorPage on IApplicationSettings in
 1.6.  I'd like to bury the stack trace in a comment in the rendered page
 in
 our staging and dev environments to save time.  But I have no idea how to
 get the originating trace in the error page.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





Re: Error page stack trace

2014-06-04 Thread Martin Grigorov
On Wed, Jun 4, 2014 at 5:34 PM, Sven Meier s...@meiers.net wrote:

 Hi,

 easiest solution is to use a custom requestCycleListener to store the
 exception in a thread-local.
 You can access this variable from your custom internalErrorPage.


Prefer RequestCycle's metadata instead.



 Hope this helps
 Sven



 On 06/04/2014 04:43 PM, Entropy wrote:

 We set our error page via setInternalErrorPage on IApplicationSettings in
 1.6.  I'd like to bury the stack trace in a comment in the rendered page
 in
 our staging and dev environments to save time.  But I have no idea how to
 get the originating trace in the error page.

 --
 View this message in context: http://apache-wicket.1842946.
 n4.nabble.com/Error-page-stack-trace-tp4666119.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Error page stack trace

2014-06-04 Thread Entropy
The meta data facility looks intriguing but is a bit confusing.  How is this
supposed to work?  I was expecting something like a map, but the key has to
be this abstract object that takes an arrya of entry objects?  And each
entry object demands reference back to it's key?  This is a confusing
object, and the examples I see online haven't been very illuminating.  How
would I store and retrieve the exception from this collection by a simple
string constant?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119p4666127.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Error page stack trace

2014-06-04 Thread Martin Grigorov
See
declare a key:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/request/cycle/PageRequestHandlerTracker.java#L40
set a value:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/request/cycle/PageRequestHandlerTracker.java#L97
get a value:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/request/cycle/PageRequestHandlerTracker.java#L120

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 4, 2014 at 8:47 PM, Entropy blmulholl...@gmail.com wrote:

 The meta data facility looks intriguing but is a bit confusing.  How is
 this
 supposed to work?  I was expecting something like a map, but the key has to
 be this abstract object that takes an arrya of entry objects?  And each
 entry object demands reference back to it's key?  This is a confusing
 object, and the examples I see online haven't been very illuminating.  How
 would I store and retrieve the exception from this collection by a simple
 string constant?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119p4666127.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Error page stack trace

2014-06-04 Thread Entropy
Nevermind, I figured out from other examples that they tend to share the key
in a static constant so that it becomes the object identity that allows you
to access the meta data object.  I wonder if that is really the intended
use, but intended or not, it works.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-page-stack-trace-tp4666119p4666129.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: error page

2010-01-04 Thread Ilja Pavkovic
Hi,

  what is the difference between
 
  @Override
  public IApplicationSettings getApplicationSettings() {
  IApplicationSettings settings= super.getApplicationSettings();
  settings.setInternalErrorPage(internalErrorPage)
  return settings;
  }
 
  settings.setInternalErrorPage(internalErrorPage) and
 
 You have no acces to the exception thrown.
 
 Perhaps this could be a RFE ?
 a) Something like: ErrorWebPage extends WebPage with ErrorWebPage(Exception
  e) as constructor?
I created a RFE, see https://issues.apache.org/jira/browse/WICKET-2659

Best Regards,
Ilja Pavkovic

-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: error page

2009-12-31 Thread Ilja Pavkovic
Hi,

 what is the difference between
 
   @Override
   public IApplicationSettings getApplicationSettings() {
   IApplicationSettings settings= super.getApplicationSettings();
   settings.setInternalErrorPage(internalErrorPage)
   return settings;
   }
 
 settings.setInternalErrorPage(internalErrorPage) and
You have no acces to the exception thrown.

Perhaps this could be a RFE ? 
a) Something like: ErrorWebPage extends WebPage with ErrorWebPage(Exception e) 
as constructor? 

b) if the annotated error Page has a constructor 
InternalErrorPage(Exception e) use this one to create the class?

 reqauestcycle.onruntimeexception(exception e) { return new myerrorpage(e);
  }
You acces the exception via the constructor.

Best Regards,
Ilja Pavkovic

 
 when is   InternalErrorPageused and when is   myerrorpage used ?
 and also we have   IExceptionSettings ,  when is this used ?
 
 igor.vaynberg wrote:
  reqauestcycle.onruntimeexception(exception e) { return new
  myerrorpage(e); }
 
  -igor
 
  On Wed, Dec 30, 2009 at 7:22 AM, tubin gen fachh...@gmail.com wrote:
  We created our custom error page so any time error happens wicket
  redirects
  to this error page , I want also want to display the exception stack
  trace
  in this page , please tell me how  to do this ?
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: error page

2009-12-30 Thread Igor Vaynberg
reqauestcycle.onruntimeexception(exception e) { return new myerrorpage(e); }

-igor

On Wed, Dec 30, 2009 at 7:22 AM, tubin gen fachh...@gmail.com wrote:
 We created our custom error page so any time error happens wicket redirects
 to this error page , I want also want to display the exception stack trace
 in this page , please tell me how  to do this ?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: error page

2009-12-30 Thread fachhoch

what is the difference between 

@Override
public IApplicationSettings getApplicationSettings() {
IApplicationSettings settings= super.getApplicationSettings();
settings.setInternalErrorPage(internalErrorPage)
return settings;
}

settings.setInternalErrorPage(internalErrorPage) and 
reqauestcycle.onruntimeexception(exception e) { return new myerrorpage(e); }

when is   InternalErrorPageused and when is   myerrorpage used ?
and also we have   IExceptionSettings ,  when is this used ?


igor.vaynberg wrote:
 
 reqauestcycle.onruntimeexception(exception e) { return new myerrorpage(e);
 }
 
 -igor
 
 On Wed, Dec 30, 2009 at 7:22 AM, tubin gen fachh...@gmail.com wrote:
 We created our custom error page so any time error happens wicket
 redirects
 to this error page , I want also want to display the exception stack
 trace
 in this page , please tell me how  to do this ?

 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/error-page-tp26968559p26972096.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org