Author | Topic: LoadFromUrl() question | |
---|---|---|
Johan | LoadFromUrl() question on Thu, 25 Nov 2010 09:06:30 +0100 Hi, I sometimes run into a problem with LoadFromUrl() as with this page: "http://www.bibliotek.se/session/showrecord?titleId=1815983" - if loaded I get a page with a http error message instead of the page: Anybody knows why and what to do about it? Regards, Johan | |
Pablo Botella | Re: LoadFromUrl() question on Thu, 25 Nov 2010 09:19:12 +0100 Hi, > "http://www.bibliotek.se/session/showrecord?titleId=1815983" The url responded with this headers: HTTP/1.1 302 Moved Temporarily Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=AC7EE8EF7C24A6A8AA5B277D7E81EBCA; Path=/session Location: http://www.bibliotek.se/session/search?form=simple Content-Length: 0 Date: Thu, 25 Nov 2010 08:12:14 GMT So you must retry using the new url: http://www.bibliotek.se/session/search?form=simple Regards, Pablo Botella | |
Johan | Re: LoadFromUrl() question on Thu, 25 Nov 2010 10:38:50 +0100 Hi Pablo, The service must have been temporarly down when you tried - when I click the link now I go the expected page, but when trying to LoadFromUrl() the response is: "HTTP Status 500 - ------------------------------------ type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.String.substring(String.java:1938) session.BaseServlet.service(BaseServlet.java:310) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs. ------------------------------------ Apache Tomcat/6.0.18" Regards, Johan "Pablo Botella" <pb_no_spam_@_remove_all_betwen_underscores_xbwin.com> skrev i meddelandet news:206c2350$6943c495$188db@news.alaska-software.com... > Hi, > >> "http://www.bibliotek.se/session/showrecord?titleId=1815983" > > The url responded with this headers: > > HTTP/1.1 302 Moved Temporarily > Server: Apache-Coyote/1.1 > Set-Cookie: JSESSIONID=AC7EE8EF7C24A6A8AA5B277D7E81EBCA; Path=/session > Location: http://www.bibliotek.se/session/search?form=simple > Content-Length: 0 > Date: Thu, 25 Nov 2010 08:12:14 GMT > > So you must retry using the new url: > http://www.bibliotek.se/session/search?form=simple > > Regards, > Pablo Botella | |
Johan | Re: LoadFromUrl() question on Thu, 25 Nov 2010 10:50:37 +0100 Hmmm, I became dubious just after responding to Pablo and sent the link to a colleague and it did'nt work there either - so there has to be some other explanation to this... cookies? Here's my code showing the whole process - it's the "cNisse:=LoadFromUrl(cVar)" line and the saving later on that shows the problem: #include "Gra.ch" #include "Xbp.ch" #include "Appevent.ch" #include "Font.ch" #include "Inkey.ch" #pragma library("asinet10.lib") PROCEDURE AppSys() RETURN PROCEDURE Main() LOCAL oDlg, oGuest, cHemsida, lExit:=.F. oDlg := XbpDialog():new(,,{1,1},{1580,1050}) oDlg:title := "Bibliotek.se" oDlg:taskList := .F. oDlg:close :={||lExit:=.T.} oDlg:create() oDa:=oDlg:drawingArea oGuest:=XbpHtmlViewer():new(oDa) oGuest:create(oDa,oDa,{10,350},{830,560}) cHemsida:="http://www.bibliotek.se/session/performsearch?search=0997914&form=simple&queryType=and&x=0&y=0&SEARCH_ME=&sortOrder=1&nbrOfPosts=10" oGuest:navigate(cHemsida) DO WHILE oGuest:isBusy() ENDDO DO WHILE At("showrecord",oGuest:locationUrl)==0 ENDDO cVar:=oGuest:locationUrl oDlg:setTitle("Actual address: "+cVar) cNisse:=LoadFromUrl(cVar) MemoWrit("url.txt",cVar) MemoWrit("page.htm",cNisse) SetAppFocus(oDlg) DO WHILE ! lExit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) oXbp:keyBoard := {|mp1, mp2, obj| nKey:=mp1} ENDDO oGuest:destroy() MsgBox("bye") QUIT RETURN "Johan" <johan[@]svff.se> skrev i meddelandet news:6d442fd7$597620a6$189cb@news.alaska-software.com... > Hi Pablo, > > The service must have been temporarly down when you tried - when I click > the link now I go the expected page, but when trying to LoadFromUrl() the > response is: > > "HTTP Status 500 - > ------------------------------------ > type Exception report > > message > > description The server encountered an internal error () that prevented it > from fulfilling this request. > > exception java.lang.StringIndexOutOfBoundsException: String index out of > range: -1 > java.lang.String.substring(String.java:1938) > session.BaseServlet.service(BaseServlet.java:310) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > note The full stack trace of the root cause is available in the Apache > Tomcat/6.0.18 logs. > ------------------------------------ > Apache Tomcat/6.0.18" > > > Regards, > > Johan > > "Pablo Botella" <pb_no_spam_@_remove_all_betwen_underscores_xbwin.com> > skrev i meddelandet > news:206c2350$6943c495$188db@news.alaska-software.com... >> Hi, >> >>> "http://www.bibliotek.se/session/showrecord?titleId=1815983" >> >> The url responded with this headers: >> >> HTTP/1.1 302 Moved Temporarily >> Server: Apache-Coyote/1.1 >> Set-Cookie: JSESSIONID=AC7EE8EF7C24A6A8AA5B277D7E81EBCA; Path=/session >> Location: http://www.bibliotek.se/session/search?form=simple >> Content-Length: 0 >> Date: Thu, 25 Nov 2010 08:12:14 GMT >> >> So you must retry using the new url: >> http://www.bibliotek.se/session/search?form=simple >> >> Regards, >> Pablo Botella > | |
Thomas Braun | Re: LoadFromUrl() question on Mon, 06 Dec 2010 09:55:39 +0100 Johan wrote: > Hmmm, > > I became dubious just after responding to Pablo and sent the link to a > colleague and it did'nt work there either - so there has to be some other > explanation to this... cookies? Maybe... to be sure you could try and use Firefox, install Firebug and use Firebugs excellent network tracing function to see what actually happens when you submit the request via a real browser. Thomas |