Re: Seeing sporadic ClassNotFoundExceptions after upgrading from 1.4.9 or 1.4.11

2011-10-26 Thread Nitnatsnok
That's odd and I occasionally get this error, too.

It seems that some browser lowercases
org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js URL before
requesting it.

Did anyone else find a way to fix this on server side?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Seeing-sporadic-ClassNotFoundExceptions-after-upgrading-from-1-4-9-or-1-4-11-tp3018268p3943061.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: Run a standalone wicket app

2011-03-08 Thread Nitnatsnok
To create a runnable .war file with just a maven plugin I used this tool:

http://simplericity.com/2009/11.html

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Run-a-standalone-wicket-app-tp3339521p3342507.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: upload in IE

2010-11-16 Thread Nitnatsnok

// To strip full path for stupid MSIE browsers
String fileName =
org.apache.commons.io.FilenameUtils.getName(upload.getClientFileName());

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/upload-in-IE-tp3045562p3045860.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: EXception handling in Wicket

2010-08-29 Thread Nitnatsnok


Antoine van Wel wrote:
> 
> I think you should prevent that SQLException from happening in the first
> place by validating the form input.
> Then use a FeedbackPanel to display suitable error messages. Just google
> for
> example code with forms, it's basic stuff.
> 
> Otherwise, create a FeedbackPanel on your page, put a try .. catch block
> around your sql methods and in case of an exception, write to the
> FeedbackPanel using error("your message")
> 
> 

I agree with you, catching Runtime exceptions in WebRequestCycle should not
be a part of normal workflow.
I use this thing only to display critical failures information.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/EXception-handling-in-Wicket-tp2340439p2399427.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



Re: EXception handling in Wicket

2010-08-29 Thread Nitnatsnok


arunarapole wrote:
> 
> Thank you for replay i am very glad you have sent me the sample code thank
> you so much
> 
> My problem is i have to handle SQLException and only message  to be
> display
> in hidden field  same webpage
> 
> do u have any idea regarding this
> 
> Aruna
> 
> 

It depends.
Is your exception thrown in an ajax call or a form submit?

In your WebRequestCycle.onRuntimeException you have two parameters: page on
which exception was thrown and which exception was thrown.

If your runtime exception was SQLException then you can access any element
on your page and set any value to it.

Next you can update an element on page if it's AJAX or show this page again
by returning updated page.

You can get your ajax target this way:
(AjaxRequestTarget)RequestCycle.get().getRequestTarget().

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/EXception-handling-in-Wicket-tp2340439p2399426.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



Re: EXception handling in Wicket

2010-08-26 Thread Nitnatsnok

Oh, also I set not to show Error Page on exception in WebApplication:

getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_NO_EXCEPTION_PAGE);
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/EXception-handling-in-Wicket-tp2340439p2340562.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



Re: EXception handling in Wicket

2010-08-26 Thread Nitnatsnok

Hi, I don't know if it is a proper way but this is how I did it.

1. Extended WebRequestCycle

@Override
public Page onRuntimeException(Page page, RuntimeException e) {
// if error was during application running e.g. when Home page was
loaded and if it was an ajax request that caused problem
if (page instanceof Home && RequestCycle.get().getRequestTarget()
instanceof AjaxRequestTarget) {
// On my Home page there is a js ModalWindow into which I place
the error text
ModalWindow errorPage = (ModalWindow)page.get("modalErrorPage");
final ResourceModel message = new
ResourceModel("gorillaUrlError");
errorPage.setContent( "... ");
   
errorPage.show((AjaxRequestTarget)RequestCycle.get().getRequestTarget());
}
return null;

2. Extended WebRequestCycleProcessor to comment out placing 500 error code
into Ajax response.

@Override
public void respond(RuntimeException e, RequestCycle requestCycle)
{
// If application doesn't want debug info showing up for users
final Application application = Application.get();
final IExceptionSettings settings =
application.getExceptionSettings();
final Page responsePage = requestCycle.getResponsePage();

Page override = onRuntimeException(responsePage, e);
if (override != null)
{
throw new RestartResponseException(override);
}
else if (e instanceof AuthorizationException)
{
// are authorization exceptions always thrown before the real
// render?
// else we need to make a page (see below) or set it hard to a
// redirect.
Class accessDeniedPageClass =
application.getApplicationSettings()
.getAccessDeniedPage();

throw new
RestartResponseAtInterceptPageException(accessDeniedPageClass);
}
else if (e instanceof PageExpiredException)
{
Class pageExpiredErrorPageClass =
application.getApplicationSettings()
.getPageExpiredErrorPage();
boolean mounted = isPageMounted(pageExpiredErrorPageClass);
RequestCycle.get().setRedirect(mounted);
throw new RestartResponseException(pageExpiredErrorPageClass);
}
else if (settings.getUnexpectedExceptionDisplay() !=
IExceptionSettings.SHOW_NO_EXCEPTION_PAGE)
{
// we do not want to redirect - we want to inline the error
output
// and preserve the url so when the refresh button is pressed we
// rerun the code that caused the error
// However we don't what to do this in a situation where we are
in portlet mode
if (!RequestContext.get().isPortletRequest())
{
requestCycle.setRedirect(false);
}

// figure out which error page to show
Class internalErrorPageClass =
application.getApplicationSettings()
.getInternalErrorPage();
Class responseClass = responsePage != null ?
responsePage.getClass()
: null;

if (responseClass != internalErrorPageClass &&
settings.getUnexpectedExceptionDisplay() ==
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
{
throw new RestartResponseException(internalErrorPageClass);
}
else if (responseClass != ExceptionErrorPage.class)
{
// Show full details
throw new RestartResponseException(new ExceptionErrorPage(e,
responsePage));
}
else
{
// give up while we're ahead!
throw new WicketRuntimeException("Internal Error: Could not
render error page " +
internalErrorPageClass, e);
}
}
else if (requestCycle.getResponse() instanceof WebResponse)
{
// commented out so that error code is not set to header
// it was set in case of runtime Java exception and
SHOW_NO_EXCEPTION_PAGE option of application
//   
((WebResponse)requestCycle.getResponse()).getHttpServletResponse().setStatus(
//HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}

3. Overridden 2 methods in WebApplication
public RequestCycle newRequestCycle(Request request, Response response) {
protected IRequestCycleProcessor newRequestCycleProcessor() {


That's it.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/EXception-handling-in-Wicket-tp2340439p2340560.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