idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
10,300 | public static Object proprietaryEvaluate ( final String expression , final Class < ? > expectedType , final PageContext pageContext , final ProtectedFunctionMapper functionMap ) throws ELException { return "" ; } | directly referenced by JSPC - generated code |
10,301 | protected void loadConfiguredSinks ( String filename , String bugType ) { SINKS_LOADER . loadConfiguredSinks ( filename , bugType , new SinksLoader . InjectionPointReceiver ( ) { public void receiveInjectionPoint ( String fullMethodName , InjectionPoint injectionPoint ) { addParsedInjectionPoint ( fullMethodName , inje... | Loads taint sinks from configuration |
10,302 | protected void loadCustomSinks ( String fileName , String bugType ) { InputStream stream = null ; try { File file = new File ( fileName ) ; if ( file . exists ( ) ) { stream = new FileInputStream ( file ) ; loadConfiguredSinks ( stream , bugType ) ; } else { stream = getClass ( ) . getClassLoader ( ) . getResourceAsStr... | Loads taint sinks configuration file from file system . If the file doesn t exist on file system loads the file from classpath . |
10,303 | public DeploymentInfo addFirstAuthenticationMechanism ( final String name , final AuthenticationMechanism mechanism ) { authenticationMechanisms . put ( name , new ImmediateAuthenticationMechanismFactory ( mechanism ) ) ; if ( loginConfig == null ) { loginConfig = new LoginConfig ( null ) ; } loginConfig . addFirstAuth... | Adds an authentication mechanism directly to the deployment . This mechanism will be first in the list . |
10,304 | public DeploymentInfo addLastAuthenticationMechanism ( final String name , final AuthenticationMechanism mechanism ) { authenticationMechanisms . put ( name , new ImmediateAuthenticationMechanismFactory ( mechanism ) ) ; if ( loginConfig == null ) { loginConfig = new LoginConfig ( null ) ; } loginConfig . addLastAuthMe... | Adds an authentication mechanism directly to the deployment . This mechanism will be last in the list . |
10,305 | public DeploymentInfo addAuthenticationMechanism ( final String name , final AuthenticationMechanismFactory factory ) { authenticationMechanisms . put ( name . toUpperCase ( Locale . US ) , factory ) ; return this ; } | Adds an authentication mechanism . The name is case insenstive and will be converted to uppercase internally . |
10,306 | public boolean isAuthenticationMechanismPresent ( final String mechanismName ) { if ( loginConfig != null ) { for ( AuthMethodConfig method : loginConfig . getAuthMethods ( ) ) { if ( method . getName ( ) . equalsIgnoreCase ( mechanismName ) ) { return true ; } } } return false ; } | Returns true if the specified mechanism is present in the login config |
10,307 | public DeploymentInfo addPreCompressedResourceEncoding ( String encoding , String extension ) { preCompressedResources . put ( encoding , extension ) ; return this ; } | Adds a pre compressed resource encoding and maps it to a file extension |
10,308 | public static ServletContainer defaultContainer ( ) { if ( container != null ) { return container ; } synchronized ( Servlets . class ) { if ( container != null ) { return container ; } return container = ServletContainer . Factory . newInstance ( ) ; } } | Returns the default servlet container . For most embedded use cases this will be sufficient . |
10,309 | public static ServletInfo servlet ( final String name , final Class < ? extends Servlet > servletClass , final InstanceFactory < ? extends Servlet > servlet ) { return new ServletInfo ( name , servletClass , servlet ) ; } | Creates a new servlet description with the given name and class |
10,310 | public static FilterInfo filter ( final String name , final Class < ? extends Filter > filterClass ) { return new FilterInfo ( name , filterClass ) ; } | Creates a new filter description with the given name and class |
10,311 | public static MultipartConfigElement multipartConfig ( String location , long maxFileSize , long maxRequestSize , int fileSizeThreshold ) { return new MultipartConfigElement ( location , maxFileSize , maxRequestSize , fileSizeThreshold ) ; } | Creates a new multipart config element |
10,312 | public static ErrorPage errorPage ( String location , Class < ? extends Throwable > exceptionType ) { return new ErrorPage ( location , exceptionType ) ; } | Create an ErrorPage instance for a given exception type |
10,313 | private long doWrap ( ByteBuffer [ ] userBuffers , int off , int len ) throws IOException { if ( anyAreSet ( state , FLAG_CLOSED ) ) { throw new ClosedChannelException ( ) ; } if ( outstandingTasks > 0 ) { return 0 ; } if ( anyAreSet ( state , FLAG_WRITE_REQUIRES_READ ) ) { doUnwrap ( null , 0 , 0 ) ; if ( allAreClear ... | Wraps the user data and attempts to send it to the remote client . If data has already been buffered then this is attempted to be sent first . |
10,314 | private void runTasks ( ) { delegate . getSinkChannel ( ) . suspendWrites ( ) ; delegate . getSourceChannel ( ) . suspendReads ( ) ; List < Runnable > tasks = new ArrayList < > ( ) ; Runnable t = engine . getDelegatedTask ( ) ; while ( t != null ) { tasks . add ( t ) ; t = engine . getDelegatedTask ( ) ; } synchronized... | Execute all the tasks in the worker |
10,315 | public int setMaximumConcurrentRequests ( int newMax ) { if ( newMax < 1 ) { throw new IllegalArgumentException ( "Maximum concurrent requests must be at least 1" ) ; } int oldMax = this . max ; this . max = newMax ; if ( newMax > oldMax ) { synchronized ( this ) { while ( ! queue . isEmpty ( ) ) { int oldVal , newVal ... | Set the maximum concurrent requests . The value must be greater than or equal to one . |
10,316 | private ArrayList < E > toArrayList ( ) { ArrayList < E > list = new ArrayList < > ( ) ; for ( Node < E > p = first ( ) ; p != null ; p = succ ( p ) ) { E item = p . item ; if ( item != null ) list . add ( item ) ; } return list ; } | Creates an array list and fills it with elements of this list . Used by toArray . |
10,317 | public static String toExtensionHeader ( final List < WebSocketExtension > extensions ) { StringBuilder extensionsHeader = new StringBuilder ( ) ; if ( extensions != null && extensions . size ( ) > 0 ) { Iterator < WebSocketExtension > it = extensions . iterator ( ) ; while ( it . hasNext ( ) ) { WebSocketExtension ext... | Compose a String from a list of extensions to be used in the response of a protocol negotiation . |
10,318 | public void restoreChannel ( final ConduitState state ) { channel . getSinkChannel ( ) . setConduit ( state . sink ) ; channel . getSourceChannel ( ) . setConduit ( state . source ) ; } | Restores the channel conduits to a previous state . |
10,319 | protected void handleRequest ( final HttpString method , HttpServerExchange exchange ) throws Exception { final RequestData requestData = parseFormData ( exchange ) ; boolean persistent = exchange . isPersistent ( ) ; exchange . setPersistent ( false ) ; if ( CONFIG . equals ( method ) ) { processConfig ( exchange , re... | Handle a management + request . |
10,320 | void processCommand ( final HttpServerExchange exchange , final RequestData requestData , final MCMPAction action ) throws IOException { if ( exchange . getRequestPath ( ) . equals ( "*" ) || exchange . getRequestPath ( ) . endsWith ( "/*" ) ) { processNodeCommand ( exchange , requestData , action ) ; } else { processA... | Process a mod_cluster mgmt command . |
10,321 | void processNodeCommand ( final HttpServerExchange exchange , final RequestData requestData , final MCMPAction action ) throws IOException { final String jvmRoute = requestData . getFirst ( JVMROUTE ) ; if ( jvmRoute == null ) { processError ( TYPESYNTAX , SMISFLD , exchange ) ; return ; } if ( processNodeCommand ( jvm... | Process a mgmt command targeting a node . |
10,322 | void processAppCommand ( final HttpServerExchange exchange , final RequestData requestData , final MCMPAction action ) throws IOException { final String contextPath = requestData . getFirst ( CONTEXT ) ; final String jvmRoute = requestData . getFirst ( JVMROUTE ) ; final String aliases = requestData . getFirst ( ALIAS ... | Process a command targeting an application . |
10,323 | void processStatus ( final HttpServerExchange exchange , final RequestData requestData ) throws IOException { final String jvmRoute = requestData . getFirst ( JVMROUTE ) ; final String loadValue = requestData . getFirst ( LOAD ) ; if ( loadValue == null || jvmRoute == null ) { processError ( TYPESYNTAX , SMISFLD , exch... | Process the status request . |
10,324 | void processPing ( final HttpServerExchange exchange , final RequestData requestData ) throws IOException { final String jvmRoute = requestData . getFirst ( JVMROUTE ) ; final String scheme = requestData . getFirst ( SCHEME ) ; final String host = requestData . getFirst ( HOST ) ; final String port = requestData . getF... | Process the ping request . |
10,325 | protected void checkHostUp ( final String scheme , final String host , final int port , final HttpServerExchange exchange , final NodePingUtil . PingCallback callback ) { final XnioSsl xnioSsl = null ; final OptionMap options = OptionMap . builder ( ) . set ( Options . TCP_NODELAY , true ) . getMap ( ) ; try { if ( "aj... | Check whether a host is up . |
10,326 | static void sendResponse ( final HttpServerExchange exchange , final String response ) { exchange . setStatusCode ( StatusCodes . OK ) ; exchange . getResponseHeaders ( ) . add ( Headers . CONTENT_TYPE , CONTENT_TYPE ) ; final Sender sender = exchange . getResponseSender ( ) ; UndertowLogger . ROOT_LOGGER . mcmpSending... | Send a simple response string . |
10,327 | static void processOK ( HttpServerExchange exchange ) throws IOException { exchange . setStatusCode ( StatusCodes . OK ) ; exchange . getResponseHeaders ( ) . add ( Headers . CONTENT_TYPE , CONTENT_TYPE ) ; exchange . endExchange ( ) ; } | If the process is OK then add 200 HTTP status and its OK phrase |
10,328 | static void processError ( String type , String errString , HttpServerExchange exchange ) { exchange . setStatusCode ( StatusCodes . INTERNAL_SERVER_ERROR ) ; exchange . getResponseHeaders ( ) . add ( Headers . CONTENT_TYPE , CONTENT_TYPE ) ; exchange . getResponseHeaders ( ) . add ( new HttpString ( "Version" ) , VERS... | Send an error message . |
10,329 | RequestData parseFormData ( final HttpServerExchange exchange ) throws IOException { final FormDataParser parser = parserFactory . createParser ( exchange ) ; final FormData formData = parser . parseBlocking ( ) ; final RequestData data = new RequestData ( ) ; for ( String name : formData ) { final HttpString key = new... | Transform the form data into an intermediate request data which can me used by the web manager |
10,330 | public static ConnectionBuilder connectionBuilder ( XnioWorker worker , ByteBufferPool bufferPool , URI uri ) { return new ConnectionBuilder ( worker , bufferPool , uri ) ; } | Creates a new connection builder that can be used to create a web socket connection . |
10,331 | public CharSequence evaluate ( CharSequence url , Resolver resolver ) { Pattern pattern = this . pattern . get ( ) ; if ( pattern == null ) { int flags = 0 ; if ( isNocase ( ) ) { flags |= Pattern . CASE_INSENSITIVE ; } pattern = Pattern . compile ( patternString , flags ) ; this . pattern . set ( pattern ) ; } Matcher... | Evaluate the rule based on the context |
10,332 | void rstStream ( ) { if ( reset ) { return ; } reset = true ; if ( ! isReadyForFlush ( ) ) { IoUtils . safeClose ( this ) ; } getChannel ( ) . removeStreamSink ( getStreamId ( ) ) ; } | Method that is invoked when the stream is reset . |
10,333 | public HttpSessionImpl getSession ( final String sessionId ) { final SessionManager sessionManager = deployment . getSessionManager ( ) ; Session session = sessionManager . getSession ( sessionId ) ; if ( session != null ) { return SecurityActions . forSession ( session , this , false ) ; } return null ; } | Gets the session with the specified ID if it exists |
10,334 | public PooledByteBuffer allocate ( ) { final Queue < Slice > sliceQueue = this . sliceQueue ; final Slice slice = sliceQueue . poll ( ) ; if ( slice == null && ( maxRegions <= 0 || regionUpdater . getAndIncrement ( this ) < maxRegions ) ) { final int bufferSize = this . bufferSize ; final int buffersPerRegion = this . ... | Allocates a new byte buffer if possible |
10,335 | public final void handshake ( final WebSocketHttpExchange exchange ) { exchange . putAttachment ( WebSocketVersion . ATTACHMENT_KEY , version ) ; handshakeInternal ( exchange ) ; } | Issue the WebSocket upgrade |
10,336 | protected final void performUpgrade ( final WebSocketHttpExchange exchange , final byte [ ] data ) { exchange . setResponseHeader ( Headers . CONTENT_LENGTH_STRING , String . valueOf ( data . length ) ) ; exchange . setResponseHeader ( Headers . UPGRADE_STRING , "WebSocket" ) ; exchange . setResponseHeader ( Headers . ... | convenience method to perform the upgrade |
10,337 | protected final void selectSubprotocol ( final WebSocketHttpExchange exchange ) { String requestedSubprotocols = exchange . getRequestHeader ( Headers . SEC_WEB_SOCKET_PROTOCOL_STRING ) ; if ( requestedSubprotocols == null ) { return ; } String [ ] requestedSubprotocolArray = PATTERN . split ( requestedSubprotocols ) ;... | Selects the first matching supported sub protocol and add it the the headers of the exchange . |
10,338 | public static List < List < QValueResult > > parse ( List < String > headers ) { final List < QValueResult > found = new ArrayList < > ( ) ; QValueResult current = null ; for ( final String header : headers ) { final int l = header . length ( ) ; int stringStart = 0 ; for ( int i = 0 ; i < l ; ++ i ) { char c = header ... | Parses a set of headers that take q values to determine the most preferred one . |
10,339 | protected void queueFrame ( FrameCallBack callback , ByteBuffer ... data ) { queuedData += Buffers . remaining ( data ) ; bufferCount += data . length ; frameQueue . add ( new Frame ( callback , data , 0 , data . length ) ) ; } | Queues a frame for sending . |
10,340 | public int compareTo ( final HttpString other ) { if ( orderInt != 0 && other . orderInt != 0 ) { return signum ( orderInt - other . orderInt ) ; } final int len = Math . min ( bytes . length , other . bytes . length ) ; int res ; for ( int i = 0 ; i < len ; i ++ ) { res = signum ( higher ( bytes [ i ] ) - higher ( oth... | Compare this string to another in a case - insensitive manner . |
10,341 | public String evaluate ( Matcher rule , Matcher cond , Resolver resolver ) { StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { buf . append ( elements [ i ] . evaluate ( rule , cond , resolver ) ) ; } return buf . toString ( ) ; } | Evaluate the substitution based on the context |
10,342 | public void invokeEndpointMethod ( final Runnable invocation ) { try { invokeEndpointTask . call ( null , invocation ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | Directly invokes an endpoint method without dispatching to an executor |
10,343 | public synchronized void pause ( PauseListener listener ) { closed = true ; if ( configuredServerEndpoints . isEmpty ( ) ) { listener . paused ( ) ; return ; } if ( listener != null ) { pauseListeners . add ( listener ) ; } for ( ConfiguredServerEndpoint endpoint : configuredServerEndpoints ) { for ( final Session sess... | Pauses the container |
10,344 | public synchronized void resume ( ) { closed = false ; for ( PauseListener p : pauseListeners ) { p . resumed ( ) ; } pauseListeners . clear ( ) ; } | resumes a paused container |
10,345 | public String encodeRedirectURL ( String url ) { if ( isEncodeable ( toAbsolute ( url ) ) ) { return originalServletContext . getSessionConfig ( ) . rewriteUrl ( url , servletContext . getSession ( originalServletContext , exchange , true ) . getId ( ) ) ; } else { return url ; } } | Encode the session identifier associated with this response into the specified redirect URL if necessary . |
10,346 | public static boolean checkOrigin ( ServerEndpointConfig config , WebSocketHttpExchange exchange ) { ServerEndpointConfig . Configurator c = config . getConfigurator ( ) ; return c . checkOrigin ( exchange . getRequestHeader ( Headers . ORIGIN_STRING ) ) ; } | Checks the orgin against the |
10,347 | public static void prepareUpgrade ( final ServerEndpointConfig config , final WebSocketHttpExchange exchange ) { ExchangeHandshakeRequest request = new ExchangeHandshakeRequest ( exchange ) ; ExchangeHandshakeResponse response = new ExchangeHandshakeResponse ( exchange ) ; ServerEndpointConfig . Configurator c = config... | Prepare for upgrade |
10,348 | synchronized boolean update ( ) { int elected = this . elected ; int oldelected = this . oldelected ; int lbfactor = this . lbfactor ; if ( lbfactor > 0 ) { this . lbstatus = ( ( elected - oldelected ) * 1000 ) / lbfactor ; } this . oldelected = elected ; return elected != oldelected ; } | Update the load balancing status . |
10,349 | void handleRequest ( final ModClusterProxyTarget target , final HttpServerExchange exchange , final ProxyCallback < ProxyConnection > callback , long timeout , TimeUnit timeUnit , boolean exclusive ) { if ( addRequest ( ) ) { exchange . addExchangeCompleteListener ( new ExchangeCompletionListener ( ) { public void exch... | Handle a proxy request for this context . |
10,350 | public static ByteRange parse ( String rangeHeader ) { if ( rangeHeader == null || rangeHeader . length ( ) < 7 ) { return null ; } if ( ! rangeHeader . startsWith ( "bytes=" ) ) { return null ; } List < Range > ranges = new ArrayList < > ( ) ; String [ ] parts = rangeHeader . substring ( 6 ) . split ( "," ) ; for ( St... | Attempts to parse a range request . If the range request is invalid it will just return null so that it may be ignored . |
10,351 | public RangeResponseResult getResponseResult ( final long resourceContentLength , String ifRange , Date lastModified , String eTag ) { if ( ranges . isEmpty ( ) ) { return null ; } long start = getStart ( 0 ) ; long end = getEnd ( 0 ) ; long rangeLength ; if ( ifRange != null && ! ifRange . isEmpty ( ) ) { if ( ifRange... | Returns a representation of the range result . If this returns null then a 200 response should be sent instead |
10,352 | public int getLoad ( ) { final int status = this . state ; if ( anyAreSet ( status , ERROR ) ) { return - 1 ; } else if ( anyAreSet ( status , HOT_STANDBY ) ) { return 0 ; } else { return lbStatus . getLbFactor ( ) ; } } | Get the load information . Add the error information for clients . |
10,353 | protected void checkHealth ( long threshold , NodeHealthChecker healthChecker ) { final int state = this . state ; if ( anyAreSet ( state , REMOVED | ACTIVE_PING ) ) { return ; } healthCheckPing ( threshold , healthChecker ) ; } | Check the health of the node and try to ping it if necessary . |
10,354 | void ping ( final HttpServerExchange exchange , final NodePingUtil . PingCallback callback ) { NodePingUtil . pingNode ( this , exchange , callback ) ; } | Async ping from the user |
10,355 | Context registerContext ( final String path , final List < String > virtualHosts ) { VHostMapping host = null ; for ( final VHostMapping vhost : vHosts ) { if ( virtualHosts . equals ( vhost . getAliases ( ) ) ) { host = vhost ; break ; } } if ( host == null ) { host = new VHostMapping ( this , virtualHosts ) ; vHosts ... | Register a context . |
10,356 | Context getContext ( final String path , List < String > aliases ) { VHostMapping host = null ; for ( final VHostMapping vhost : vHosts ) { if ( aliases . equals ( vhost . getAliases ( ) ) ) { host = vhost ; break ; } } if ( host == null ) { return null ; } for ( final Context context : contexts ) { if ( context . getP... | Get a context . |
10,357 | private int healthCheckFailed ( ) { int oldState , newState ; for ( ; ; ) { oldState = this . state ; if ( ( oldState & ERROR ) != ERROR ) { newState = oldState | ERROR ; UndertowLogger . ROOT_LOGGER . nodeIsInError ( jvmRoute ) ; } else if ( ( oldState & ERROR_MASK ) == ERROR_MASK ) { return ERROR_MASK ; } else { newS... | Mark a node in error . Mod_cluster has a threshold after which broken nodes get removed . |
10,358 | public static long parsePositiveLong ( String str ) { long value = 0 ; final int length = str . length ( ) ; if ( length == 0 ) { throw new NumberFormatException ( str ) ; } long multiplier = 1 ; for ( int i = length - 1 ; i >= 0 ; -- i ) { char c = str . charAt ( i ) ; if ( c < '0' || c > '9' ) { throw new NumberForma... | fast long parsing algorithm |
10,359 | void forceInit ( DispatcherType dispatcherType ) throws ServletException { if ( filters != null ) { List < ManagedFilter > list = filters . get ( dispatcherType ) ; if ( list != null && ! list . isEmpty ( ) ) { for ( int i = 0 ; i < list . size ( ) ; ++ i ) { ManagedFilter filter = list . get ( i ) ; filter . forceInit... | see UNDERTOW - 1132 |
10,360 | public void ungetRequestBytes ( final PooledByteBuffer unget ) { if ( getExtraBytes ( ) == null ) { setExtraBytes ( unget ) ; } else { PooledByteBuffer eb = getExtraBytes ( ) ; ByteBuffer buf = eb . getBuffer ( ) ; final ByteBuffer ugBuffer = unget . getBuffer ( ) ; if ( ugBuffer . limit ( ) - ugBuffer . remaining ( ) ... | Pushes back the given data . This should only be used by transfer coding handlers that have read past the end of the request when handling pipelined requests |
10,361 | public synchronized void initialRequestDone ( ) { initialRequestDone = true ; if ( previousAsyncContext != null ) { previousAsyncContext . onAsyncStart ( this ) ; previousAsyncContext = null ; } if ( ! processingAsyncTask ) { processAsyncTask ( ) ; } initiatingThread = null ; } | Called by the container when the initial request is finished . If this request has a dispatch or complete call pending then this will be started . |
10,362 | public void run ( ) { if ( ! stateUpdater . compareAndSet ( this , 1 , 2 ) ) { return ; } List < JDBCLogAttribute > messages = new ArrayList < > ( ) ; JDBCLogAttribute msg = null ; for ( int i = 0 ; i < 1000 ; ++ i ) { msg = pendingMessages . poll ( ) ; if ( msg == null ) { break ; } messages . add ( msg ) ; } try { if... | insert the log record to database |
10,363 | private V putInternal ( final K key , final V value ) { final Map < K , V > delegate = new HashMap < > ( this . delegate ) ; V existing = delegate . put ( key , value ) ; this . delegate = delegate ; return existing ; } | must be called under lock |
10,364 | private void checkUTF8 ( ByteBuffer buf , int position , int length ) throws UnsupportedEncodingException { int limit = position + length ; for ( int i = position ; i < limit ; i ++ ) { checkUTF8 ( buf . get ( i ) ) ; } } | Check if the given ByteBuffer contains non UTF - 8 data . |
10,365 | private SingleConstraintMatch mergeConstraints ( final RuntimeMatch currentMatch ) { if ( currentMatch . uncovered && denyUncoveredHttpMethods ) { return new SingleConstraintMatch ( SecurityInfo . EmptyRoleSemantic . DENY , Collections . < String > emptySet ( ) ) ; } final Set < String > allowedRoles = new HashSet < > ... | merge all constraints as per 13 . 8 . 1 Combining Constraints |
10,366 | private static boolean shouldDecode ( final HttpServerExchange exchange ) { return ! exchange . getConnection ( ) . getUndertowOptions ( ) . get ( UndertowOptions . DECODE_URL , true ) && exchange . putAttachment ( ALREADY_DECODED , Boolean . TRUE ) == null ; } | attachment so that subsequent invocations will always return false . |
10,367 | void handleInitialRequest ( HttpServerExchange initial , Http2Channel channel , byte [ ] data ) { Http2HeadersStreamSinkChannel sink = channel . createInitialUpgradeResponseStream ( ) ; final Http2ServerConnection connection = new Http2ServerConnection ( channel , sink , undertowOptions , bufferSize , rootHandler ) ; H... | Handles the initial request when the exchange was started by a HTTP ugprade . |
10,368 | private boolean checkRequestHeaders ( HeaderMap headers ) { if ( headers . count ( METHOD ) != 1 || headers . contains ( Headers . CONNECTION ) ) { return false ; } if ( headers . get ( METHOD ) . contains ( Methods . CONNECT_STRING ) ) { if ( headers . contains ( SCHEME ) || headers . contains ( PATH ) || headers . co... | Performs HTTP2 specification compliance check for headers and pseudo - headers of a current request . |
10,369 | void updateContentSize ( long frameLength , boolean last ) { if ( contentLengthRemaining != - 1 ) { contentLengthRemaining -= frameLength ; if ( contentLengthRemaining < 0 ) { UndertowLogger . REQUEST_IO_LOGGER . debugf ( "Closing stream %s on %s as data length exceeds content size" , streamId , getFramedChannel ( ) ) ... | Checks that the actual content size matches the expected . We check this proactivly rather than as the data is read |
10,370 | private void exitRead ( long consumed ) throws IOException { long oldVal = state ; if ( consumed == - 1 ) { if ( anyAreSet ( oldVal , MASK_COUNT ) ) { invokeFinishListener ( ) ; state &= ~ MASK_COUNT ; throw UndertowMessages . MESSAGES . couldNotReadContentLengthData ( ) ; } return ; } long newVal = oldVal - consumed ;... | Exit a read method . |
10,371 | private void invokeOnComplete ( ) { for ( ; ; ) { if ( pooledBuffers != null ) { for ( PooledByteBuffer buffer : pooledBuffers ) { buffer . close ( ) ; } pooledBuffers = null ; } IoCallback callback = this . callback ; this . buffer = null ; this . fileChannel = null ; this . callback = null ; inCallback = true ; try {... | Invokes the onComplete method . If send is called again in onComplete then we loop and write it out . This prevents possible stack overflows due to recursion |
10,372 | protected static void parseCondFlag ( String line , RewriteCond condition , String flag ) { if ( flag . equals ( "NC" ) || flag . equals ( "nocase" ) ) { condition . setNocase ( true ) ; } else if ( flag . equals ( "OR" ) || flag . equals ( "ornext" ) ) { condition . setOrnext ( true ) ; } else { throw UndertowServletL... | Parser for RewriteCond flags . |
10,373 | public void registerStream ( int streamId , int dependency , int weighting , boolean exclusive ) { final Http2PriorityNode node = new Http2PriorityNode ( streamId , weighting ) ; if ( exclusive ) { Http2PriorityNode existing = nodesByID . get ( dependency ) ; if ( existing != null ) { existing . exclusive ( node ) ; } ... | Resisters a stream with its dependency and dependent information |
10,374 | public void streamRemoved ( int streamId ) { Http2PriorityNode node = nodesByID . get ( streamId ) ; if ( node == null ) { return ; } if ( ! node . hasDependents ( ) ) { int toEvict = evictionQueue [ evictionQueuePosition ] ; evictionQueue [ evictionQueuePosition ++ ] = streamId ; Http2PriorityNode nodeToEvict = nodesB... | Method that is invoked when a stream has been removed |
10,375 | public Comparator < Integer > comparator ( ) { return new Comparator < Integer > ( ) { public int compare ( Integer o1 , Integer o2 ) { Http2PriorityNode n1 = nodesByID . get ( o1 ) ; Http2PriorityNode n2 = nodesByID . get ( o2 ) ; if ( n1 == null && n2 == null ) { return 0 ; } if ( n1 == null ) { return - 1 ; } if ( n... | Creates a priority queue |
10,376 | boolean updateSettings ( List < Http2Setting > settings ) { for ( Http2Setting setting : settings ) { if ( setting . getId ( ) == Http2Setting . SETTINGS_INITIAL_WINDOW_SIZE ) { synchronized ( flowControlLock ) { int old = initialSendWindowSize ; if ( setting . getValue ( ) > Integer . MAX_VALUE ) { sendGoAway ( ERROR_... | Setting have been received from the client |
10,377 | public synchronized Http2HeadersStreamSinkChannel createStream ( HeaderMap requestHeaders ) throws IOException { if ( ! isClient ( ) ) { throw UndertowMessages . MESSAGES . headersStreamCanOnlyBeCreatedByClient ( ) ; } if ( ! isOpen ( ) ) { throw UndertowMessages . MESSAGES . channelIsClosed ( ) ; } sendConcurrentStrea... | Creates a strema using a HEADERS frame |
10,378 | int grabFlowControlBytes ( int bytesToGrab ) { if ( bytesToGrab <= 0 ) { return 0 ; } int min ; synchronized ( flowControlLock ) { min = ( int ) Math . min ( bytesToGrab , sendWindowSize ) ; if ( bytesToGrab > FLOW_CONTROL_MIN_WINDOW && min <= FLOW_CONTROL_MIN_WINDOW ) { return 0 ; } min = Math . min ( sendMaxFrameSize... | Try and decrement the send window by the given amount of bytes . |
10,379 | public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream ( ) { if ( lastGoodStreamId != 0 ) { throw new IllegalStateException ( ) ; } lastGoodStreamId = 1 ; Http2HeadersStreamSinkChannel stream = new Http2HeadersStreamSinkChannel ( this , 1 ) ; StreamHolder streamHolder = new StreamHolder ( stream ) ; st... | Creates a response stream to respond to the initial HTTP upgrade |
10,380 | static List < Integer > parseClientHello ( ByteBuffer source ) throws SSLException { ByteBuffer input = source . duplicate ( ) ; if ( isIncompleteHeader ( input ) ) { throw new BufferUnderflowException ( ) ; } byte firstByte = input . get ( ) ; byte secondByte = input . get ( ) ; byte thirdByte = input . get ( ) ; if (... | Checks if a client handshake is offering ALPN and if so it returns a list of all ciphers . If ALPN is not being offered then this will return null . |
10,381 | public void awaitShutdown ( ) throws InterruptedException { synchronized ( lock ) { if ( ! shutdown ) { throw UndertowMessages . MESSAGES . handlerNotShutdown ( ) ; } while ( activeRequestsUpdater . get ( this ) > 0 ) { lock . wait ( ) ; } } } | Waits for the handler to shutdown . |
10,382 | public boolean awaitShutdown ( long millis ) throws InterruptedException { synchronized ( lock ) { if ( ! shutdown ) { throw UndertowMessages . MESSAGES . handlerNotShutdown ( ) ; } long end = System . currentTimeMillis ( ) + millis ; int count = ( int ) activeRequestsUpdater . get ( this ) ; while ( count != 0 ) { lon... | Waits a set length of time for the handler to shut down |
10,383 | public void addShutdownListener ( final ShutdownListener shutdownListener ) { synchronized ( lock ) { if ( ! shutdown ) { throw UndertowMessages . MESSAGES . handlerNotShutdown ( ) ; } long count = activeRequestsUpdater . get ( this ) ; if ( count == 0 ) { shutdownListener . shutdown ( true ) ; } else { shutdownListene... | Adds a shutdown listener that will be invoked when all requests have finished . If all requests have already been finished the listener will be invoked immediately . |
10,384 | public void run ( ) { if ( ! stateUpdater . compareAndSet ( this , 1 , 2 ) ) { return ; } if ( forceLogRotation ) { doRotate ( ) ; } else if ( initialRun && Files . exists ( defaultLogFile ) ) { long lm = 0 ; try { lm = Files . getLastModifiedTime ( defaultLogFile ) . toMillis ( ) ; } catch ( IOException e ) { Undertow... | processes all queued log messages |
10,385 | @ SuppressWarnings ( "unchecked" ) public static < T > AttachmentKey < AttachmentList < T > > createList ( final Class < ? super T > valueClass ) { return new ListAttachmentKey ( valueClass ) ; } | Construct a new list attachment key . |
10,386 | final SendFrameHeader getFrameHeader ( ) throws IOException { if ( header == null ) { header = createFrameHeader ( ) ; if ( header == null ) { header = new SendFrameHeader ( 0 , null ) ; } } return header ; } | Returns the header for the current frame . |
10,387 | public boolean send ( PooledByteBuffer pooled ) throws IOException { if ( isWritesShutdown ( ) ) { throw UndertowMessages . MESSAGES . channelIsClosed ( ) ; } boolean result = sendInternal ( pooled ) ; if ( result ) { flush ( ) ; } return result ; } | Send a buffer to this channel . |
10,388 | final void flushComplete ( ) throws IOException { synchronized ( lock ) { try { bufferFull = false ; int remaining = header . getRemainingInBuffer ( ) ; boolean finalFrame = finalFrameQueued ; boolean channelClosed = finalFrame && remaining == 0 && ! header . isAnotherFrameRequired ( ) ; if ( remaining > 0 ) { body . g... | Method that is invoked when a frame has been fully flushed . This method is only invoked by the IO thread |
10,389 | boolean isAllowed ( String attribute ) { if ( attribute != null ) { for ( AclMatch rule : acl ) { if ( rule . matches ( attribute ) ) { return ! rule . isDeny ( ) ; } } } return defaultAllow ; } | package private for unit tests |
10,390 | public static PredicateHandler predicate ( final Predicate predicate , final HttpHandler trueHandler , final HttpHandler falseHandler ) { return new PredicateHandler ( predicate , trueHandler , falseHandler ) ; } | Returns a new predicate handler that will delegate to one of the two provided handlers based on the value of the provided predicate . |
10,391 | public static SetHeaderHandler header ( final HttpHandler next , final String headerName , final ExchangeAttribute headerValue ) { return new SetHeaderHandler ( next , headerName , headerValue ) ; } | Returns a handler that sets a response header |
10,392 | public static final AccessControlListHandler acl ( final HttpHandler next , boolean defaultAllow , ExchangeAttribute attribute ) { return new AccessControlListHandler ( next , attribute ) . setDefaultAllow ( defaultAllow ) ; } | Returns a new handler that can allow or deny access to a resource based an at attribute of the exchange |
10,393 | public static SetAttributeHandler setAttribute ( final HttpHandler next , final String attribute , final String value , final ClassLoader classLoader ) { return new SetAttributeHandler ( next , attribute , value , classLoader ) ; } | Returns an attribute setting handler that can be used to set an arbitrary attribute on the exchange . This includes functions such as adding and removing headers etc . |
10,394 | public static HttpHandler rewrite ( final String condition , final String target , final ClassLoader classLoader , final HttpHandler next ) { return predicateContext ( predicate ( PredicateParser . parse ( condition , classLoader ) , setAttribute ( next , "%R" , target , classLoader ) , next ) ) ; } | Creates the set of handlers that are required to perform a simple rewrite . |
10,395 | public static JvmRouteHandler jvmRoute ( final String sessionCookieName , final String jvmRoute , HttpHandler next ) { return new JvmRouteHandler ( next , sessionCookieName , jvmRoute ) ; } | Handler that appends the JVM route to the session cookie |
10,396 | public static RequestLimitingHandler requestLimitingHandler ( final int maxRequest , final int queueSize , HttpHandler next ) { return new RequestLimitingHandler ( maxRequest , queueSize , next ) ; } | Returns a handler that limits the maximum number of requests that can run at a time . |
10,397 | public static ProxyHandler proxyHandler ( ProxyClient proxyClient , HttpHandler next ) { return ProxyHandler . builder ( ) . setProxyClient ( proxyClient ) . setNext ( next ) . build ( ) ; } | Returns a handler that can act as a load balancing reverse proxy . |
10,398 | public static LearningPushHandler learningPushHandler ( int maxEntries , int maxAge , HttpHandler next ) { return new LearningPushHandler ( maxEntries , maxAge , next ) ; } | Creates a handler that automatically learns which resources to push based on the referer header |
10,399 | @ SuppressWarnings ( "unused" ) final void handleStatusCode ( ByteBuffer buffer , ResponseParseState state , HttpResponseBuilder builder ) { StringBuilder stringBuilder = state . stringBuilder ; while ( buffer . hasRemaining ( ) ) { final char next = ( char ) buffer . get ( ) ; if ( next == ' ' || next == '\t' ) { buil... | Parses the status code . This is called from the generated bytecode . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.