Example usage for org.apache.http.cookie CookieOrigin getPort

List of usage examples for org.apache.http.cookie CookieOrigin getPort

Introduction

In this page you can find the example usage for org.apache.http.cookie CookieOrigin getPort.

Prototype

public int getPort() 

Source Link

Usage

From source file:com.gargoylesoftware.htmlunit.httpclient.HtmlUnitPathHandler.java

@Override
public boolean match(final Cookie cookie, final CookieOrigin origin) {
    CookieOrigin newOrigin = origin;/*w w w  .j av a 2 s .  c o  m*/
    String targetpath = origin.getPath();
    if (browserVersion_.hasFeature(HTTP_COOKIE_EXTRACT_PATH_FROM_LOCATION) && !targetpath.isEmpty()) {
        final int lastSlashPos = targetpath.lastIndexOf('/');
        if (lastSlashPos > 1 && lastSlashPos < targetpath.length()) {
            targetpath = targetpath.substring(0, lastSlashPos);
            newOrigin = new CookieOrigin(origin.getHost(), origin.getPort(), targetpath, origin.isSecure());
        }
    }

    return super.match(cookie, newOrigin);
}