http-status-code-404

How to detect on-page 404 errors using JavaScript?

十年热恋 提交于 2019-11-27 11:36:49
问题 I have an HTML page where several JavaScript, CSS and images files are referenced. These references are dynamically injected and user can manually copy the HTML page and the support files to another machine. If some JS or CSS are missing, the browser complains in the console. For example: Error GET file:///E:/SSC_Temp/html_005/temp/Support/jquery.js I need somehow these errors reported back to me on the inline JavaScript of the HTML page so I can ask user to first verify that support files

Custom 404 using Spring DispatcherServlet

馋奶兔 提交于 2019-11-27 11:29:38
I've set up web.xml as below. I also have an annotation-based controller, which takes in any URL pattern and then goes to the corresponding jsp (I've set that up in the -servlet.xml). However, If I go to a page that ends in .html (and whose jsp doesn't exist), I don't see the custom 404 page (and see the below error in the log). Any page that doesn't end in .html, I can see the custom 404 page. How can I configure to have a custom 404 page for any page that goes through the DispatcherServlet? Also want to add that if I set my error page to a static page (ie. error.htm) it works, but if I

Image Get Requests with AngularJS

送分小仙女□ 提交于 2019-11-27 11:24:05
I am storing the the source string of an image to be rendered in HTML in the AngularJS controller, however it yields a 404 before the Angular controller is initialized. Here is the HTML: <div ng-controller="Cont"> <img src="{{imageSource}}"> </div> Angular controller: var Cont = function($scope) { $scope.imageSource = '/tests.png'; } And the error I get ( %7D%7D corresponds to the {{ in the template). GET https://localhost:9000/%7B%7BimageSource%7D%7D 404 (Not Found) How can I prevent this from happening? That is, only load the image when the Angular controller has been initialized? Try

Google App Engine and 404 error

家住魔仙堡 提交于 2019-11-27 10:29:59
I've setup a static website on GAE using hints found elsewhere, but can't figure out how to return a 404 error. My app.yaml file looks like - url: (.*)/ static_files: static\1/index.html upload: static/index.html - url: / static_dir: static with all the static html/jpg files stored under the static directory. The above works for files that exist, but returns a null length file if they don't. The answer is probably to write a python script to return a 404 error, but how do you set things up to serve the static files that exist but run the script for files that don't? Here is the log from

What is the proper way to send an HTTP 404 response from an ASP.NET MVC action?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 10:26:52
If given the route: {FeedName}/{ItemPermalink} ex: /Blog/Hello-World If the item doesn't exist, I want to return a 404. What is the right way to do this in ASP.NET MVC? Shooting from the hip (cowboy coding ;-)), I'd suggest something like this: Controller: public class HomeController : Controller { public ActionResult Index() { return new HttpNotFoundResult("This doesn't exist"); } } HttpNotFoundResult: using System; using System.Net; using System.Web; using System.Web.Mvc; namespace YourNamespaceHere { /// <summary>An implementation of <see cref="ActionResult" /> that throws an <see cref=

Nginx Error Pages - One Location Rule to Fit Them All?

耗尽温柔 提交于 2019-11-27 09:37:07
问题 Having the following nginx vhost config: server { listen 80; listen 443 ssl; server_name default; root /var/www/default/html; error_log /var/www/default/log/error.log; access_log /var/www/default/log/access.log; ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; autoindex on; index index.html index.php; location / { try_files $uri $uri/ @php; } location @php { rewrite ^/(.*)/?$ /index.php/$1 last; } location ~* /(?:[.]|.*[.](?:bak

Deploy Angular 2 App with Webpack to Tomcat - 404 Errors

可紊 提交于 2019-11-27 08:43:00
I want to build and deploy my Angular 2 front end to a Tomcat application server. For getting started I've followed exactly the steps of the following introduction: https://angular.io/docs/ts/latest/guide/webpack.html . So I have the following project structure (all files are exactly as in the introduction mentionend above): angular2-webpack ---config -------helpers.js -------karma.conf.js -------karma-test-shim.js -------webpack.common.js -------webpack.dev.js -------webpack.prod.js -------webpack.test.js ---dist ---node_modules ---public -------css --------------styles.css -------images ----

How can I solve HTTP “404” and “405” error msgs?

北城以北 提交于 2019-11-27 08:05:34
问题 Are HHTP "404" and "405" errors a step in the right direction following "400" Errors? After changing my applicationhost.config file, based on step 3 in this article, from this: <site name="HHS.Web" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\project\git\CStore\HHS.Web" /> </application> <bindings> <binding protocol="http" bindingInformation="*:21608:localhost" /> <binding protocol="http" bindingInformation="*:21608

CodeIgniter 404 Page Not Found, but why?

怎甘沉沦 提交于 2019-11-27 07:34:51
问题 I am using CodeIgniter for two applications (a public and an admin app). The important elements of the document structure are: /admin /admin/.htaccess /admin/index.html /application /application/admin /application/public /system .htaccess index.php The /admin/.htaccess file looks like this: DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] The /admin/index.php has the following changes:

How to call servlet from jQuery $.ajax without getting HTTP 404 error

心不动则不痛 提交于 2019-11-27 07:20:37
问题 I am trying to call a servlet using ajax call as below: $.ajax({ url: 'CheckingAjax', type: 'GET', data: { field1: "hello", field2 : "hello2"} , contentType: 'application/json; charset=utf-8', success: function (response) { //your success code alert("success"); }, error: function (errorThrown) { //your error code alert("not success :"+errorThrown); } }); However, it goes to error function and shows alert: not success :Not Found How is this caused and how can I solve it? 回答1: When you specify