Method in the real-time display server end of client program run situation
Technical field
The present invention relates to a kind of method of display routine ruuning situation, particularly in the method for client display server end program run situation.
Background technology
The application of server/customer end structure (Server/Client) at present more and more widely, its advantage is to have adopted widely network technology, each several part Task Distribution in the system is given the computing machine of serving as different role that is distributed on the network, its complicated calculating and management role are given the high-grade machine service device (Server) on the network, and task frequent some and that the user comes into contacts with is given better simply computing machine one client computer of front end (Client).Realized sharing of information resource on the network fully by this structure.
Generally, during server/customer end structure browsing information, client is submitted a request to, and server end all will be operated accordingly.When corresponding operation can not be submitted to the user at short notice, be necessary to make the user to recognize the state of current server operation.Traditional way all is to show the page such as " inquiring about data, please wait a moment ... " simply, after server goes out the result, converts the page of display result again to.Though this method has provided a prompting that allows the user wait for, it is directly perceived inadequately, and the user can only wait for the result, but does not know how long come out to also have from the result, do not know also whether program mistake occurred.If it is chronic, the user can think response that server end can not be real-time and end operation, traditional way can not show the state when pre-treatment in real time, when the wrong generation of server, can not in time beam back client to information, this situation is particularly evident in website or the exploitation based on customer end/server mode, has wasted a large amount of time, has also reduced the access efficiency that makes server end.Therefore how realizing intuitively, effectively understand the ruuning situation of server, is nowadays to cultivate problem to be solved.
Summary of the invention
In view of this, the present invention addresses the above problem a kind of method in the real-time display server end of client program run situation that proposes, by real-time monitoring, and in time return monitoring information and make client can recognize the program run situation of server end timely and accurately server.
For reaching above-mentioned purpose, method in the real-time display server end of client program run situation provided by the present invention, at first server end receives client-requested, handle the request of client then and carry out corresponding server, the ruuning situation of real-time monitor server end program, according to ruuning situation the content refresh that needs upgrade is arrived customer terminal webpage again, and customer terminal webpage does not need to refresh, and this comprises the content refresh that needs upgrade according to ruuning situation to the customer terminal webpage step: the integer variable of record number percent; When need upgrading, number percent enters this progress page; And refresh the width of this progress bar.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics be, the request of described client is by submitting the CGI page end of uploading onto the server to.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics be, the request of described client is by submitting the JSP page end of uploading onto the server to.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are, the step of the ruuning situation of described real-time this server of monitoring is for detecting the operation progress of this program in real time.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are that the operation progress of described program shows in the mode of progress bar.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are that the step of the ruuning situation of described real-time this program of monitoring is the error message of this program of monitoring in real time.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are that described error message comprises: can not read source file, target disk does not have free space, operation failure.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are that the step of the error message of described real-time this program of monitoring more comprises the steps:
Show this error message in client;
Client is according to these Information Selection one processing means; And
Server end receives these processing means and carries out corresponding operation.
Above-mentioned method in the real-time display server end of client program run situation, its characteristics are that described processing means comprise retry, skip, end, withdraw from.
Above-mentioned method in the clear condition of client real-time display server end program run, its characteristics are, the described step that refreshes the width of this progress bar is for exporting the width that one section JavaseriPt code changes progress bar.
According to the method in the real-time display server end of client program run situation provided by the invention, the program run situation of monitor server end in real time, and show in client, make the operation progress of recognizing program that the user can be real-time, and whether wrong generation, and in real time mistake is handled accordingly, improved access efficiency to server.
Description of drawings
Fig. 1 is the method synoptic diagram of traditional display navigation progress;
Fig. 2 is the method synoptic diagram of display navigation progress of the present invention;
Fig. 3 is for the present invention carried at the overview flow chart of the method for the real-time display server end of client program run situation;
Fig. 4 is for the present invention carried in the method for the real-time display server end of client program run situation
The process flow diagram of embodiment;
The process flow diagram that Fig. 5 handled in the error message of the method for the real-time display server end of client program run situation for the present invention carried;
Fig. 6 is for the present invention carried in the method for the real-time display server end of client program run situation
The process flow diagram of embodiment;
Fig. 7 is for the present invention carried at the process flow diagram of the renewal progress of the method for the real-time display server end of client program run situation.
Symbol description among the figure
Step 310 server end receives a request of client
Step 320 is handled this request and is carried out corresponding server
Step 330 is the ruuning situation of this server of monitoring in real time
Step 340 refreshes this customer terminal webpage according to this ruuning situation
Step 410 browser end is submitted a list to
Step 420 server end operation copyfile.cgi program
Step 430 need to obtain the number of files of copy
Use the cp of operating system to order copied files in step 440 program
Whether step 450 monitoring copy is normal
Step 460 is according to current copied files quantity computing progress
Step 470 refreshes progress in the page of browser end
Step 480 shows error message at current page
Step 510 shows this error message in client
Step 520 client is according to these Information Selection one processing means
Step 530 server end receives these processing means and carries out corresponding operation
Step 610 enters JSP page execution usability of program fragments wherein
Step 620 calculation procedure progress
Step 630 refreshes the client progress page, upgrades current progress
The integer variable of step 710 record number percent
Step 720 enters this progress page when number percent need upgrade
Step 730 refreshes the width of this progress bar
Embodiment
Among the web page browsing process, our computing machine is called " client (Client) ", and www server is called " server end (Server) ", and a such framework is called the framework of " master-slave mode " in network.The characteristic of master-slave architecture is: have only when client is sent requirement, server end just can transmission information be given client, if have no requirement, between server end and the client be do not have fully online, server initiatively carry information give client.
Generally, server all is to show the page such as " inquiring about data, please wait a moment ... " simply when handling the request of view side, as shown in Figure 1, after server goes out the result, converts the page of display result again to.According to method provided by the invention, can see also Fig. 2, for example according to program run progress in the real-time display server of number percent, number percent of every increase just refreshes once in the progress of client, and the user can recognize the ruuning situation of present procedure more intuitively like this.
According to the method in the real-time display server end of client program run situation of the present invention, see also Fig. 3, the overview flow chart that this figure is that the present invention carried in the method for the real-time display server end of client program run situation.At first server end receives a request (step 310) of client, handle this request then and carry out corresponding server (step 320), the ruuning situation (step 330) of this server of monitoring refreshes this customer terminal webpage (step 340) according to this ruuning situation more in real time.
Be embodied as example with CGI (Common Gateway Interface) service below, the present invention will be described in detail, when client is submitted CGI (the Common Gateway Interface) page to server end to, the present invention sends the JavaScript function in real time in browser page, JavaScript is meant the JavaScript of client, it is some shell script codes that write in the HTML archives, can be along with the HTML archives download in the computing machine of oneself together.Browser can be understood JavaScript in the lump when understanding HTML, if there is the place of this execution will go to carry out, or have some incident (Event) to take place by the time, for example presses mouse and just can go to carry out.So JavaScript carries out by browser in client.This section function will change the width of the little picture that is used for representing progress bar in this page, reach to show as the purpose that progress bar rolls on showing.See also Fig. 4, the embodiment process flow diagram that this figure is that the present invention carried in the method for the real-time display server end of client program run situation.CGI is the pipeline that the server calling external procedures is carried out, so CGI carries out on server.At first browser end is submitted a list (step 410) to, is handled by copyfile.cgi.Server end operation copyfile.cgi program (step 420).This program will be under certain catalogue to the hard disk of the document copying under certain catalogue on the CD.Need to obtain the number of files (step 430) of copy then, be assumed to be 100 here.Use the cp of operating system to order copied files (step 440) in the program, monitor copy function whether normally (step 450) then.If copy failure, can return other value with the prompting user, show error message (step 480) at current page, see also Fig. 5 and should figure be the process flow diagram that the present invention carried handles in the error message of the method for the real-time display server end of client program run situation, error message is presented at (step 510) after the client, client just can be selected processing means (step 520) according to error message, and the processing means comprise retry, skip, end, withdraw from etc.These rreturn values are operating system regulations, and for example rreturn value 100 expressions can not be read source file, and 101 expression target disks do not have the space.With the prompting user.The cp order is when normal copy, and rreturn value is 0, and server end receives these processing means and carries out corresponding operation (step 530).If copy successfully, then server end is according to current copied files quantity computing progress (step 460).In program, whenever call cp instruction and will copy a file, owing to have 100 files, then whenever successfully copy a file and just current progress is added 1, Kao Bei number of files also adds 1 altogether, if the number of files of copy equals 100 altogether, the expression copy is finished, and just can withdraw from.At this moment need in the page of browser end, to refresh progress (step 470), promptly export the width that one section JavaScript code changes progress bar.
The user also can use browser to submit to the JSP page to reach a certain result in the present invention, see also Fig. 6, when client is submitted the JSP page to server end to, just when Web server when running into the request of visit JSP webpage, at first enter JSP page execution usability of program fragments (step 610) wherein, detect the ruuning situation of this program then in real time, simultaneously calculation procedure progress (step 620), refresh the client progress page then, upgrade current progress (step 630).
As shown in Figure 7, in the process of the current progress of above-mentioned renewal, at first write down the integer variable (step 710) of number percent, when number percent need upgrade, enter this progress page (step 720), refresh the width (step 730) of this progress bar again.Then execution result is returned to the client with html format.Usability of program fragments can operating database, redirect webpage and send e-mail or the like.All procedure operation are all carried out at server end, and that send client on the network to only is the result who obtains.
Though the present invention discloses as above with aforesaid preferred embodiment; right its is not in order to limiting the present invention, thus anyly be familiar with this operator, without departing from the spirit and scope of the present invention; when can doing a little change and retouching, so protection scope of the present invention is as the criterion when looking claims person of defining.