SivaKumarl wrote:
>
> I m getting action name from where exception is raised ,but the method
> name from where the exception is raised is not coming.Can you please tell
> me how to find the method name.
>
Try the following:
public class StripesExceptionHandler1 implements ExceptionHandler {
private static net.sourceforge.stripes.util.Log LOG =
Log.getInstance(StripesExceptionHandler1.class);
public void init(Configuration configuration) throws Exception {
;
}
public void handle(Throwable throwable, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
final Configuration config = StripesSecurityFilter.getConfiguration();
final ActionBeanContext context = ctx.getActionBeanContext();
final ActionResolver resolver = config.getActionResolver();
final Class<? extends ActionBean> beanClass =
resolver.getActionBeanType(getRequestedPath(context.getRequest()));
if (beanClass != null) {
String eventName = resolver.getEventName(beanClass, context);
context.setEventName(eventName);
final Method handler;
if (eventName != null) {
handler = resolver.getHandler(beanClass, eventName);
} else {
handler = resolver.getDefaultHandler(beanClass);
if (handler != null) {
context.setEventName(resolver.getHandledEvent(handler));
}
}
}
ForwardResolution next = new
ForwardResolution("/examples/quickstart/Error.action");
StripesRequestWrapper wrapper=new StripesRequestWrapper(request) {
@Override
protected void constructMultipartWrapper(HttpServletRequest request)
throws StripesServletException {
Locale locale =
StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
setLocale(locale);
}
};
next.addParameter("realSource", makeSourceParameter(wrapper));
if (handler != null) {
next.addParameter("event", handler.getName());
next.execute(wrapper,response);
}
private String makeSourceParameter(HttpServletRequest request) {
UrlBuilder ub = new UrlBuilder(request.getRequestURI(), false);
ub.addParameters(request.getParameterMap());
try {
return URLEncoder.encode(ub.toString(), "utf-8");
} catch (UnsupportedEncodingException e) {
LOG.error("Failed to encode url [" + ub.toString() + "]", e);
}
return null;
}
}
--
View this message in context:
http://www.nabble.com/How-to-go-back-to-action-from-ExceptionHandling-page-tp16269575p16325942.html
Sent from the stripes-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users