idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
40,200 | public void add ( final URI uri , final HttpCookie cookie ) { if ( cookie . getMaxAge ( ) == 0 ) { return ; } if ( cookie . getDomain ( ) != null ) { add ( new DomainKey ( cookie ) , cookie ) ; } if ( uri != null ) { add ( new UriKey ( uri , cookie ) , cookie ) ; } } | public cookie store api |
40,201 | private boolean netscapeDomainMatches ( final String domain , final String host ) { if ( domain == null || host == null ) { return false ; } boolean isLocalDomain = ".local" . equalsIgnoreCase ( domain ) ; int embeddedDotInDomain = domain . indexOf ( '.' ) ; if ( embeddedDotInDomain == 0 ) { embeddedDotInDomain = domain . indexOf ( '.' , 1 ) ; } if ( ! isLocalDomain && ( embeddedDotInDomain == - 1 || embeddedDotInDomain == domain . length ( ) - 1 ) ) { return false ; } int firstDotInHost = host . indexOf ( '.' ) ; if ( firstDotInHost == - 1 && isLocalDomain ) { return true ; } int domainLength = domain . length ( ) ; int lengthDiff = host . length ( ) - domainLength ; if ( lengthDiff == 0 ) { return host . equalsIgnoreCase ( domain ) ; } else if ( lengthDiff > 0 ) { String H = host . substring ( 0 , lengthDiff ) ; String D = host . substring ( lengthDiff ) ; return ( D . equalsIgnoreCase ( domain ) ) ; } else if ( lengthDiff == - 1 ) { return ( domain . charAt ( 0 ) == '.' && host . equalsIgnoreCase ( domain . substring ( 1 ) ) ) ; } return false ; } | shamelessly copied from jdk8 source code for InMemoryCookieStore |
40,202 | public static Object parse ( final ChainedHttpConfig config , final FromServer fromServer ) { try { final Csv . Context ctx = ( Csv . Context ) config . actualContext ( fromServer . getContentType ( ) , Csv . Context . ID ) ; return ctx . makeReader ( fromServer . getReader ( ) ) . readAll ( ) ; } catch ( IOException e ) { throw new TransportingException ( e ) ; } } | Used to parse the server response content using the OpenCsv parser . |
40,203 | public static void encode ( final ChainedHttpConfig config , final ToServer ts ) { if ( handleRawUpload ( config , ts ) ) { return ; } final ChainedHttpConfig . ChainedRequest request = config . getChainedRequest ( ) ; final Csv . Context ctx = ( Csv . Context ) config . actualContext ( request . actualContentType ( ) , Csv . Context . ID ) ; final Object body = checkNull ( request . actualBody ( ) ) ; checkTypes ( body , new Class [ ] { Iterable . class } ) ; final StringWriter writer = new StringWriter ( ) ; final CSVWriter csvWriter = ctx . makeWriter ( new StringWriter ( ) ) ; Iterable < ? > iterable = ( Iterable < ? > ) body ; for ( Object o : iterable ) { csvWriter . writeNext ( ( String [ ] ) o ) ; } ts . toServer ( stringToStream ( writer . toString ( ) , request . actualCharset ( ) ) ) ; } | Used to encode the request content using the OpenCsv writer . |
40,204 | private void readAll ( ) { final List < CompletableFuture < Void > > futures = new ArrayList < > ( ) ; for ( File file : directory . listFiles ( ) ) { final Runnable loadFile = ( ) -> { if ( file . getName ( ) . endsWith ( SUFFIX ) ) { try ( FileReader reader = new FileReader ( file ) ) { Properties props = new Properties ( ) ; props . load ( reader ) ; Map . Entry < Key , HttpCookie > entry = fromProperties ( props ) ; if ( entry != null ) { add ( entry . getKey ( ) , entry . getValue ( ) ) ; } else { file . delete ( ) ; } } catch ( IOException ioe ) { throw new RuntimeException ( ioe ) ; } } } ; futures . add ( CompletableFuture . runAsync ( loadFile , executor ) ) ; } try { CompletableFuture . allOf ( futures . toArray ( new CompletableFuture [ 0 ] ) ) . get ( ) ; } catch ( InterruptedException | ExecutionException e ) { throw new RuntimeException ( e ) ; } } | each cookie store controls its own directory we do not need to synchronize |
40,205 | @ SuppressWarnings ( "WeakerAccess" ) public static Object parse ( final ChainedHttpConfig config , final FromServer fromServer ) { try { final ObjectMapper mapper = ( ObjectMapper ) config . actualContext ( fromServer . getContentType ( ) , OBJECT_MAPPER_ID ) ; return mapper . readValue ( fromServer . getReader ( ) , config . getChainedResponse ( ) . getType ( ) ) ; } catch ( IOException e ) { throw new TransportingException ( e ) ; } } | Used to parse the server response content using the Jackson JSON parser . |
40,206 | @ SuppressWarnings ( "WeakerAccess" ) public static void encode ( final ChainedHttpConfig config , final ToServer ts ) { try { if ( handleRawUpload ( config , ts ) ) { return ; } final ChainedHttpConfig . ChainedRequest request = config . getChainedRequest ( ) ; final ObjectMapper mapper = ( ObjectMapper ) config . actualContext ( request . actualContentType ( ) , OBJECT_MAPPER_ID ) ; final StringWriter writer = new StringWriter ( ) ; mapper . writeValue ( writer , request . actualBody ( ) ) ; ts . toServer ( new CharSequenceInputStream ( writer . toString ( ) , request . actualCharset ( ) ) ) ; } catch ( IOException e ) { throw new TransportingException ( e ) ; } } | Used to encode the request content using the Jackson JSON encoder . |
40,207 | public static void mapper ( final HttpConfig config , final ObjectMapper mapper ) { mapper ( config , mapper , ContentTypes . JSON ) ; } | Used to configure the provided Jackson ObjectMapper in the configuration context for the default JSON content type . |
40,208 | public static void mapper ( final HttpConfig config , final ObjectMapper mapper , final Iterable < String > contentTypes ) { config . context ( contentTypes , OBJECT_MAPPER_ID , mapper ) ; } | Used to configure the provided Jackson ObjectMapper in the configuration context for the specified content type . |
40,209 | public static void toFile ( final HttpConfig config , final File file ) { toFile ( config , ContentTypes . ANY . getAt ( 0 ) , file ) ; } | Downloads the content to a specified file . |
40,210 | public static void toFile ( final HttpConfig config , final String contentType , final File file ) { config . context ( contentType , ID , file ) ; config . getResponse ( ) . parser ( contentType , Download :: fileParser ) ; } | Downloads the content to a specified file with the specified content type . |
40,211 | public static void toStream ( final HttpConfig config , final OutputStream ostream ) { toStream ( config , ContentTypes . ANY . getAt ( 0 ) , ostream ) ; } | Downloads the content into an OutputStream . |
40,212 | public static void toStream ( final HttpConfig config , final String contentType , final OutputStream ostream ) { config . context ( contentType , ID , ostream ) ; config . getResponse ( ) . parser ( contentType , Download :: streamParser ) ; } | Downloads the content into an OutputStream with the specified content type . |
40,213 | public Page title ( String title ) { properties . put ( Title , title ) ; String heading = ( String ) properties . get ( Heading ) ; if ( heading == null || heading . equals ( NoTitle ) ) properties . put ( Heading , title ) ; return this ; } | Set page title . |
40,214 | public final Page setBackGroundColor ( String color ) { properties . put ( BgColour , color ) ; attribute ( "bgcolor" , color ) ; return this ; } | Set page background color . |
40,215 | public final Page setBase ( String target , String href ) { base = "<base " + ( ( target != null ) ? ( "TARGET=\"" + target + "\"" ) : "" ) + ( ( href != null ) ? ( "HREF=\"" + href + "\"" ) : "" ) + ">" ; return this ; } | Set the URL Base for the Page . |
40,216 | public void writeBodyTag ( Writer out ) throws IOException { if ( ! writtenBodyTag ) { writtenBodyTag = true ; out . write ( "<body " + attributes ( ) + ">\n" ) ; } } | Write HTML page body tag . Write tags <BODY page attributes> . |
40,217 | public void write ( Writer out , String section , boolean endHtml ) throws IOException { writeHtmlHead ( out ) ; writeBodyTag ( out ) ; Composite s = getSection ( section ) ; if ( s == null ) { if ( section . equals ( Content ) ) writeElements ( out ) ; } else s . write ( out ) ; if ( endHtml ) writeHtmlEnd ( out ) ; out . flush ( ) ; } | Write page section . The page is written containing only the named section . If a head and bodyTag have not been written then they are written before the section . If endHtml is true the end HTML tag is also written . If the named section is Content and it cannot be found then the normal page contents are written . |
40,218 | public void addSection ( String section , Composite composite ) { sections . put ( section , composite ) ; add ( composite ) ; } | Set a composite as a named section and add it to the . contents of the page |
40,219 | public void addTo ( String section , Object element ) { Composite s = ( Composite ) sections . get ( section ) ; if ( s == null ) add ( element ) ; else s . add ( element ) ; } | Add content to a named sections . If the named section cannot . be found the content is added to the page . |
40,220 | public void close ( ) throws IOException { try { _completing = true ; if ( _connection instanceof Socket && ! ( _connection instanceof SSLSocket ) ) ( ( Socket ) _connection ) . shutdownOutput ( ) ; _outputStream . close ( ) ; _inputStream . close ( ) ; } finally { if ( _handlingThread != null && Thread . currentThread ( ) != _handlingThread ) _handlingThread . interrupt ( ) ; } } | Close the connection . This method calls close on the input and output streams and interrupts any thread in the handle method . may be specialized to close sockets etc . |
40,221 | public String getServerName ( ) { String host = _listener . getHost ( ) ; if ( InetAddrPort . __0_0_0_0 . equals ( host ) && _connection instanceof Socket ) host = ( ( Socket ) _connection ) . getLocalAddress ( ) . getHostName ( ) ; return host ; } | Get the listeners HttpServer . But if the name is 0 . 0 . 0 . 0 then the real interface address is used . |
40,222 | public String getServerAddr ( ) { if ( _connection instanceof Socket ) return ( ( Socket ) _connection ) . getLocalAddress ( ) . getHostAddress ( ) ; return _listener . getHost ( ) ; } | Get the listeners HttpServer . |
40,223 | protected void firstWrite ( ) throws IOException { if ( _response . isCommitted ( ) ) return ; if ( HttpRequest . __HEAD . equals ( _request . getMethod ( ) ) ) _outputStream . nullOutput ( ) ; int length = _response . getIntField ( HttpFields . __ContentLength ) ; if ( length >= 0 ) _outputStream . setContentLength ( length ) ; } | Setup the reponse output stream . Use the current state of the request and response to set tranfer parameters such as chunking and content length . |
40,224 | protected HttpContext service ( HttpRequest request , HttpResponse response ) throws HttpException , IOException { if ( _httpServer == null ) throw new HttpException ( HttpResponse . __503_Service_Unavailable ) ; return _httpServer . service ( request , response ) ; } | Service a Request . This implementation passes the request and response to the service method of the HttpServer for this connections listener . If no HttpServer has been associated the 503 is returned . This method may be specialized to implement other ways of servicing a request . |
40,225 | protected void recycle ( ) { _listener . persistConnection ( this ) ; if ( _request != null ) _request . recycle ( this ) ; if ( _response != null ) _response . recycle ( this ) ; } | Recycle the connection . called by handle when handleNext returns true . |
40,226 | protected void destroy ( ) { try { close ( ) ; } catch ( IOException e ) { LogSupport . ignore ( log , e ) ; } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; } if ( _request != null ) _request . destroy ( ) ; if ( _response != null ) _response . destroy ( ) ; if ( _inputStream != null ) _inputStream . destroy ( ) ; if ( _outputStream != null ) _outputStream . destroy ( ) ; _inputStream = null ; _outputStream = null ; _request = null ; _response = null ; _handlingThread = null ; if ( _statsOn ) { _tmpTime = System . currentTimeMillis ( ) ; if ( _reqTime > 0 ) _httpServer . statsEndRequest ( _tmpTime - _reqTime , false ) ; _httpServer . statsCloseConnection ( _tmpTime - _openTime , _requests ) ; } } | Destroy the connection . called by handle when handleNext returns false . |
40,227 | protected Resource getResource ( String pathInContext ) throws IOException { Resource r = ( _resourceBase == null ) ? _httpContext . getResource ( pathInContext ) : _resourceBase . addPath ( pathInContext ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "RESOURCE=" + r ) ; return r ; } | get Resource to serve . Map a path to a resource . The default implementation calls HttpContext . getResource but derived servlets may provide their own mapping . |
40,228 | public static int type ( String type ) { if ( "request" . equalsIgnoreCase ( type ) ) return __REQUEST ; if ( "forward" . equalsIgnoreCase ( type ) ) return __FORWARD ; if ( "include" . equalsIgnoreCase ( type ) ) return __INCLUDE ; if ( "error" . equalsIgnoreCase ( type ) ) return __ERROR ; throw new IllegalArgumentException ( type ) ; } | Dispatch type from name |
40,229 | public String [ ] getProxyHostsWhiteList ( ) { if ( _proxyHostsWhiteList == null || _proxyHostsWhiteList . size ( ) == 0 ) return new String [ 0 ] ; String [ ] hosts = new String [ _proxyHostsWhiteList . size ( ) ] ; hosts = ( String [ ] ) _proxyHostsWhiteList . toArray ( hosts ) ; return hosts ; } | Get proxy host white list . |
40,230 | public void setProxyHostsWhiteList ( String [ ] hosts ) { if ( hosts == null || hosts . length == 0 ) _proxyHostsWhiteList = null ; else { _proxyHostsWhiteList = new HashSet ( ) ; for ( int i = 0 ; i < hosts . length ; i ++ ) if ( hosts [ i ] != null && hosts [ i ] . trim ( ) . length ( ) > 0 ) _proxyHostsWhiteList . add ( hosts [ i ] ) ; } } | Set proxy host white list . |
40,231 | public String [ ] getProxyHostsBlackList ( ) { if ( _proxyHostsBlackList == null || _proxyHostsBlackList . size ( ) == 0 ) return new String [ 0 ] ; String [ ] hosts = new String [ _proxyHostsBlackList . size ( ) ] ; hosts = ( String [ ] ) _proxyHostsBlackList . toArray ( hosts ) ; return hosts ; } | Get proxy host black list . |
40,232 | public void setProxyHostsBlackList ( String [ ] hosts ) { if ( hosts == null || hosts . length == 0 ) _proxyHostsBlackList = null ; else { _proxyHostsBlackList = new HashSet ( ) ; for ( int i = 0 ; i < hosts . length ; i ++ ) if ( hosts [ i ] != null && hosts [ i ] . trim ( ) . length ( ) > 0 ) _proxyHostsBlackList . add ( hosts [ i ] ) ; } } | Set proxy host black list . |
40,233 | protected void customizeConnection ( String pathInContext , String pathParams , HttpRequest request , Socket socket ) throws IOException { } | Customize proxy Socket connection for CONNECT . Method to allow derived handlers to customize the tunnel sockets . |
40,234 | protected void customizeConnection ( String pathInContext , String pathParams , HttpRequest request , URLConnection connection ) throws IOException { } | Customize proxy URL connection . Method to allow derived handlers to customize the connection . |
40,235 | protected URL isProxied ( URI uri ) throws MalformedURLException { if ( isForbidden ( uri ) ) return null ; return new URL ( uri . toString ( ) ) ; } | Is URL Proxied . Method to allow derived handlers to select which URIs are proxied and to where . |
40,236 | protected boolean isForbidden ( URI uri ) { String scheme = uri . getScheme ( ) ; String host = uri . getHost ( ) ; int port = uri . getPort ( ) ; return isForbidden ( scheme , host , port , true ) ; } | Is URL Forbidden . |
40,237 | protected boolean isForbidden ( String scheme , String host , int port , boolean openNonPrivPorts ) { Integer p = new Integer ( port ) ; if ( port > 0 && ! _allowedConnectPorts . contains ( p ) ) { if ( ! openNonPrivPorts || port <= 1024 ) return true ; } if ( scheme == null || ! _ProxySchemes . containsKey ( scheme ) ) return true ; if ( _proxyHostsWhiteList != null && ! _proxyHostsWhiteList . contains ( host ) ) return true ; if ( _proxyHostsBlackList != null && _proxyHostsBlackList . contains ( host ) ) return true ; return false ; } | Is scheme host & port Forbidden . |
40,238 | public FilterHolder addFilterPathMapping ( String pathSpec , String filterName , int dispatches ) { FilterHolder holder = ( FilterHolder ) _filterMap . get ( filterName ) ; if ( holder == null ) throw new IllegalArgumentException ( "unknown filter: " + filterName ) ; FilterMapping mapping = new FilterMapping ( pathSpec , holder , dispatches ) ; _pathFilters . add ( mapping ) ; return holder ; } | Add a mapping from a pathSpec to a Filter . |
40,239 | public FilterHolder addFilterServletMapping ( String servletName , String filterName , int dispatches ) { FilterHolder holder = ( FilterHolder ) _filterMap . get ( filterName ) ; if ( holder == null ) throw new IllegalArgumentException ( "Unknown filter :" + filterName ) ; _servletFilterMap . add ( servletName , new FilterMapping ( null , holder , dispatches ) ) ; return holder ; } | Add a servlet filter mapping |
40,240 | public static ServletHttpResponse unwrap ( ServletResponse response ) { while ( ! ( response instanceof ServletHttpResponse ) ) { if ( response instanceof ServletResponseWrapper ) { ServletResponseWrapper wrapper = ( ServletResponseWrapper ) response ; response = wrapper . getResponse ( ) ; } else throw new IllegalArgumentException ( "Does not wrap ServletHttpResponse" ) ; } return ( ServletHttpResponse ) response ; } | Unwrap a ServletResponse . |
40,241 | public static int [ ] toArray ( String s , int family ) { byte [ ] byteArray = toByteArray ( s , family ) ; if ( byteArray == null ) return null ; int [ ] intArray = new int [ byteArray . length ] ; for ( int i = 0 ; i < byteArray . length ; i ++ ) intArray [ i ] = byteArray [ i ] & 0xFF ; return intArray ; } | Convert a string containing an IP address to an array of 4 or 16 integers . |
40,242 | public static byte [ ] toByteArray ( String s , int family ) { if ( family == IPv4 ) return parseV4 ( s ) ; else if ( family == IPv6 ) return parseV6 ( s ) ; else throw new IllegalArgumentException ( "unknown address family" ) ; } | Convert a string containing an IP address to an array of 4 or 16 bytes . |
40,243 | public static boolean isDottedQuad ( String s ) { byte [ ] address = Address . toByteArray ( s , IPv4 ) ; return ( address != null ) ; } | Determines if a string contains a valid IP address . |
40,244 | public static InetAddress getByName ( String name ) throws UnknownHostException { try { return getByAddress ( name ) ; } catch ( UnknownHostException e ) { Record [ ] records = lookupHostName ( name ) ; return addrFromRecord ( name , records [ 0 ] ) ; } } | Determines the IP address of a host |
40,245 | public static InetAddress [ ] getAllByName ( String name ) throws UnknownHostException { try { InetAddress addr = getByAddress ( name ) ; return new InetAddress [ ] { addr } ; } catch ( UnknownHostException e ) { Record [ ] records = lookupHostName ( name ) ; InetAddress [ ] addrs = new InetAddress [ records . length ] ; for ( int i = 0 ; i < records . length ; i ++ ) addrs [ i ] = addrFromRecord ( name , records [ i ] ) ; return addrs ; } } | Determines all IP address of a host |
40,246 | public static InetAddress getByAddress ( String addr ) throws UnknownHostException { byte [ ] bytes ; bytes = toByteArray ( addr , IPv4 ) ; if ( bytes != null ) return InetAddress . getByAddress ( bytes ) ; bytes = toByteArray ( addr , IPv6 ) ; if ( bytes != null ) return InetAddress . getByAddress ( bytes ) ; throw new UnknownHostException ( "Invalid address: " + addr ) ; } | Converts an address from its string representation to an IP address . The address can be either IPv4 or IPv6 . |
40,247 | public static InetAddress getByAddress ( String addr , int family ) throws UnknownHostException { if ( family != IPv4 && family != IPv6 ) throw new IllegalArgumentException ( "unknown address family" ) ; byte [ ] bytes ; bytes = toByteArray ( addr , family ) ; if ( bytes != null ) return InetAddress . getByAddress ( bytes ) ; throw new UnknownHostException ( "Invalid address: " + addr ) ; } | Converts an address from its string representation to an IP address in a particular family . |
40,248 | public static int familyOf ( InetAddress address ) { if ( address instanceof Inet4Address ) return IPv4 ; if ( address instanceof Inet6Address ) return IPv6 ; throw new IllegalArgumentException ( "unknown address family" ) ; } | Returns the family of an InetAddress . |
40,249 | public static byte [ ] fromString ( String str ) { ByteArrayOutputStream bs = new ByteArrayOutputStream ( ) ; byte [ ] raw = str . getBytes ( ) ; for ( int i = 0 ; i < raw . length ; i ++ ) { if ( ! Character . isWhitespace ( ( char ) raw [ i ] ) ) bs . write ( raw [ i ] ) ; } byte [ ] in = bs . toByteArray ( ) ; if ( in . length % 2 != 0 ) { return null ; } bs . reset ( ) ; DataOutputStream ds = new DataOutputStream ( bs ) ; for ( int i = 0 ; i < in . length ; i += 2 ) { byte high = ( byte ) Base16 . indexOf ( Character . toUpperCase ( ( char ) in [ i ] ) ) ; byte low = ( byte ) Base16 . indexOf ( Character . toUpperCase ( ( char ) in [ i + 1 ] ) ) ; try { ds . writeByte ( ( high << 4 ) + low ) ; } catch ( IOException e ) { } } return bs . toByteArray ( ) ; } | Convert a hex - encoded String to binary data |
40,250 | public void put ( Object o ) throws InterruptedException { synchronized ( lock ) { while ( size == maxSize ) lock . wait ( ) ; elements [ tail ] = o ; if ( ++ tail == maxSize ) tail = 0 ; size ++ ; lock . notify ( ) ; } } | Put object in queue . |
40,251 | public Object get ( ) throws InterruptedException { synchronized ( lock ) { while ( size == 0 ) lock . wait ( ) ; Object o = elements [ head ] ; elements [ head ] = null ; if ( ++ head == maxSize ) head = 0 ; if ( size == maxSize ) lock . notifyAll ( ) ; size -- ; return o ; } } | Get object from queue . Block if there are no objects to get . |
40,252 | public Object peek ( ) throws InterruptedException { synchronized ( lock ) { if ( size == 0 ) lock . wait ( ) ; if ( size == 0 ) return null ; Object o = elements [ head ] ; return o ; } } | Peek at the queue . Block if there are no objects to peek . |
40,253 | public boolean exists ( ) { if ( _exists ) return true ; if ( _urlString . endsWith ( "!/" ) ) { String file_url = _urlString . substring ( 4 , _urlString . length ( ) - 2 ) ; try { return newResource ( file_url ) . exists ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; return false ; } } boolean check = checkConnection ( ) ; if ( _jarUrl != null && _path == null ) { _directory = check ; return true ; } else { JarFile jarFile = null ; if ( check ) jarFile = _jarFile ; else { try { jarFile = ( ( JarURLConnection ) ( ( new URL ( _jarUrl ) ) . openConnection ( ) ) ) . getJarFile ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } } if ( jarFile != null && _entry == null && ! _directory ) { Enumeration e = jarFile . entries ( ) ; while ( e . hasMoreElements ( ) ) { JarEntry entry = ( JarEntry ) e . nextElement ( ) ; String name = entry . getName ( ) . replace ( '\\' , '/' ) ; if ( name . equals ( _path ) ) { _entry = entry ; _directory = _path . endsWith ( "/" ) ; break ; } else if ( _path . endsWith ( "/" ) ) { if ( name . startsWith ( _path ) ) { _directory = true ; break ; } } else if ( name . startsWith ( _path ) && name . length ( ) > _path . length ( ) && name . charAt ( _path . length ( ) ) == '/' ) { _directory = true ; break ; } } } } _exists = ( _directory || _entry != null ) ; return _exists ; } | Returns true if the respresenetd resource exists . |
40,254 | public UserAgentInfo parse ( String useragent ) throws IOException { UserAgentInfo retObj = new UserAgentInfo ( ) ; if ( useragent == null ) { return retObj ; } useragent = useragent . trim ( ) ; checkDataMaps ( ) ; if ( ! processRobot ( useragent , retObj ) ) { boolean osFound = processBrowserRegex ( useragent , retObj ) ; if ( ! osFound ) { processOsRegex ( useragent , retObj ) ; } } return retObj ; } | Parse the given user agent string and returns a UserAgentInfo object with the related data |
40,255 | private void processOsRegex ( String useragent , UserAgentInfo retObj ) { try { lock . lock ( ) ; for ( Map . Entry < Pattern , Long > entry : osRegMap . entrySet ( ) ) { Matcher matcher = entry . getKey ( ) . matcher ( useragent ) ; if ( matcher . find ( ) ) { Long idOs = entry . getValue ( ) ; OsEntry os = osMap . get ( idOs ) ; if ( os != null ) { os . copyTo ( retObj ) ; } break ; } } } finally { lock . unlock ( ) ; } } | Searches in the os regex table . if found a match copies the os data |
40,256 | private boolean processBrowserRegex ( String useragent , UserAgentInfo retObj ) { try { lock . lock ( ) ; boolean osFound = false ; for ( Map . Entry < String , Long > entry : browserRegMap . entrySet ( ) ) { Pattern pattern = Pattern . compile ( entry . getKey ( ) , Pattern . CASE_INSENSITIVE | Pattern . DOTALL ) ; Matcher matcher = pattern . matcher ( useragent ) ; if ( matcher . find ( ) ) { Long idBrowser = entry . getValue ( ) ; copyType ( retObj , idBrowser ) ; BrowserEntry be = browserMap . get ( idBrowser ) ; if ( be != null ) { String browserVersionInfo = null ; if ( matcher . groupCount ( ) > 0 ) { browserVersionInfo = matcher . group ( 1 ) ; } be . copyTo ( retObj , browserVersionInfo ) ; } Long idOs = browserOsMap . get ( idBrowser ) ; if ( idOs != null ) { osFound = true ; OsEntry os = osMap . get ( idOs ) ; if ( os != null ) { os . copyTo ( retObj ) ; } } break ; } } return osFound ; } finally { lock . unlock ( ) ; } } | Searchs in the browser regex table . if found a match copies the browser data and if possible os data |
40,257 | private void copyType ( UserAgentInfo retObj , Long idBrowser ) { try { lock . lock ( ) ; BrowserEntry be = browserMap . get ( idBrowser ) ; if ( be != null ) { Long type = be . getType ( ) ; if ( type != null ) { String typeString = browserTypeMap . get ( type ) ; if ( typeString != null ) { retObj . setTyp ( typeString ) ; } } } } finally { lock . unlock ( ) ; } } | Sets the source type if possible |
40,258 | private boolean processRobot ( String useragent , UserAgentInfo retObj ) { try { lock . lock ( ) ; if ( robotsMap . containsKey ( useragent ) ) { retObj . setTyp ( "Robot" ) ; RobotEntry robotEntry = robotsMap . get ( useragent ) ; robotEntry . copyTo ( retObj ) ; if ( robotEntry . getOsId ( ) != null ) { OsEntry os = osMap . get ( robotEntry . getOsId ( ) ) ; if ( os != null ) { os . copyTo ( retObj ) ; } } return true ; } } finally { lock . unlock ( ) ; } return false ; } | Checks if the useragent comes from a robot . if yes copies all the data to the result object |
40,259 | public synchronized static SSLSocketFactory getTrustingSSLSocketFactory ( ) { if ( socketFactory != null ) return socketFactory ; TrustManager [ ] trustManagers = new TrustManager [ ] { new TrustEverythingSSLTrustManager ( ) } ; SSLContext sc ; try { sc = SSLContext . getInstance ( "SSL" ) ; sc . init ( null , trustManagers , null ) ; } catch ( GeneralSecurityException e ) { throw new RuntimeException ( "This is a BUG in Selenium; please report it" , e ) ; } socketFactory = sc . getSocketFactory ( ) ; return socketFactory ; } | Returns an SSLSocketFactory that will trust all SSL certificates ; this is suitable for passing to HttpsURLConnection either to its instance method setSSLSocketFactory or to its static method setDefaultSSLSocketFactory . |
40,260 | public static void trustAllSSLCertificates ( HttpsURLConnection connection ) { getTrustingSSLSocketFactory ( ) ; connection . setSSLSocketFactory ( socketFactory ) ; connection . setHostnameVerifier ( new HostnameVerifier ( ) { public boolean verify ( String s , SSLSession sslSession ) { return true ; } } ) ; } | Configures a single HttpsURLConnection to trust all SSL certificates . |
40,261 | private void doit ( String [ ] args ) { try { loadParameters ( args ) ; importKeyPair ( ) ; } catch ( Exception e ) { System . out . println ( "Exception: " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; System . exit ( 23 ) ; } } | Load parameters and perform the import command . Catch any exceptions and clear the password arrays . |
40,262 | private PrivateKey loadPrivateKey ( File privateKeyFile ) throws Exception { System . out . println ( "Loading private key from " + privateKeyFile + ", using " + providerClassName + " as the private key loading provider" ) ; FileInputStream privateKeyInputStream = null ; byte [ ] keyBytes ; try { privateKeyInputStream = new FileInputStream ( privateKeyFile ) ; keyBytes = new byte [ ( int ) privateKeyFile . length ( ) ] ; privateKeyInputStream . read ( keyBytes ) ; } finally { IO . close ( privateKeyInputStream ) ; } Class providerClass = Loader . loadClass ( this . getClass ( ) , providerClassName ) ; Provider provider = ( Provider ) providerClass . newInstance ( ) ; Security . insertProviderAt ( provider , 1 ) ; try { PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec ( keyBytes ) ; KeyFactory keyFactory = KeyFactory . getInstance ( "RSA" ) ; PrivateKey privateKey = keyFactory . generatePrivate ( privateKeySpec ) ; System . out . println ( "Loaded " + privateKey . getAlgorithm ( ) + " " + privateKey . getFormat ( ) + " private key." ) ; return privateKey ; } finally { Security . removeProvider ( provider . getName ( ) ) ; } } | Load an RSA private key from the given File |
40,263 | public void setFilename ( String filename ) { if ( filename != null ) { filename = filename . trim ( ) ; if ( filename . length ( ) == 0 ) filename = null ; } _filename = filename ; } | Set the log filename . |
40,264 | protected void logExtended ( HttpRequest request , HttpResponse response , Writer log ) throws IOException { String referer = request . getField ( HttpFields . __Referer ) ; if ( referer == null ) log . write ( "\"-\" " ) ; else { log . write ( '"' ) ; log . write ( referer ) ; log . write ( "\" " ) ; } String agent = request . getField ( HttpFields . __UserAgent ) ; if ( agent == null ) log . write ( "\"-\"" ) ; else { log . write ( '"' ) ; log . write ( agent ) ; log . write ( '"' ) ; } } | Log Extended fields . This method can be extended by a derived class to add extened fields to each log entry . It is called by the log method after all standard fields have been added but before the line terminator . Derived implementations should write extra fields to the Writer provided . The default implementation writes the referer and user agent . |
40,265 | public void setHeaderValue ( String name , String value ) { _fields . put ( name , Collections . singletonList ( value ) ) ; } | Set a header override every response handled will have this header set . |
40,266 | public void setHeaderValues ( String name , String [ ] values ) { _fields . put ( name , Arrays . asList ( values ) ) ; } | Set a multivalued header every response handled will have this header set with the provided values . |
40,267 | public void handle ( String pathInContext , String pathParams , HttpRequest request , HttpResponse response ) throws HttpException , IOException { log . debug ( "SetResponseHeadersHandler.handle()" ) ; for ( Iterator iterator = _fields . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String name = ( String ) entry . getKey ( ) ; List values = ( List ) entry . getValue ( ) ; response . setField ( name , values ) ; } } | Handle a request by pre - populating the headers from the configured set of _fields . |
40,268 | private Socket createSimulatedSocket ( SSLSocket socket ) { SimulatedSocketFactory . configure ( socket ) ; socket . setEnabledProtocols ( new String [ ] { SSLAlgorithm . SSLv3 . name ( ) , SSLAlgorithm . TLSv1 . name ( ) } ) ; return new SimulatedSSLSocket ( socket , streamManager ) ; } | just an helper function to wrap a normal sslSocket into a simulated one so we can do throttling |
40,269 | protected synchronized void checkDataMaps ( ) throws IOException { if ( lastUpdateCheck == 0 || lastUpdateCheck < System . currentTimeMillis ( ) - updateInterval ) { String versionOnServer = getVersionFromServer ( ) ; if ( currentVersion == null || versionOnServer . compareTo ( currentVersion ) > 0 ) { loadDataFromInternetAndSave ( ) ; loadDataFromFile ( getCacheFile ( ) ) ; currentVersion = versionOnServer ; prop . setProperty ( "currentVersion" , currentVersion ) ; } lastUpdateCheck = System . currentTimeMillis ( ) ; prop . setProperty ( "lastUpdateCheck" , Long . toString ( lastUpdateCheck ) ) ; saveProperties ( prop ) ; } } | This implementation uses a local properties file to keep the lastUpdate time and the local data file version |
40,270 | private void loadDataFromInternetAndSave ( ) throws IOException { InputStream is = null ; FileOutputStream fos = null ; try { URL url = new URL ( DATA_RETRIVE_URL ) ; is = url . openStream ( ) ; fos = new FileOutputStream ( getCacheFile ( ) ) ; byte [ ] buff = new byte [ 1024 * 8 ] ; int len = 0 ; while ( ( len = is . read ( buff ) ) != - 1 ) { fos . write ( buff , 0 , len ) ; } } finally { if ( is != null ) { is . close ( ) ; } if ( fos != null ) { fos . close ( ) ; } } } | loads the data file from the server and saves it to the local file system |
40,271 | private void saveProperties ( Properties prop ) throws FileNotFoundException , IOException { FileOutputStream fos = new FileOutputStream ( getPropertiesFile ( ) ) ; try { prop . store ( fos , null ) ; } finally { fos . close ( ) ; } } | Saves the properties file to the local filesystem |
40,272 | public synchronized void setInetAddrPort ( InetAddrPort address ) { if ( _address != null && _address . equals ( address ) ) return ; if ( isStarted ( ) ) log . warn ( this + " is started" ) ; _address = address ; } | Set the server InetAddress and port . |
40,273 | public void open ( ) throws IOException { if ( _listen == null ) { _listen = newServerSocket ( _address , _acceptQueueSize ) ; if ( _address == null ) _address = new InetAddrPort ( _listen . getInetAddress ( ) , _listen . getLocalPort ( ) ) ; else { if ( _address . getInetAddress ( ) == null ) _address . setInetAddress ( _listen . getInetAddress ( ) ) ; if ( _address . getPort ( ) == 0 ) _address . setPort ( _listen . getLocalPort ( ) ) ; } _soTimeOut = getMaxIdleTimeMs ( ) ; if ( _soTimeOut >= 0 ) _listen . setSoTimeout ( _soTimeOut ) ; } } | Open the server socket . This method can be called to open the server socket in advance of starting the listener . This can be used to test if the port is available . |
40,274 | protected void stopJob ( Thread thread , Object job ) { if ( job instanceof Socket ) { try { ( ( Socket ) job ) . close ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } } super . stopJob ( thread , job ) ; } | Kill a job . This method closes IDLE and socket associated with a job |
40,275 | public Object getValue ( Object name , int i ) { Object l = super . get ( name ) ; if ( i == 0 && LazyList . size ( l ) == 0 ) return null ; return LazyList . get ( l , i ) ; } | Get a value from a multiple value . If the value is not a multivalue then index 0 retrieves the value or null . |
40,276 | public Object put ( Object name , Object value ) { return super . put ( name , LazyList . add ( null , value ) ) ; } | Put and entry into the map . |
40,277 | public void putAll ( Map m ) { Iterator i = m . entrySet ( ) . iterator ( ) ; boolean multi = m instanceof MultiMap ; while ( i . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; if ( multi ) super . put ( entry . getKey ( ) , LazyList . clone ( entry . getValue ( ) ) ) ; else put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } | Put all contents of map . |
40,278 | public static byte [ ] fromDNS ( byte [ ] sig ) { final int len = 20 ; int n = 0 ; byte rlen , slen , seqlen ; rlen = len ; if ( sig [ 1 ] < 0 ) rlen ++ ; slen = len ; if ( sig [ len + 1 ] < 0 ) slen ++ ; seqlen = ( byte ) ( rlen + slen + 4 ) ; byte [ ] array = new byte [ seqlen + 2 ] ; array [ n ++ ] = ASN1_SEQ ; array [ n ++ ] = ( byte ) seqlen ; array [ n ++ ] = ASN1_INT ; array [ n ++ ] = rlen ; if ( rlen > len ) array [ n ++ ] = 0 ; for ( int i = 0 ; i < len ; i ++ , n ++ ) array [ n ] = sig [ 1 + i ] ; array [ n ++ ] = ASN1_INT ; array [ n ++ ] = slen ; if ( slen > len ) array [ n ++ ] = 0 ; for ( int i = 0 ; i < len ; i ++ , n ++ ) array [ n ] = sig [ 1 + len + i ] ; return array ; } | Converts the signature field in a SIG record to the format expected by the DSA verification routines . |
40,279 | public void setBufferSize ( int size ) throws IllegalStateException { if ( size <= _bufferSize ) return ; if ( _bufferedOut != null && _bufferedOut . size ( ) > 0 ) throw new IllegalStateException ( "Not Reset" ) ; try { _bufferSize = size ; if ( _bufferedOut != null ) { boolean fixed = _bufferedOut . isFixed ( ) ; _bufferedOut . setFixed ( false ) ; _bufferedOut . ensureSize ( size ) ; _bufferedOut . setFixed ( fixed ) ; } } catch ( IOException e ) { log . warn ( LogSupport . EXCEPTION , e ) ; } } | Set the output buffer size . Note that this is the minimal buffer size and that installed filters may perform their own buffering and are likely to change the size of the output . Also the pre and post reserve buffers may be allocated within the buffer for headers and chunking . |
40,280 | public void resetBuffer ( ) throws IllegalStateException { if ( _out != null && _out != _realOut ) { ArrayList save_observers = _observers ; _observers = null ; _nulled = true ; try { if ( _bufferedOut != null ) { _bufferedOut . resetStream ( ) ; if ( _bufferedOut instanceof ChunkingOutputStream ) ( ( ChunkingOutputStream ) _bufferedOut ) . setChunking ( false ) ; } } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } finally { _observers = save_observers ; } } _contentLength = - 1 ; _nulled = false ; _bytes = 0 ; _written = false ; _out = _realOut ; try { notify ( OutputObserver . __RESET_BUFFER ) ; } catch ( IOException e ) { LogSupport . ignore ( log , e ) ; } } | Reset Buffered output . If no data has been committed the buffer output is discarded and the filters may be reinitialized . |
40,281 | public void setChunking ( ) { checkOutput ( ) ; if ( _bufferedOut instanceof ChunkingOutputStream ) ( ( ChunkingOutputStream ) _bufferedOut ) . setChunking ( true ) ; else throw new IllegalStateException ( _bufferedOut . getClass ( ) . toString ( ) ) ; } | Set chunking mode . |
40,282 | public void resetStream ( ) throws IOException , IllegalStateException { if ( isChunking ( ) ) close ( ) ; _out = null ; _nulled = true ; if ( _bufferedOut != null ) { _bufferedOut . resetStream ( ) ; if ( _bufferedOut instanceof ChunkingOutputStream ) ( ( ChunkingOutputStream ) _bufferedOut ) . setChunking ( false ) ; } if ( _iso8859writer != null ) _iso8859writer . flush ( ) ; if ( _utf8writer != null ) _utf8writer . flush ( ) ; if ( _asciiwriter != null ) _asciiwriter . flush ( ) ; _bytes = 0 ; _written = false ; _out = _realOut ; _closing = false ; _contentLength = - 1 ; _nulled = false ; if ( _observers != null ) _observers . clear ( ) ; } | Reset the stream . Turn disable all filters . |
40,283 | public void handle ( String pathInContext , String pathParams , HttpRequest request , HttpResponse response ) throws HttpException , IOException { if ( request . getAttribute ( "javax.servlet.error.status_code" ) != null ) return ; try { String ip = request . getRemoteAddr ( ) ; boolean authorized = checkIP ( ip ) ; if ( ! authorized ) { response . sendError ( HttpResponse . __403_Forbidden ) ; request . setHandled ( true ) ; return ; } else { return ; } } catch ( Exception ex ) { System . out . println ( ex ) ; response . sendError ( HttpResponse . __500_Internal_Server_Error ) ; request . setHandled ( true ) ; } } | Handles the incoming request |
40,284 | public void setStandard ( String s ) { s = s . toLowerCase ( ) ; if ( s . indexOf ( "allow" ) > - 1 ) { standard = true ; } else { standard = false ; } } | Set the standard action beeing taken when not registred IPs wants access |
40,285 | private static void main ( String [ ] args ) { IPAccessHandler ipah = new IPAccessHandler ( ) ; ipah . setStandard ( "deny" ) ; ipah . setAllowIP ( "217.215.71.167" ) ; ipah . setDenyIP ( "217.215.71.149" ) ; System . out . println ( ipah . checkIP ( "217.215.71.245" ) + " = false" ) ; System . out . println ( ipah . checkIP ( "217.215.71.167" ) + " = true" ) ; System . out . println ( ipah . checkIP ( "217.215.71.149" ) + " = false" ) ; System . out . println ( ipah . checkIP ( "0.0.0.0" ) + " = false" ) ; IPAccessHandler ipah2 = new IPAccessHandler ( ) ; ipah2 . setStandard ( "allow" ) ; ipah2 . setAllowIP ( "217.215.71.167" ) ; ipah2 . setDenyIP ( "217.215.71.149" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.245" ) + " = true" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.167" ) + " = true" ) ; System . out . println ( ipah2 . checkIP ( "217.215.71.149" ) + " = false" ) ; System . out . println ( ipah2 . checkIP ( "0.0.0.0" ) + " = true" ) ; } | Main method for testing & debugging . |
40,286 | void setServletPaths ( String servletPath , String pathInfo , ServletHolder holder ) { _servletPath = servletPath ; _pathInfo = pathInfo ; _servletHolder = holder ; } | Set servletpath and pathInfo . Called by the Handler before passing a request to a particular holder to split the context path into a servlet path and path info . |
40,287 | public static ServletHttpRequest unwrap ( ServletRequest request ) { while ( ! ( request instanceof ServletHttpRequest ) ) { if ( request instanceof ServletRequestWrapper ) { ServletRequestWrapper wrapper = ( ServletRequestWrapper ) request ; request = wrapper . getRequest ( ) ; } else throw new IllegalArgumentException ( "Does not wrap ServletHttpRequest" ) ; } return ( ServletHttpRequest ) request ; } | Unwrap a ServletRequest . |
40,288 | public String getTimeStampStr ( ) { if ( _timeStampStr == null && _timeStamp > 0 ) _timeStampStr = HttpFields . __dateCache . format ( _timeStamp ) ; return _timeStampStr ; } | Get Request TimeStamp |
40,289 | public boolean isHandled ( ) { if ( _handled ) return true ; HttpResponse response = getHttpResponse ( ) ; return ( response != null && response . getState ( ) != HttpMessage . __MSG_EDITABLE ) ; } | Is the request handled . |
40,290 | public void readHeader ( LineInput in ) throws IOException { _state = __MSG_BAD ; org . browsermob . proxy . jetty . util . LineInput . LineBuffer line_buffer ; do { line_buffer = in . readLineBuffer ( ) ; if ( line_buffer == null ) throw new EOFException ( ) ; } while ( line_buffer . size == 0 ) ; if ( line_buffer . size >= __maxLineLength ) throw new HttpException ( HttpResponse . __414_Request_URI_Too_Large ) ; decodeRequestLine ( line_buffer . buffer , line_buffer . size ) ; _timeStamp = System . currentTimeMillis ( ) ; if ( __HTTP_1_1 . equals ( _version ) ) { _dotVersion = 1 ; _version = __HTTP_1_1 ; _header . read ( in ) ; updateMimeType ( ) ; } else if ( __HTTP_0_9 . equals ( _version ) ) { _dotVersion = - 1 ; _version = __HTTP_0_9 ; } else { _dotVersion = 0 ; _version = __HTTP_1_0 ; _header . read ( in ) ; updateMimeType ( ) ; } _handled = false ; _state = __MSG_RECEIVED ; } | Read the request line and header . |
40,291 | public void writeRequestLine ( Writer writer ) throws IOException { writer . write ( _method ) ; writer . write ( ' ' ) ; writer . write ( _uri != null ? _uri . toString ( ) : "null" ) ; writer . write ( ' ' ) ; writer . write ( _version ) ; } | Write the HTTP request line as it was received . |
40,292 | public String getScheme ( ) { String scheme = _uri . getScheme ( ) ; if ( scheme == null && _connection != null ) scheme = _connection . getDefaultScheme ( ) ; return scheme == null ? "http" : scheme ; } | Get the request Scheme . The scheme is obtained from an absolute URI . If the URI in the request is not absolute then the connections default scheme is returned . If there is no connection http is returned . |
40,293 | public String getHost ( ) { if ( _host != null ) return _host ; _host = _uri . getHost ( ) ; _port = _uri . getPort ( ) ; if ( _host != null ) return _host ; _hostPort = _header . get ( HttpFields . __Host ) ; _host = _hostPort ; _port = 0 ; if ( _host != null && _host . length ( ) > 0 ) { int colon = _host . lastIndexOf ( ':' ) ; if ( colon >= 0 ) { if ( colon < _host . length ( ) ) { try { _port = TypeUtil . parseInt ( _host , colon + 1 , - 1 , 10 ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } } _host = _host . substring ( 0 , colon ) ; } return _host ; } if ( _connection != null ) { _host = _connection . getServerName ( ) ; _port = _connection . getServerPort ( ) ; if ( _host != null && ! InetAddrPort . __0_0_0_0 . equals ( _host ) ) return _host ; } try { _host = InetAddress . getLocalHost ( ) . getHostAddress ( ) ; } catch ( java . net . UnknownHostException e ) { LogSupport . ignore ( log , e ) ; } return _host ; } | Get the request host . |
40,294 | public int getPort ( ) { if ( _port > 0 ) return _port ; if ( _host != null ) return 0 ; if ( _uri . isAbsolute ( ) ) _port = _uri . getPort ( ) ; else if ( _connection != null ) _port = _connection . getServerPort ( ) ; return _port ; } | Get the request port . The port is obtained either from an absolute URI the HTTP Host header field the connection or the default . |
40,295 | Object forceRemoveField ( String name ) { int saved_state = _state ; try { _state = __MSG_EDITABLE ; return removeField ( name ) ; } finally { _state = saved_state ; } } | Force a removeField . This call ignores the message state and forces a field to be removed from the request . It is required for the handling of the Connection field . |
40,296 | public List getAcceptableTransferCodings ( ) { if ( _dotVersion < 1 ) return null ; if ( _te != null ) return _te ; Enumeration tenum = getFieldValues ( HttpFields . __TE , HttpFields . __separators ) ; if ( tenum != null ) { List te = HttpFields . qualityList ( tenum ) ; int size = te . size ( ) ; if ( size > 0 ) { Object acceptable = null ; ListIterator iter = te . listIterator ( ) ; while ( iter . hasNext ( ) ) { String coding = StringUtil . asciiToLowerCase ( HttpFields . valueParameters ( iter . next ( ) . toString ( ) , null ) ) ; if ( ! HttpFields . __Chunked . equalsIgnoreCase ( coding ) ) { acceptable = LazyList . ensureSize ( acceptable , size ) ; acceptable = LazyList . add ( acceptable , coding ) ; } } _te = LazyList . getList ( acceptable ) ; } else _te = Collections . EMPTY_LIST ; } else _te = Collections . EMPTY_LIST ; return _te ; } | Get the acceptable transfer encodings . The TE field is used to construct a list of acceptable extension transfer codings in quality order . An empty list implies that only chunked is acceptable . A null list implies that no transfer coding can be applied . |
40,297 | public String getParameter ( String name ) { if ( ! _paramsExtracted ) extractParameters ( ) ; return ( String ) _parameters . getValue ( name , 0 ) ; } | Get a parameter value . |
40,298 | void recycle ( HttpConnection connection ) { _method = null ; _host = null ; _hostPort = null ; _port = 0 ; _te = null ; if ( _parameters != null ) _parameters . clear ( ) ; _paramsExtracted = false ; _handled = false ; _cookiesExtracted = false ; _timeStamp = 0 ; _timeStampStr = null ; _authUser = null ; _authType = null ; _userPrincipal = null ; super . recycle ( connection ) ; } | Recycle the request . |
40,299 | public void destroy ( ) { _parameters = null ; _method = null ; _uri = null ; _host = null ; _hostPort = null ; _te = null ; _cookies = null ; _lastCookies = null ; _timeStampStr = null ; _userPrincipal = null ; _authUser = null ; _authUser = null ; if ( _attributes != null ) _attributes . clear ( ) ; super . destroy ( ) ; } | Destroy the request . Help the garbage collector by null everything that we can . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.