custom-error-pages

Configure error page for @PathVariable type mismatch

自作多情 提交于 2019-12-08 05:06:25
问题 Suppose I have a controller: @Controller public class SomeController { @RequestMapping(value = "{id}/object.do") public String showObject(@PathVariable("id") Integer id, HttpServletRequest request) { //do smth return "somePage"; } } When "id" is not a Number, but string like "aaa/object.do" Tomcat show me an error - "The request sent by the client was syntactically incorrect." Is there a way to configure an error page that will be shown only when "id" path variable has incorrect type? 回答1:

IIS 7.5 Custom 404 Error Page Not Working for Web Root Index/Default

我怕爱的太早我们不能终老 提交于 2019-12-08 03:00:06
问题 Using IIS 7.5 I have created a custom 404 (and 403.14) error page that displays content from a database if a static file is not found. In other words, if I browse to http://mysite.com/test/ and a physical index or default file is not found at that location then IIS executes my 404 custom error page which parses the url and either displays a page stored in a database, or a notice saying the page cannot be found. Everything is working perfectly except that IIS will not display the 404 page for

@ExceptionHandler for all controllers in spring-mvc

六眼飞鱼酱① 提交于 2019-12-07 16:29:28
问题 I have wrote following controller to handle all exception in my code: @Controller public class ErrorHandlerController { @ExceptionHandler(value = Exception.class) public String redirectToErrorPage(Model model){ model.addAttribute("message", "error on server"); return "errorPage"; } } But looks like following exception handler will work only if exception throws inside ErrorHandlerController I have a huge count of controllers. Please advice me how to write one ExceptionHandler for all

Custom error pages with templates in CodeIgniter

天涯浪子 提交于 2019-12-07 05:04:06
问题 I'm using the template library for CodeIgniter, http://williamsconcepts.com/ci/codeigniter/libraries/template/reference.html, and now I want to implement custom error pages too. I found one method involving a MY_Router extending the default router: http://maestric.com/doc/php/codeigniter_404 but that only treats 404 errors. I want all errors to show a simple user-friendly page, including database errors etc, and I want it to go through a controller, partly so I can use the template library,

How to configure a page to display while server is in planned maintenance in Jboss?

亡梦爱人 提交于 2019-12-06 20:35:29
How to configure in Jboss, when server is in planned maintenance(not completely down), to display an error page? thanks. Two possibilities: Inside JBoss: during the time your application, say myapp.war, is down, you can deploy another myapp.war with just a single HTML/JSP file, displaying that the server is under maintenance. See Hello, World! Web App as an example for a simple web app. If your JBoss runs behind another webserver, such as Apache, you can enable a rewrite during maintenance: RewriteEngine on RewriteRule ^.*$ http://yourdoman.com/maintenance-info.html [L,R] We use the second

404 custom error page redirect doesn't show missing file URL

蹲街弑〆低调 提交于 2019-12-06 15:39:43
I have a custom 404 error page on my site, but while doing other things on the site, the error page makes it hard to figure out what my missing file problems are because it redirects to a given html or php file and takes the URL of the missing file out of the address bar and replaces it with the URL of the custom error page. So for example, when users log in to the site, I have it link to a php file when they hit submit, but then the browsers takes them straight to the 404 error page, so I can't see that the problem is actually a link to one directory higher than it should be. I've tried

@ExceptionHandler for all controllers in spring-mvc

大憨熊 提交于 2019-12-05 21:45:40
I have wrote following controller to handle all exception in my code: @Controller public class ErrorHandlerController { @ExceptionHandler(value = Exception.class) public String redirectToErrorPage(Model model){ model.addAttribute("message", "error on server"); return "errorPage"; } } But looks like following exception handler will work only if exception throws inside ErrorHandlerController I have a huge count of controllers. Please advice me how to write one ExceptionHandler for all controllers ? P.S. I understand that I can use inheritance but I don't sure that it is the best decision. Change

How to get Prestashop current user id?

蓝咒 提交于 2019-12-05 07:02:32
I used the below code to try to get the current user ID in prestashop.. am placing this code in another php file in my module directory and call it through by the module file. $id = $this->context->customer->id_customer; but its not working for me.. am using prestashop 1.5 .. I certainly couldn't get it to work in my test either. However, you can try $id = (int)$this->context->cookie->id_customer; which works for me. I'm not at all sure that this is the best way to do it though. First check if user is logged in than get the id by $this->context->customer->id_customer if ($this->context-

Custom error page in Apache2 for 401

六月ゝ 毕业季﹏ 提交于 2019-12-05 01:53:40
Here's the relevant part of the .htaccess file: AuthUserFile /var/www/mywebsite/.htpasswd AuthGroupFile /dev/null AuthName protected AuthType Basic Require valid-user ErrorDocument 400 /var/www/errors/index.html ErrorDocument 401 /var/www/errors/index.html ErrorDocument 403 /var/www/errors/index.html ErrorDocument 404 /var/www/errors/index.html ErrorDocument 500 /var/www/errors/index.html Docuement root is set to /var/www/mywebsite/web, it's on of many vhosts. I can navigate to the index.html page. All I'm seeing is the generic Apache 401 page, any thoughts. EDIT: This is the error message in

How to send status code “500” for generic error page in IIS?

寵の児 提交于 2019-12-05 01:40:21
I am using a generic error page using ASP.NET's <customErrors> directive. <customErrors mode="On" defaultRedirect="500.html" redirectMode="ResponseRewrite"> </customErrors> Problem - when an error occurs, this page does not return HTTP status "500". It comes as 200. So link checkers and spiders do not see that there is any problem. How can I send the 500 HTTP status along with the static 500.html page? Requirements: I must use redirectMode="ResponseRewrite" I can't use a dynamic page, only static .html. The MSDN documentation for the customErrors element states that it is implemented by System