List of usage examples for org.apache.http.impl.cookie BasicClientCookie2 getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.grendelscan.commons.http.apache_overrides.serializable.SerializableBasicCookie.java
public SerializableBasicCookie(final Cookie cookie) { cookieVersion = cookie.getVersion(); cookieExpiryDate = cookie.getExpiryDate(); cookiePath = cookie.getPath();/* w ww . j ava 2 s .c o m*/ name = cookie.getName(); value = cookie.getValue(); cookieComment = cookie.getComment(); cookieDomain = cookie.getDomain(); isSecure = cookie.isSecure(); ports = cookie.getPorts(); try { if (cookie instanceof BasicClientCookie2) { BasicClientCookie2 b2c = (BasicClientCookie2) cookie; discard = b2c.getClass().getField("discard").getBoolean(b2c); } if (cookie instanceof BasicClientCookie) { BasicClientCookie bCookie = (BasicClientCookie) cookie; Field field = bCookie.getClass().getDeclaredField("attribs"); field.setAccessible(true); attribs = (HashMap) field.get(bCookie); } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } finally { if (attribs == null) { attribs = new HashMap<String, String>(); } } }