List of usage examples for org.apache.http.impl.cookie BasicCommentHandler BasicCommentHandler
public BasicCommentHandler()
From source file:com.gargoylesoftware.htmlunit.httpclient.HtmlUnitBrowserCompatCookieSpec.java
/** * Constructor./*from w w w. jav a 2s. co m*/ * * @param browserVersion the {@link BrowserVersion} to simulate */ public HtmlUnitBrowserCompatCookieSpec(final BrowserVersion browserVersion) { super(new HtmlUnitVersionAttributeHandler(), new HtmlUnitDomainHandler(), new HtmlUnitPathHandler(browserVersion), new BasicMaxAgeHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new HtmlUnitExpiresHandler(browserVersion), new HtmlUnitHttpOnlyHandler()); }
From source file:com.machinepublishers.jbrowserdriver.LaxCookieSpecProvider.java
@Override public CookieSpec create(final HttpContext context) { if (cookieSpec == null) { synchronized (this) { if (cookieSpec == null) { try { Constructor constructor = RFC2965Spec.class.getDeclaredConstructor(boolean.class, CommonCookieAttributeHandler[].class); constructor.setAccessible(true); final RFC2965Spec strict = (RFC2965Spec) constructor.newInstance(false, (Object) new CommonCookieAttributeHandler[] { new RFC2965VersionAttributeHandler(), new BasicPathHandler() { @Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { // No validation } }, new PublicSuffixFilter(PublicSuffixDomainFilter .decorate(new RFC2965DomainAttributeHandler() { @Override public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException { // No validation } }, PublicSuffixMatcherLoader.getDefault())), new RFC2965PortAttributeHandler(), new BasicMaxAgeHandler(), new BasicSecureHandler(), new BasicCommentHandler(), new RFC2965CommentUrlAttributeHandler(), new RFC2965DiscardAttributeHandler() }); constructor = RFC2109Spec.class.getDeclaredConstructor(boolean.class, CommonCookieAttributeHandler[].class); constructor.setAccessible(true); final RFC2109Spec obsoleteStrict = (RFC2109Spec) constructor.newInstance(false, (Object) new CommonCookieAttributeHandler[] { new RFC2109VersionHandler(), new BasicPathHandler() { @Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { // No validation } }, new PublicSuffixFilter( PublicSuffixDomainFilter.decorate(new RFC2109DomainHandler() { @Override public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException { // No validation } }, PublicSuffixMatcherLoader.getDefault())), new BasicMaxAgeHandler(), new BasicSecureHandler(), new BasicCommentHandler() }); constructor = NetscapeDraftSpec.class .getDeclaredConstructor(CommonCookieAttributeHandler[].class); constructor.setAccessible(true); final NetscapeDraftSpec netscapeDraft = (NetscapeDraftSpec) constructor .newInstance((Object) new CommonCookieAttributeHandler[] { new PublicSuffixFilter( PublicSuffixDomainFilter.decorate(new BasicDomainHandler() { @Override public void validate(Cookie cookie, CookieOrigin origin) throws MalformedCookieException { // No validation } }, PublicSuffixMatcherLoader.getDefault())), new BasicPathHandler() { @Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { // No validation } }, new BasicSecureHandler(), new BasicCommentHandler(), new BasicExpiresHandler(DATE_PATTERNS) }); constructor = DefaultCookieSpec.class.getDeclaredConstructor(RFC2965Spec.class, RFC2109Spec.class, NetscapeDraftSpec.class); constructor.setAccessible(true); this.cookieSpec = (DefaultCookieSpec) constructor.newInstance(strict, obsoleteStrict, netscapeDraft); } catch (Throwable t) { Util.handleException(t); }/*from w w w . j av a 2s. c om*/ } } } return this.cookieSpec; }