Program to check existence of a url hangs!!!
Here is my code to check whether a url exists ...
import java.net.*;
import java.io.*;
import java.util.*;
public class urlExists
urlExists()
public int exists(String urlname) throws IOException
URL url=null;
try
url=new URL(urlname);
catch(Exception e)
HttpURLConnection connexion = (HttpURLConnection)(url.openConnection());
if(connexion.getResponseCode()==HttpURLConnection.HTTP_NOT_FOUND)
return(0);
else return(1);
}I am using this class many a times but it keeps on hanging for some reason or another. Could anyone please explain me the reason?
Thanks in advance.
Regards
kbhatia
you will have to use a Socket:
public String getResponse(String url) throws Exception{
int timeout = 30000; // 30 second timeout
String inputLine = null;
Socket socket = null;
BufferedReader reader = null;
Writer writer = null;
StringBuffer buf = new StringBuffer();
try{
URL server = new URL(url);
int port = server.getPort();
if (port < 0)
port = 80;
socket = new Socket(server.getHost(),port);
writer = new OutputStreamWriter(socket.getOutputStream(), "US-ASCII");
writer.write("GET " + server.toExternalForm() + " HTTP/1.0\r\n");
writer.write("Host: " + server.getHost() + ':' + port + "\n\n");
writer.flush();
socket.setSoTimeout(timeout);
reader = new BufferedReader(new InputStreamReader(socket.getInputStream(),"UTF-8"));
String line = reader.readLine();
if (line != null && line.startsWith("HTTP/")){
int space = line.indexOf(' ');
String status = line.substring(space + 1,space + 4);
if (!status.equals("200")){
throw new Exception("HTML Error: + " status);
while((line = reader.readLine()) != null)
buf.append(line).append("\n");
else{
throw new Exception("Bad protocol");
catch (InterruptedIOException e) {
throw new Exception("Read timeout expired");
finally{
// close the reader, writer, and socket here
return buf.toString();
}
Similar Messages
-
Small program that checks every minute if a file exists...
Hi,
I am an experienced JSP programmer and now I have to do something different and I have no clue how to do it and even what keywords to search for.
I need to make a small Java program that checks from time to time (every minute) if a file exists and if so performs some tasks.
I would appreciate most of all some keywords to search for. I don't what this kind of program is called. I have no problem with the code that checks the existence of the file etc. Some code would be also appreciated.
I just don't know how to check that every minute.
Thank you very much!For the once-per-minute part, you'll want java.util.Timer and java.util.TimerTask, or else just a loop with a Thread.sleep call in it.
For the file, assuming it's on the local file system where the program will run, you'll want the java.io.File class.
If you're not familiar with Java, you'll definitely need a tutorial. There are links to some under Resources for Beginners at http://www.thejword.com/3.html#beginner_resources -
Every time I TRY to start firefox 18-19 I get an error message : "Firefox has stopped working" - "close the program and check online for a solution" - or - "close the program" this happens TWICE every time I try to start firefox. Eventually after a random number of tries firefox will start normaly. I am useing firefox 19.0.2 now bit I belive it started when I upgraded to firefox 18 but am not sure, it might have been when I upgraded to firefox 19 ... but it has been happening for a very long time and I cannot find any helpfule solutions online.
I have tried a Clean reinstall but it did not help.Hello,
'''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
''(If you're not using it, switch to the Default theme.)''
* You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
* Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
''Once you get the pop-up, just select "'Start in Safe Mode"''
'''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
Thank you. -
Every time I TRY to start firefox 18-19 I get an error message : "Firefox has stopped working" - "close the program and check online for a solution" - or - "close the program" this happens TWICE every time I try to start firefox. Eventually after a random number of tries firefox will start normaly. I am useing firefox 19.0.2 now bit I belive it started when I upgraded to firefox 18 but am not sure, it might have been when I upgraded to firefox 19 ... but it has been happening for a very long time and I cannot find any helpfule solutions online.
Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
'''Note:''' You might want to print these steps or view them in another browser.
#Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
#After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
#Delete the Firefox installation folder, which is located in one of these locations, by default:
#*'''Windows:'''
#**C:\Program Files\Mozilla Firefox
#**C:\Program Files (x86)\Mozilla Firefox
#*'''Mac:''' Delete Firefox from the Applications folder.
#*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
#Now, go ahead and reinstall Firefox:
##Double-click the downloaded installation file and go through the steps of the installation wizard.
##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
Please report back to see if this helped you! -
F-58 Print Program for Check Printing
Hi Guys,
Have some questions here:
1) How to locate the print program for F-58 on the Check? We can configure the form by payment method but can't seem to find the print program like other FI correspondences.
2) Can i ignore the check printing and just print payment advice (if any) after posting via F-58?
Anyone has done this before?
Please advice.
Thanks and Regards,
AndrewHi
I think I could understand your requirement. There is no special PRINT PROGRAM FOR Payment Advice.
There is Print program for check printing : RFFOUS_C
along with above print program Payment Advice and Payment summary will be printed.
check tcode: OBVCU, here we assign the print program.
and Form will be assigned in tcode: OBVU
or in last case do payment with out any print and create payment advice manually in tcode: FBE1
any questions revert back please
Regards
Hari P
Edited by: Hari Peddi on Nov 25, 2008 9:51 AM -
Program to check SSD health on OS X??
Can anyone recommend a program to check the health of a SSD in OS X?? I tried looking for one that is comparable to SSDLife (which only works on Windows) but I seem to be drawing a blank.
Many thanks!!dhty55 wrote:
Can anyone recommend a program to check the health of a SSD in OS X?? I tried looking for one that is comparable to SSDLife (which only works on Windows) but I seem to be drawing a blank.
Many thanks!!
Check out DriveDx: http://binaryfruit.com/drivedx . It displays SSD Lifetime Left indicator, overall health rating, performance rating and many other useful information about your SSD. Nice UI. -
Abap programe 'AUTHORIZATION-CHECK'
What is abap programe 'AUTHORIZATION-CHECK' how can i navigate there
Hi,
You can navigate to the Code this way
1)
SE93> Display>Double click in the Entry corresponding to Program-->then you enter the Source Code here select find and give the search string as
"Authority-Check" this displays you whatever entries are there in the code.
This method is useful if you know the Tcode and want to see what check statemetns are there in ABAP code corresponding to it.
2)On the other hand if you know the program then go to
SE38> enter the program name> Select Source Code> Press Display>
and from there search with the string mentioned above justlike the case mentioned above...
Hope this helps
Regards,
Manohar -
ABAP programming extended Check
Hi
Why do we do ABAP program Extended Check?
Thank Youit is necessary for Complete check of the ABAP source text for all statically recognizable errors.Programs with errors in the extended program check can be executed, but usually result in an exceeption.
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801afd454211d189710000e8322d00/content.htm
Error situation during execution of an ABAP program. Exceptions are treatable (statements TRY, CATCH) or untreatable.
Untreated exceptions result in a runtime error. An exception is triggered either by the ABAP runtime environment due to error situations that are not foreseeable by the static program check, or by the RAISE EXCEPTION statement. -
Error at install NSP - FSL-01001 Unable to check existence of account
Hi all,
I need very urgent help.
I installed the NSP system one time and uninstalled it again.
Now I tried to reinstall it again and allways get the error FSL-01001 Unable to check existence of account localhostSAP_LocalAdmin. Any hints or ideas.
It is a local installation, all admin rights are available. Same environment like at the first installation, which was OK. Also the change of the system name did not help.
Any hints?
Here ist the logfile:
Handling account
TRACE syxxsyshlp.cpp:75
syslib::traceOSError(const iastring &, int, DWORD, const iastring &)
System call failed. Error 2453 (Domänencontroller für diese Domäne konnte nicht gefunden werden.
) in execution of system call 'NetGetDCName' with parameter (NULL, localhost), line (1075) in file (synxcaccmg.cpp).
TRACE synxcaccmg.cpp:766
CSyADsPath::fromString(localhostSAP_LocalAdmin)
Account localhost/SAP_LocalAdmin has ADS path 'WinNT://localhost/SAP_LocalAdmin'
INFO[E] 2005-11-19 14:07:50 synxcgroup.cpp:684
CSyGroupImpl::isExistingOnOS()
Unable to check existence of account localhostSAP_LocalAdmin. Verbindung wurde nicht hergestellt, weil ein identischer Name bereits im Netzwerk vorhanden ist. Wählen Sie "System" in der Systemsteuerung, um den Computernamen zu ändern, und versuchen Sie es erneut.
TRACE iaxxejsexp.cpp:208
EJS_Installer::writeTraceToLogBook()
AccountMgt.createGroup(localhostSAP_LocalAdmin, )
TRACE syxxsyshlp.cpp:75
syslib::traceOSError(const iastring &, int, DWORD, const iastring &)
System call failed. Error 2453 (Domänencontroller für diese Domäne konnte nicht gefunden werden.
) in execution of system call 'NetGetDCName' with parameter (NULL, localhost), line (1075) in file (synxcaccmg.cpp).
TRACE synxcaccmg.cpp:766
CSyADsPath::fromString(localhostSAP_LocalAdmin)
Account localhost/SAP_LocalAdmin has ADS path 'WinNT://localhost/SAP_LocalAdmin'
ERROR 2005-11-19 14:07:55 synxcgroup.cpp:684
CSyGroupImpl::isExistingOnOS()
FSL-01001 Unable to check existence of account localhostSAP_LocalAdmin. Verbindung wurde nicht hergestellt, weil ein identischer Name bereits im Netzwerk vorhanden ist. Wählen Sie "System" in der Systemsteuerung, um den Computernamen zu ändern, und versuchen Sie es erneut.
TRACE iaxxejsbas.hpp:270
EJS_Base::dispatchFunctionCall()
JS Callback has thrown std::ESyException: ESAPinstException: error text undefined
TRACE iaxxcwalker.cpp:301
CDomWalker::processStep()
An error occurred while processing service SAP NetWeaver '04 Support Release 1> ABAP System> MaxDB> Non-Unicode> Central Instance Installation. You may now
press the 'View Log' button to get more information about the error.
stop the task and continue with it later.
reset your input for the current task. In this case, SAPinst will permanently remove all installation files from the installation directory. This gives you the opportunity to restart from scratch.
Log files are written to C:Programmesapinst_instdirNW04SR1WEBAS_ABAP_ADA_NUCCI.
TRACE iaxxgenimp.cpp:845
showDialog()
waiting for an answer from gui
TRACE iaxxcnclhd.cpp:92
doHandleDoc()
ACTION_STOP requested
WARNING 2005-11-19 14:07:57 sapinst.cpp:1302
CSapInst::cancel()
Installation canceled by user request.Hi,
I got same problem. I tried all above replies, still I got same error.
Error
FSL-01001 unable to check existence of account saptranshost\SAP_localAdmin. Access is denied
ERROR 2020-04-28 09:08:56
MOS-01131 Unable to create account ACCOUNTNAME=saptranshost\SAP_LocalAdmin ACCOUNTTYPE=GROUP DESCRIPTION=SAP Local Administration Group MEMBERSHIPSEPARATOR=, OPMODE=CREATE . SOLUTION: Check whether you have permissions to create accounts.
I logged in as local Administrator with Administration permissions. This user created by OS while installation.
Urgent. Thanks in advance.
Regards,
Krishna -
How to compare two programs to check variation in codes
Hi,
I would like compare two programs to check the variation in codes.
Do we have any tool in SAP to do that.
Cheers
S KumarHi,
I did award the points to you when I close the thread. I award it again..
Cheers
S Kumar -
I have an Apple MacBook on which Lion 10.7, plus all updates, are successfully installed.
Can you tell me if TechTool Deluxe, normally supplied with Apple here has been now tested and found to run successfully?
I have run the program to check a problem that I'm having. The particularly with video, and also volume structure. TEchTool Delux reports a failure for both of these components.
I am wondering if this is realistic or not, given the start-up screen for TechTool Delux mentions on start-up that it has yet to be tested fully with Lion?
With thanks, Ron.Yes, I understand, however, he Macbook is out of its Applecare, but the TechTool it still on the machine. Does that entitle me to an upgrade in TechTool?
I suspect not, hoever, seeing I am running Lion, I am not sure at all? If you can answer this question it will help as then Imight be able to solve the problem I'm having.
Best regards, Ron -
what is the program extended check?
Use
You use this function to perform static checks, which are too time consuming for the normal syntax check. The extended program check returns both errors and warnings and it is possible to run either individual specialized tests or one whole standard check.
Procedure
1. You access the extended program check by means of transaction SLIN. You can also choose Program ® Check ® Extended program check.
The system displays a list of possible check options. By default, all of them are selected. For detailed information about a particular option, position the cursor on it and choose F1.
Note
The extended program check takes considerably longer time than other checks but it uses a buffer and the process speeds up after the first run.
2. Select any options you need.
For each option you have selected, the system displays an overview of the number of errors, warnings, and messages.
Note
Only the especially critical warnings are displayed before the standard check.
3. Choose an entry to display the corresponding detail screen.
From that screen you can jump to the appropriate point in the program and correct the error. -
asdaa
I will dissent. For a one time scan you could run Sophos. It will probably only pick up something meant for Windows, if at all, and it may throw a false positive at you, so don't be in a hurry to delete anything. I see you're running 10.8, which has some built in protection, but since it's an '09, you probably migrated stuff over from an earlier OS or Mac and it's also possible you weren't (or haven't been) observing safe browsing techniques, so it may find something genuine.
http://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-mac-home-ed ition.aspx
For the Sophos forum in order to get more help, if needed.
http://openforum.sophos.com/t5/MacTalk/ct-p/FTT_MAC
When done, you can leave it if it's not causing any problems (but not set to auto scan) or uninstall it.
http://openforum.sophos.com/t5/Sophos-Anti-Virus-for-Mac-Home/Removing-Sophos-An ti-Virus-for-Mac-Home-Edition/td-p/37/page/7
And don't let any A-V allow you to become complacent. It's only going to find something already catalogued, but it won't find any brand new threats.
Also, make sure you do not run Java (not JavaScript) in the browser. (Or just don't install the plugin, to begin with.) That would be asking for big trouble. Java is buggy and relentlessly exploited by malware.
Also, pay attention to updates in all your most used applications, Flash included.
Message was edited by: WZZZ -
Java Program to run an https based url
This is the simple code to read through a java program from a simple http based procot URL
import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL yahoo = new URL("http://mail.yahoo.com/");
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
But if i use the url https://mail.yahoo.com/ instead of http://mail.yahoo.com/ then i have an exception given below
Exception in thread "main" java.io.IOException: HTTPS hostname wrong: should be
<mail.yahoo.com>
at sun.net.www.protocol.https.HttpsClient.b(DashoA12275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA12275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(DashoA12275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:626)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Dash
oA12275)
at java.net.URL.openStream(URL.java:913)
at URLReader.main(URLReader.java:7)
Now i want this program based on https to run. SO can anybody help me running the same program by using https? Or can anybody give me the code to run a url based on https protocol?Same as http://forum.java.sun.com/thread.jspa?threadID=677398&tstart=0 . Check reply on the other post.
-
Check existence of a particular directory in Dev Server.
Hi,
How do we check the existence of a particular directory (in Dev Server ) through the program??
Thanks.Hi,
Use function module PFL_CHECK_DIRECTORY.
Regards,
Darren
Maybe you are looking for
-
Cross company code transaction in cash journal
Hi, Is it possible to do cross company code transactions in cash journal ? Eg: i want to make a payment ,from cash journal of cocd 1000 to cocd5000. i should book the payment only thro cash journal . Regards Guru
-
Button in movieclip to main timeline
I have a button(A) that opens a movie clip which contains a button (B). I want button B to go to and play a frame on the main timeline, NOT a frame in the movieclip. Is this possible? If not, what I am aiming for is a menu of buttons, that are rollov
-
Why is my country code is incorrect and indeed it is correct in my billing payment info?
May I know why is my country code is incorrect and indeed it is correct in my billing payment info. I can't purchase anything from the AppStore.
-
If I buy Adobe Premiere Elements, does that give me a 1-year license or is it unlimited?
I want to buy Adobe Premiere Elements, but it is not clear to me if it gives me a 1-year license or if it is unlimited? Different websites give me different information.
-
Setting response header fron JSP
Hi I would like to know how I can set "If-Modified-Since" header, so that when client refreshes the page again the server should send 304 (Not Modified) status to the client. I was able to do this in servlets as follows, {code} class Servlt extends H