tailieunhanh - hackapps book hack proofing your web applications phần 6

và cho nhiều mục đích. Trong điều kiện của các trang web thương mại điện tử, họ rất cần thiết với phương pháp kinh doanh được thực hiện, và nhiều trang web không thể hoạt động mà không có họ. Break-in từ các kịch bản CGI yếu có thể xảy ra trong một loạt các ways. | Securing Your Java Code Chapter 7 287 Second from the client end it could be beneficial to not allow the client to send a transaction until the server has finished processing with the last will only protect against hackers using your client software. If they write new client software to communicate with your server and figure out your protocol then they could bypass this restriction. Another tactic can be implemented from the server side. Usually with Java when a client contacts the server a new thread is created to handle the threads all take up memory and processing power. If someone bombards the server with transactions too many threads could be created which eventually crash the server. A more satisfactory reaction would be to limit the number of threads a server can create. If a client attempts a transaction on the server and the server is overloaded it would just receive a message that the server is busy. Obviously this is better than allowing the server to crash. So how is this implemented in code Imagine a typical ClientThread object that is created each time a client connects class ClientThread public ClientThread Socket client Constructor code here This is how a client thread is typically created. As you see there is no way to limit the number of client threads created using this method. In order to change this we will create what is known as thread pooling. Thread pooling is when we limit the number of threads that can be created. By doing this we essentially create a limited pool of threads to use. In order to implement this we eliminate the public constructor by making it ensures that the constructor cannot be used to create an unlimited number of thread instances. Instead we use a static method called getInstance to get an instance of the method can restrict the number of legal instances that can be created class ClientThread extends Thread 288 Chapter 7 Securing Your Java .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.