• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Servlet+AJAX -- I am getting request.status = 404 Error

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am making a file upload progress bar using ajax. When I run the application on my local network the file is uploaded showing the progress bar. But when I upload the same application on remote server and test it live, the application does not work. In javascript I get req.status = 404. Another thing, in browser's statusbar I see this url http://pagead2.googlesyndication.com/. I dont know why my application is being directed to this url. Please help.

Here is the full source code.



Here is the servlet:

 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using a page-relative URL. Bad idea.

Use a server-relative URL in which the URL begins with the context path.
 
Joseph Bashir
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is server-relative URL. Can you please suggest where should I make the change in the code?

Joseph
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this JSP FAQ entry. It focuses on images, but also applies to your issue.
 
Joseph Bashir
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have tried a lot but still there is no success. I am still getting req.status = 404. And though I have set response.setContentType("text/xml"); in the servlet, but in the javascript code req.getAllResponseHeaders() shows Content-Type: text/html.

In browser's statusbar I still see this url http://pagead2.googlesyndication.com/. This url is not mentioned in the code anywhere than why is my application being directed to this url. Please help, its very urgent.


Joseph

[ January 05, 2008: Message edited by: Joseph Bashir ]

[ January 05, 2008: Message edited by: Joseph Bashir ]
[ January 05, 2008: Message edited by: Joseph Bashir ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As was mentioned before, you should use an absolute URL, not a relative URL.

The response is HTML because it is an error message; 404 means that whatever you were addressing is not present on the server (which is no surprise, given the relative URL you're using).
 
I brought this back from the farm where they grow the tiny ads:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic