Java 6 Platform Revealed phần 4

Tham khảo tài liệu 'java 6 platform revealed phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 48 CHAPTER 3 I O NETWORKING AND SECURITY UPDATES Map to return Map String List String cookieMap new HashMap String List String requestHeaders Convert StringBuilder to List store in map if 0 List String list Cookie list CookieMap cookieMap Make read-only return cookieMap In Java 6 the ListCookieHandler turns into the CookieManager class. The cookieJar that is used as the cache becomes the CookieStore. One thing not in this implementation of CookieHandler is a policy for storing cookies. Do you want to accept no cookies all cookies or only cookies from the original server That s where the CookiePolicy class comes into play. You will explore CookiePolicy more later. The last part of the Java 5 situation is the Cookie class itself. The constructor parses out the fields from the header line. Listing 3-5 shows an implementation that will be replaced in Java 6 by HttpCookie. The Java 6 version will also be more complete. Listing 3-5. Implementing a Cookie Class to Save for Java 5 import . import . import . public class Cookie String name String value URI uri CHAPTER 3 I O NETWORKING AND SECURITY UPDATES 49 String domain Date expires String path private static DateFormat expiresFormatl new SimpleDateFormat E dd MMM yyyy k m s GMT private static DateFormat expiresFormat2 new SimpleDateFormat E dd-MMM-yyyy k m s GMT public Cookie URI uri String header String attributes String nameValue attributes 0 .trim uri 0 1 for int i 1 i i nameValue attributes i .trim int equals if equals -1 continue String name 0 equals String value equals 1 if .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.