Wednesday, September 29, 2010

Struts framework in the Session object to create and control



Let me first explain to the session object created in the web development and sessionId generation and returned to the client operating system.

session object when the client first visit, create a new session object. and also generate a sessionId, sessionId in the response will form in response packet back to client browser more memory or a way to rewrite the url returned to the client, to keep the entire conversation, as long as the sever side of the session object is not destroyed, later calling request.getSession () when directly under the client's sessionId to retrieve the generated server-side session object and returns, not again go to New , except in accordance with the sessionId not retrieve session object.

The following is tested in IE, because of a BUG is IE6.0 privacy settings even if IE is to prevent all cookie, they still will be a session cookie to save sessionId. So here are based on the session cookie to discuss

(1) in the server does not shut down, and destroy the object in the session time, when the client again to request the servlet or jsp server side, it will be the first request generated sessionId, and with the information in the request header to the server end send, server-side after receiving sessionId sessionId will go under the search (this process is transparent) server session corresponding to the object and directly back to the session object, this time not to re-establish a new session object.

(2) When the server shut down (prior to the session object generated also disappeared), or the session object after the destruction of time, none of the browser window, and again in the browser window to request the servlet and jsp sever-side when At this point the same will sessionId (server down or destroyed when the session generated sessionId) sent to the server side, server based sessionId find the corresponding session object, but the session object does not exist at this time, at this time will re-generate a new session object, and generate new sessionId and the same will be the new generation of sessionId in response to messages sent to the browser in the form of memory.

(3) When the server does not shut down, and session object in the destruction of time, when the request for a jsp page back to the client, close the browser window, this time his memory sessionId along with it the destruction, to request the re- sever-side of the servlet or jsp, it will re-generate a sessionId to the client browser, and there browse memory.

The above theory is set up to test the servlet, the following talk about the struts framework of the above tests of different places.

Under the first test procedure summary that process:

Client requests index.do--> enter the server side IndexAction ---> Turn login.jsp page -----> request login.do-----> into server-side LoginAction.

First note: IndexAction session object is not to produce, login.jsp set.

(1) Environmental servlet + jsp:

In sevlet + jsp test track, the shift in index.do login.jsp, after entering IndexAction when the browser at this time in memory there is no session cookie, then enter the login.jsp on request login.do LoginAction, the use of request. getCookies () test, its value is null it! result is stable together, because from the beginning had set the final session did not produce it!

(2) Environmental struts + jsp:

In struts + jsp test track, the same as with the above process, began to think the result should be the same, but after debugging and found the result is not thought so. Later in the login.do into LoginActoin with request.getCookies ( ) tests, we found that its value is not null, that he has a name and value, began to not understand, because there is no create-off session object, it would be no session cookie value. But the result, so think of this time here memory devices also should have a session cookie, the problem is here! come from?

Later, after careful consideration, the thought of struts in the characteristics of writing our own struts Action class is the successor of Action, and is the result before the struts ActionServlet the central controller to control the steering, so I think certainly in the process into my own IndexAction written before, struts framework of the code certainly has created a session object and has generated sessionId. So to find relevant books on the workflow and see the ActionServlet calls which class, which really looked after seeing HttpSession session = request. getSession (); this sentence! then answer it is clear which.

We all know that struts the ActionServlet class, receiving our client's request (*. do) after (before a series of initialization will do the work), not directly to deal with our request and calls the corresponding Action (if we write IndexAction), but the processing to the RequestProcessor class, the process method will call the appropriate number of methods to accomplish the request handling and steering operation. a way which attracted my attention, is processLocale () method.

Struts Framework: RequestProcess class processLocale () method of prototype as follows:

Code:

protected void processLocale (HttpServletRequest request,

HttpServletResponse response) (

/ / Are we configured to select the Locale automatically?

if (! moduleConfig.getControllerConfig (). getLocale ()) (

return;

)

/ / Has a Locale already been selected?

HttpSession session = request.getSession ();

if (session.getAttribute (Globals.LOCALE_KEY)! = null) (

return;

)

/ / Use the Locale returned by the servlet container (if any)

Locale locale = request.getLocale ();

if (locale! = null) (

if (log.isDebugEnabled ()) (

log.debug ("Setting user locale '" + locale + "'");

)

session.setAttribute (Globals.LOCALE_KEY, locale);

)

)

Such in the struts-config.xml configuration file in the corresponding configuration items: its default state locale property is true, also would call processLocale method and the first request to create session objects and generate sessionId. but to false after the first request would not reach the ActionServlet calls processLocale method, there could not generate a session object.

The results also come out in the struts application, *. do arrive after the server-side through the ActionServlet, turn to our own IndexAction written before, (the default state ), they have produced a session object and sessionId, which is generated struts framework of the class, even if we write in IndexAction in HttpSession session = request.getSession (); it is RequestProcess class processLocale () method generated At this point the session of the isNew also still true, because it has not returned to the client, which is newly created, then in accordance with the above process, when adopted in the login.jsp login.do into LoginAction, its request.getCookies () of course also has a value! and its value is RequestProcess class processLocale () method produces the generated session object.

If we add in the struts-config.xml when, at this time if another process to track according to the above procedure, and LoginAction with request.getCookies () test, its value is null, of course, write in IndexAction HttpSession session = request.getSession (); when it is time to enter IndexAction newly created, isNew is true. (







Recommended links:



AMD executives just compensation was 1.25 billion up wages Ma



JSF to pass parameters via URL



"BORDER Land" skill tree rules of operation and processing point



Hot Browsers



software testing psychology and economics



Sogou Input Method Of The Parent: The Original Idea To Be Robin Li Baidu Ignored



Essays On CMMI [1]



National Copyright Administration Yan Xiaohong, deputy director of inspection Hao Chen CAD



Simulation of snow-CorelDRAW Versus Photoshop



Report Basic Or VB Or VB DotNet



Adjust the ANIMATION in the size of Authorware



Catalogs Casino And Gambling



MTS to MP4



Clear links in the production of hidden "oil tiger"



Comment Launchers And Task Managers



QuickTime to MPG



OGM to MP4



Friday, September 17, 2010

Dogs save download trouble Thunder online on-demand



According to the 24th China Internet Survey report, online video still accounts for network entertainment in the heavy head. Thunder will be a lot of people through online video download to your hard drive up to watch for his own good pleasure. However, with bandwidth upgrades and technological innovations, Thunder Dog provides online on-demand video features, but also provides a subset of features selected BT film. Such a new way, save the download problems, will be able to bring us more and better experience.

A clear demand fulfillment of the conditions

Thunder dog can be "full network broadcast," that no matter what the video search will normally provide on-demand capabilities, on-demand video to RM, RMVB and WMV video formats mainly three types of follow-up will provide support for other formats. Of course, to make better use of on-demand feature, the more bandwidth the better, recommend more than 2Mbps.

Second, install GVOD

To achieve on-demand function, must be installed GVOD, can be downloaded and installed from the http://gvod.down.xunlei.com/gvod/gvod.exe. Demand can also automatically download and install before. However, we suggest that you first download and install.

Third, to prepare on-demand

Open the Thunder Dogs of Home http://www.gougou.com, enter keywords movie, then you can see the interface shown in Figure 1. You will find more of the "Play Speed" and "play" two columns, longer articles playback speed, said the effect would be a good player. However, the playback speed yellow article or shorter, you can also try on-demand, and not only the playback speed of the progress bar as the sole determining criteria. After clicking "Play" button will appear in Figure 2, the floating layer, click the "know, begin broadcasting it!" Link to get started on demand.






Figure 1 preparation on-demand






Figure 2 start on-demand

Fourth, to achieve on-demand

1. General demand

Shown in Figure 3 can be seen after the playback window, the player with the Thunder to play a little different look. You can see playback speed, you can also see the film of the bit stream, can also achieve full-screen playback, the free volume control. It has a very important feature, allowing us to drag the progress bar for playback.






Figure 3 for playing

2. Sub-set of on-demand

BT resources can sometimes be the case with multiple episodes, as shown in Figure 4 will pop up a "selection diversity" window, click to play the post. Special attention is that no dog is now providing electricity Thunder mule and blog resources on-demand feature, so search for those resources can not be demand for the time being.










Recommended links:



"Home" and the new audio-visual! Want to sing Sing with ABPlayer



Effectiveness is The fundamental real name does not matter



BI, IN the M & A growth?



What Is Rmvb



rmvb Quicktime



Total household real estate elite of "Le Home"



Dell shipped the wrong price is not the defendant of fraud: frozen funds



Specialist Web Development



avi to mpeg converter free



Students this year, real salary levels Jiemi fresh



Tomato Garden, Charged By: The United States Has A Lot Of Piracy



Fax Tools COMPARISON



Lists Hobby



Picked Audio Speech



IDC how to Charge only reasonable



Gtalk and Skype will interact



RMVB ps3