dcsimg
java.io.FileNotFoundException
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   fellow_ls
Posted On:   Friday, May 28, 2004 05:10 PM

My code is following: public void openReader(String _url){ try{ url= new URL(WebUtil.addHttp(_url)); HttpURLConnection.setFollowRedirects(true); con= (HttpURLConnection) url.openConnection(); java.io.InputStream uc= con.getInputStream(); br= new BufferedReader(new InputStreamReader(uc)); }catch (Exception ex) { ex.printStackTrace(); return; } } It works well except a strange website: http://jobs.workopolis.com/jobshome/db/work.process_job?pi_language=EN&pi_sort_col=+&pi_category=Dummy&pi_industry=Dummy&pi_employer=Dummy&pi_location=Dummy&pi_msg=&pi_location   More>>

My code is following:


public void openReader(String _url){

try{

url= new URL(WebUtil.addHttp(_url));

HttpURLConnection.setFollowRedirects(true);

con= (HttpURLConnection) url.openConnection();

java.io.InputStream uc= con.getInputStream();

br= new BufferedReader(new InputStreamReader(uc));

}catch (Exception ex) { ex.printStackTrace(); return; }

}


It works well except a strange website:

http://jobs.workopolis.com/jobshome/db/work.process_job?pi_language=EN&pi_sort_col=+&pi_category=Dummy&pi_industry=Dummy&pi_employer=Dummy&pi_location=Dummy&pi_msg=&pi_location=British Columbia&pi_keyword=account

The exception is:

java.io.FileNotFoundException: http://jobs.workopolis.com/jobshome/db/work.process_job?pi_language=EN&pi_sort_col=+&pi_category=Dummy&pi_industry=Dummy&pi_employer=Dummy&pi_location=Dummy&pi_msg=&pi_location=British Columbia&pi_keyword=account

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:702)

..........


I found an abnormal thing when I tried the url in web browser(IE or Netscape). The response url is different from the request url, which is:

http://jobs.workopolis.com/jobshome/db/work.res_list?pi_sort_col=POST_DATE&pi_search_id=420919582&pi_page_no=1&pi_msg=&pi_gam_date=&pi_page_id=


Anyone has an idea to solve the problem? Thank you very much for any input!

Shawn

   <<Less

Re: java.io.FileNotFoundException

Posted By:   Jens_Dibbern  
Posted On:   Sunday, May 30, 2004 12:51 PM

Hi Shawn,



did you trace the http request/response loop? You can use the http tunnel gui or wget with -S option. My wget told me about some redirects and a 404 error at last. Perhaps they check the user agent header and their redirect doesn't work without it.



HTH

Jens
About | Sitemap | Contact