idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
122,800 | public synchronized Object get ( Object name ) { if ( _initParams == null ) return null ; return _initParams . get ( name ) ; } | Map get method . FilterHolder implements the Map interface as a configuration conveniance . The methods are mapped to the filter properties . |
122,801 | public Enumeration getFieldNames ( ) { return new Enumeration ( ) { int i = 0 ; Field field = null ; public boolean hasMoreElements ( ) { if ( field != null ) return true ; while ( i < _fields . size ( ) ) { Field f = ( Field ) _fields . get ( i ++ ) ; if ( f != null && f . _version == _version && f . _prev == null ) {... | Get enumeration of header _names . Returns an enumeration of strings representing the header _names for this request . |
122,802 | public int getIntField ( String name ) throws NumberFormatException { String val = valueParameters ( get ( name ) , null ) ; if ( val != null ) return Integer . parseInt ( val ) ; return - 1 ; } | Get a header as an integer value . Returns the value of an integer field or - 1 if not found . The case of the field name is ignored . |
122,803 | public void addDateField ( String name , long date ) { if ( _dateBuffer == null ) { _dateBuffer = new StringBuffer ( 32 ) ; _calendar = new HttpCal ( ) ; } _dateBuffer . setLength ( 0 ) ; _calendar . setTimeInMillis ( date ) ; formatDate ( _dateBuffer , _calendar , false ) ; add ( name , _dateBuffer . toString ( ) ) ; ... | Adds the value of a date field . |
122,804 | public void clear ( ) { _version ++ ; if ( _version > 1000 ) { _version = 0 ; for ( int i = _fields . size ( ) ; i -- > 0 ; ) { Field field = ( Field ) _fields . get ( i ) ; if ( field != null ) field . clear ( ) ; } } } | Clear the header . |
122,805 | public void destroy ( ) { for ( int i = _fields . size ( ) ; i -- > 0 ; ) { Field field = ( Field ) _fields . get ( i ) ; if ( field != null ) field . destroy ( ) ; } _fields = null ; _index = null ; _dateBuffer = null ; _calendar = null ; _dateReceive = null ; } | Destroy the header . Help the garbage collector by null everything that we can . |
122,806 | public void addSetCookie ( Cookie cookie ) { String name = cookie . getName ( ) ; String value = cookie . getValue ( ) ; int version = cookie . getVersion ( ) ; if ( name == null || name . length ( ) == 0 ) throw new IllegalArgumentException ( "Bad cookie name" ) ; StringBuffer buf = new StringBuffer ( 128 ) ; String n... | Format a set cookie value |
122,807 | public void add ( HttpFields fields ) { if ( fields == null ) return ; Enumeration enm = fields . getFieldNames ( ) ; while ( enm . hasMoreElements ( ) ) { String name = ( String ) enm . nextElement ( ) ; Enumeration values = fields . getValues ( name ) ; while ( values . hasMoreElements ( ) ) add ( name , ( String ) v... | Add fields from another HttpFields instance . Single valued fields are replaced while all others are added . |
122,808 | public void readHeader ( HttpInputStream in ) throws IOException { _state = __MSG_BAD ; log . warn ( LogSupport . NOT_IMPLEMENTED ) ; } | Not Implemented . |
122,809 | public void sendError ( int code , String message ) throws IOException { setStatus ( code , message ) ; HttpRequest request = getHttpRequest ( ) ; if ( code != __204_No_Content && code != __304_Not_Modified && code != __206_Partial_Content && code >= 200 ) { if ( getHttpContext ( ) != null ) { Object o = getHttpContext... | Send Error Response . |
122,810 | public void addSetCookie ( String name , String value ) { _header . addSetCookie ( new Cookie ( name , value ) ) ; } | Add a Set - Cookie field . |
122,811 | void recycle ( HttpConnection connection ) { super . recycle ( connection ) ; _status = __200_OK ; _reason = null ; _httpContext = null ; } | Recycle the response . |
122,812 | public void configure ( String configuration ) throws IOException { URL url = Resource . newResource ( configuration ) . getURL ( ) ; if ( _configuration != null && _configuration . equals ( url . toString ( ) ) ) return ; if ( _configuration != null ) throw new IllegalStateException ( "Already configured with " + _con... | Configure the server from an XML file . |
122,813 | public void setWebApplicationConfigurationClassNames ( String [ ] configurationClassNames ) { if ( configurationClassNames != null ) { _webAppConfigurationClassNames = new String [ configurationClassNames . length ] ; System . arraycopy ( configurationClassNames , 0 , _webAppConfigurationClassNames , 0 , configurationC... | setWebApplicationConfigurationClasses Set up the list of classnames of WebApplicationContext . Configuration implementations that will be applied to configure every webapp . The list can be overridden by individual WebApplicationContexts . |
122,814 | public void addText ( String label , String value ) { Composite c = new Composite ( ) ; c . add ( value ) ; addField ( label , c ) ; } | Add an informational section . |
122,815 | public Input addTextField ( String tag , String label , int length , String value ) { Input i = new Input ( Input . Text , tag , value ) ; i . setSize ( length ) ; addField ( label , i ) ; return i ; } | Add a Text Entry Field . |
122,816 | public TextArea addTextArea ( String tag , String label , int width , int height , String value ) { TextArea ta = new TextArea ( tag , value ) ; ta . setSize ( width , height ) ; addField ( label , ta ) ; return ta ; } | Add a Text Area . |
122,817 | public Input addFileField ( String tag , String label ) { Input i = new Input ( Input . File , tag ) ; addField ( label , i ) ; return i ; } | Add a File Entry Field . |
122,818 | public void addInfoField ( String tag , String label , String value ) { addText ( label , value ) ; addHiddenField ( tag , value ) ; } | Add an informational field which also passes the data as hidden . |
122,819 | public void addHiddenField ( String tag , String value ) { Element e = new Input ( Input . Hidden , tag , value ) ; hidden . add ( e ) ; } | Add a hidden field . |
122,820 | public void addPassword ( String tag , String label , int length ) { Input i = new Input ( Input . Password , tag ) ; i . setSize ( length ) ; addField ( label , i ) ; } | Add a password field . |
122,821 | public Select addSelect ( String tag , String label , boolean multiple , int size ) { Select s = new Select ( tag , multiple ) ; s . setSize ( size ) ; addField ( label , s ) ; return s ; } | Add a Select field . |
122,822 | public Select addSelect ( String tag , String label , boolean multiple , int size , Enumeration values ) { Select s = addSelect ( tag , label , multiple , size ) ; s . setSize ( size ) ; while ( values . hasMoreElements ( ) ) s . add ( values . nextElement ( ) . toString ( ) ) ; return s ; } | Add a Select field initialised with fields . |
122,823 | public Input addButton ( String tag , String label ) { if ( buttons == null ) buttonsAtBottom ( ) ; Input e = new Input ( Input . Submit , tag , label ) ; if ( extendRow ) addField ( null , e ) ; else buttons . add ( e ) ; return e ; } | Add a Submit Button . |
122,824 | public void addReset ( String label ) { if ( buttons == null ) buttonsAtBottom ( ) ; Element e = new Input ( Input . Reset , "Reset" , label ) ; if ( extendRow ) addField ( null , e ) ; else buttons . add ( e ) ; } | Add a reset button . |
122,825 | public void addField ( String label , Element field ) { if ( label == null ) label = " " ; else label = "<b>" + label + ":</b>" ; if ( extendRow ) { column . add ( field ) ; extendRow = false ; } else { column . newRow ( ) ; column . addCell ( label ) ; column . cell ( ) . right ( ) ; if ( fieldAttributes != null ... | Add an arbitrary element to the table . |
122,826 | public void addColumn ( int spacing ) { table . addCell ( " " , "width=" + spacing ) ; column = new Table ( 0 ) ; table . addCell ( column ) ; table . cell ( ) . top ( ) ; columns ++ ; } | Create a new column in the form . |
122,827 | public void newColumns ( ) { column = new Table ( 0 ) ; columns = 1 ; table . newRow ( ) ; table . addCell ( column ) ; table . cell ( ) . top ( ) ; } | Add a new sections of columns . |
122,828 | public void newTable ( ) { table = new Table ( 0 ) ; column = new Table ( 0 ) ; columns = 1 ; super . add ( table ) ; table . newRow ( ) ; table . addCell ( column ) . top ( ) ; } | Start using a new Table . Anything added to the Composite parent of this object before this is called will be added between the two tables . |
122,829 | public final boolean isSecure ( Socket sock ) throws IllegalArgumentException { if ( sock == null ) { throw new IllegalArgumentException ( "Socket may not be null." ) ; } if ( sock . isClosed ( ) ) { throw new IllegalArgumentException ( "Socket is closed." ) ; } return false ; } | Checks whether a socket connection is secure . This factory creates plain socket connections which are not considered secure . |
122,830 | public synchronized void release ( ) { if ( _in != null ) { try { _in . close ( ) ; } catch ( IOException e ) { LogSupport . ignore ( log , e ) ; } _in = null ; } if ( _connection != null ) _connection = null ; } | Release any resources held by the resource . |
122,831 | public boolean exists ( ) { try { synchronized ( this ) { if ( checkConnection ( ) && _in == null ) _in = _connection . getInputStream ( ) ; } } catch ( IOException e ) { LogSupport . ignore ( log , e ) ; } return _in != null ; } | Returns true if the respresened resource exists . |
122,832 | public File getFile ( ) throws IOException { if ( checkConnection ( ) ) { Permission perm = _connection . getPermission ( ) ; if ( perm instanceof java . io . FilePermission ) return new File ( perm . getName ( ) ) ; } try { return new File ( _url . getFile ( ) ) ; } catch ( Exception e ) { LogSupport . ignore ( log , ... | Returns an File representing the given resource or NULL if this is not possible . |
122,833 | public synchronized InputStream getInputStream ( ) throws java . io . IOException { if ( ! checkConnection ( ) ) throw new IOException ( "Invalid resource" ) ; try { if ( _in != null ) { InputStream in = _in ; _in = null ; return in ; } return _connection . getInputStream ( ) ; } finally { _connection = null ; } } | Returns an input stream to the resource |
122,834 | public Resource addPath ( String path ) throws IOException , MalformedURLException { if ( path == null ) return null ; path = URI . canonicalPath ( path ) ; return newResource ( URI . addPaths ( _url . toExternalForm ( ) , path ) ) ; } | Returns the resource contained inside the current resource with the given name |
122,835 | public synchronized ServletHandler getServletHandler ( ) { if ( _servletHandler == null ) _servletHandler = ( ServletHandler ) getHandler ( ServletHandler . class ) ; if ( _servletHandler == null ) { _servletHandler = new ServletHandler ( ) ; addHandler ( _servletHandler ) ; } return _servletHandler ; } | Get the context ServletHandler . Conveniance method . If no ServletHandler exists a new one is added to the context . |
122,836 | public synchronized ServletHolder addServlet ( String pathSpec , String className ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { return addServlet ( className , pathSpec , className ) ; } | Add a servlet to the context . Conveniance method . If no ServletHandler is found in the context a new one is added . |
122,837 | public synchronized ServletHolder addServlet ( String name , String pathSpec , String className ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { return getServletHandler ( ) . addServlet ( name , pathSpec , className , null ) ; } | Add a servlet to the context . If no ServletHandler is found in the context a new one is added . |
122,838 | public String getLocaleEncoding ( Locale locale ) { String encoding = ( String ) _localeEncodingMap . get ( locale . toString ( ) ) ; if ( encoding == null ) encoding = ( String ) _localeEncodingMap . get ( locale . getLanguage ( ) ) ; return encoding ; } | Get the character encoding for a locale . The full locale name is first looked up in the map of encodings . If no encoding is found then the locale language is looked up . |
122,839 | public Map . Entry getEntry ( String key , int offset , int length ) { if ( key == null ) return _nullEntry ; Node node = _root ; int ni = - 1 ; charLoop : for ( int i = 0 ; i < length ; i ++ ) { char c = key . charAt ( offset + i ) ; if ( ni == - 1 ) { ni = 0 ; node = ( node . _children == null ) ? null : node . _chil... | Get a map entry by substring key . |
122,840 | public static void recursivelyDeleteDir ( File customProfileDir ) { if ( customProfileDir == null || ! customProfileDir . exists ( ) ) { return ; } Delete delete = new Delete ( ) ; delete . setProject ( new Project ( ) ) ; delete . setDir ( customProfileDir ) ; delete . setFailOnError ( true ) ; delete . execute ( ) ; ... | Delete a directory and all subdirectories |
122,841 | public void flush ( ) throws IOException { try { if ( ! _commited ) { _commited = true ; if ( _commitObserver != null ) _commitObserver . outputNotify ( this , OutputObserver . __COMMITING , null ) ; } wrapBuffer ( ) ; if ( _httpMessageWriter . size ( ) > 0 ) { prewrite ( _httpMessageWriter . getBuf ( ) , 0 , _httpMess... | This implementation calls the commitObserver on the first flush since construction or reset . |
122,842 | public synchronized void reset ( ) { info ( "reset" ) ; if ( _sinks != null ) { for ( int s = _sinks . length ; s -- > 0 ; ) { try { if ( _sinks [ s ] != null ) _sinks [ s ] . stop ( ) ; _sinks [ s ] = null ; } catch ( InterruptedException e ) { if ( getDebug ( ) && getVerbose ( ) > 0 ) message ( "WARN" , e ) ; } } _si... | No logging . All log sinks are stopped and removed . |
122,843 | public synchronized void message ( String tag , Object msg , Frame frame , long time ) { if ( ! _initialized ) defaultInit ( ) ; boolean logged = false ; if ( _sinks != null ) { for ( int s = _sinks . length ; s -- > 0 ; ) { if ( _sinks [ s ] == null ) continue ; if ( _sinks [ s ] . isStarted ( ) ) { logged = true ; _s... | Log a message . |
122,844 | public synchronized void setDebug ( boolean debug ) { boolean oldDebug = _debugOn ; if ( _debugOn && ! debug ) this . message ( DEBUG , "DEBUG OFF" ) ; _debugOn = debug ; if ( ! oldDebug && debug ) this . message ( DEBUG , "DEBUG ON" ) ; } | Set if debugging is on or off . |
122,845 | public void setDebugPatterns ( String patterns ) { _patterns = patterns ; if ( patterns != null && patterns . length ( ) > 0 ) { _debugPatterns = new ArrayList ( ) ; StringTokenizer tok = new StringTokenizer ( patterns , ", \t" ) ; while ( tok . hasMoreTokens ( ) ) { String pattern = tok . nextToken ( ) ; _debugPattern... | Set debug patterns . |
122,846 | public synchronized String encode ( String charset , boolean equalsForNullValue ) { if ( charset == null ) charset = StringUtil . __ISO_8859_1 ; StringBuffer result = new StringBuffer ( 128 ) ; synchronized ( result ) { Iterator iter = entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Map . Entry entry = ( M... | Encode Hashtable with % encoding . |
122,847 | public static String decodeString ( String encoded ) { return decodeString ( encoded , 0 , encoded . length ( ) , StringUtil . __ISO_8859_1 ) ; } | Decode String with % encoding . This method makes the assumption that the majority of calls will need no decoding and uses the 8859 encoding . |
122,848 | protected synchronized void checkDataMaps ( ) throws IOException { if ( lastUpdateCheck == 0 || lastUpdateCheck < System . currentTimeMillis ( ) - updateInterval ) { String versionOnServer = getVersionFromServer ( ) ; if ( currentVersion == null || versionOnServer . compareTo ( currentVersion ) > 0 ) { loadDataFromInte... | Since we ve online access to the data file we check every day for an update |
122,849 | private void loadDataFromInternet ( ) throws IOException { URL url = new URL ( DATA_RETRIVE_URL ) ; InputStream is = url . openStream ( ) ; try { PHPFileParser fp = new PHPFileParser ( is ) ; createInternalDataStructre ( fp . getSections ( ) ) ; } finally { is . close ( ) ; } } | Loads the data file from user - agent - string . info |
122,850 | protected String getVersionFromServer ( ) throws IOException { URL url = new URL ( VERSION_CHECK_URL ) ; InputStream is = url . openStream ( ) ; try { byte [ ] buff = new byte [ 4048 ] ; int len = is . read ( buff ) ; return new String ( buff , 0 , len ) ; } finally { is . close ( ) ; } } | Gets the current version from user - agent - string . info |
122,851 | public static Object add ( Object list , Object item ) { if ( list == null ) { if ( item instanceof List || item == null ) { List l = new ArrayList ( ) ; l . add ( item ) ; return l ; } return item ; } if ( list instanceof List ) { ( ( List ) list ) . add ( item ) ; return list ; } List l = new ArrayList ( ) ; l . add ... | Add an item to a LazyList |
122,852 | protected Object add ( Object list , Collection collection ) { Iterator i = collection . iterator ( ) ; while ( i . hasNext ( ) ) list = LazyList . add ( list , i . next ( ) ) ; return list ; } | Add the contents of a Collection to a LazyList |
122,853 | public static int indexFrom ( String s , String chars ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) if ( chars . indexOf ( s . charAt ( i ) ) >= 0 ) return i ; return - 1 ; } | returns the next index of a character from the chars string |
122,854 | public static String replace ( String s , String sub , String with ) { int c = 0 ; int i = s . indexOf ( sub , c ) ; if ( i == - 1 ) return s ; StringBuffer buf = new StringBuffer ( s . length ( ) + with . length ( ) ) ; synchronized ( buf ) { do { buf . append ( s . substring ( c , i ) ) ; buf . append ( with ) ; c = ... | replace substrings within string . |
122,855 | public Element setAttributesFrom ( Element e ) { attributes = e . attributes ; attributeMap = ( Hashtable ) e . attributeMap . clone ( ) ; return this ; } | Set attributes from another Element . |
122,856 | public void setPoolClass ( Class poolClass ) throws IllegalStateException { synchronized ( this ) { if ( _class != poolClass ) { if ( _running > 0 ) throw new IllegalStateException ( "Thread Pool Running" ) ; if ( ! PondLife . class . isAssignableFrom ( poolClass ) ) throw new IllegalArgumentException ( "Not PondLife: ... | Set the class . |
122,857 | public int compareTo ( Object o ) { if ( o instanceof ServletHolder ) { ServletHolder sh = ( ServletHolder ) o ; if ( sh == this ) return 0 ; if ( sh . _initOrder < _initOrder ) return 1 ; if ( sh . _initOrder > _initOrder ) return - 1 ; int c = _className . compareTo ( sh . _className ) ; if ( c == 0 ) c = _name . com... | Comparitor by init order . |
122,858 | public synchronized void setUserRoleLink ( String name , String link ) { if ( _roleMap == null ) _roleMap = new HashMap ( ) ; _roleMap . put ( name , link ) ; } | Link a user role . Translate the role name used by a servlet to the link name used by the container . |
122,859 | public String getUserRoleLink ( String name ) { if ( _roleMap == null ) return name ; String link = ( String ) _roleMap . get ( name ) ; return ( link == null ) ? name : link ; } | get a user role link . |
122,860 | public synchronized Servlet getServlet ( ) throws ServletException { if ( _unavailable != 0 ) { if ( _unavailable < 0 || _unavailable > 0 && System . currentTimeMillis ( ) < _unavailable ) throw _unavailableEx ; _unavailable = 0 ; _unavailableEx = null ; } try { if ( _servlets != null ) { Servlet servlet = null ; if ( ... | Get the servlet . |
122,861 | public void handle ( ServletRequest request , ServletResponse response ) throws ServletException , UnavailableException , IOException { if ( _class == null ) throw new UnavailableException ( "Servlet Not Initialized" ) ; Servlet servlet = ( ! _initOnStartup || _servlets != null ) ? getServlet ( ) : _servlet ; if ( serv... | Service a request with this servlet . |
122,862 | public Frame nameFrame ( String name , int col , int row ) { if ( frameMap == null ) { frameMap = new Hashtable ( 10 ) ; frameNames = new Vector ( 10 ) ; } Frame frame = frames [ col ] [ row ] ; if ( frame == null ) frame = frames [ col ] [ row ] = new Frame ( ) ; if ( frameMap . get ( name ) == null ) frameNames . add... | Name a frame . By convention frame names match Page section names |
122,863 | public void load ( String config ) throws IOException { _config = config ; if ( log . isDebugEnabled ( ) ) log . debug ( "Load " + this + " from " + config ) ; Properties properties = new Properties ( ) ; Resource resource = Resource . newResource ( config ) ; properties . load ( resource . getInputStream ( ) ) ; Itera... | Load realm users from properties file . The property file maps usernames to password specs followed by an optional comma separated list of role names . |
122,864 | public synchronized Object put ( Object name , Object credentials ) { if ( credentials instanceof Principal ) return super . put ( name . toString ( ) , credentials ) ; if ( credentials instanceof Password ) return super . put ( name , new KnownUser ( name . toString ( ) , ( Password ) credentials ) ) ; if ( credential... | Put user into realm . |
122,865 | public synchronized void addUserToRole ( String userName , String roleName ) { HashSet userSet = ( HashSet ) _roles . get ( roleName ) ; if ( userSet == null ) { userSet = new HashSet ( 11 ) ; _roles . put ( roleName , userSet ) ; } userSet . add ( userName ) ; } | Add a user to a role . |
122,866 | public synchronized boolean isUserInRole ( Principal user , String roleName ) { if ( user instanceof WrappedUser ) return ( ( WrappedUser ) user ) . isUserInRole ( roleName ) ; if ( user == null || ( ( User ) user ) . getUserRealm ( ) != this ) return false ; HashSet userSet = ( HashSet ) _roles . get ( roleName ) ; re... | Check if a user is in a role . |
122,867 | public String [ ] list ( ) { String [ ] list = _file . list ( ) ; if ( list == null ) return null ; for ( int i = list . length ; i -- > 0 ; ) { if ( new File ( _file , list [ i ] ) . isDirectory ( ) && ! list [ i ] . endsWith ( "/" ) ) list [ i ] += "/" ; } return list ; } | Returns a list of resources contained in the given resource |
122,868 | public ServletHolder mapPathToServlet ( String pathSpec , String servletName ) { ServletHolder holder = ( ServletHolder ) _nameMap . get ( servletName ) ; if ( ! pathSpec . startsWith ( "/" ) && ! pathSpec . startsWith ( "*" ) ) { log . warn ( "pathSpec should start with '/' or '*' : " + pathSpec ) ; pathSpec = "/" + p... | Map a servlet to a pathSpec |
122,869 | public void addServletHolder ( ServletHolder holder ) { ServletHolder existing = ( ServletHolder ) _nameMap . get ( holder . getName ( ) ) ; if ( existing == null ) _nameMap . put ( holder . getName ( ) , holder ) ; else if ( existing != holder ) throw new IllegalArgumentException ( "Holder already exists for name: " +... | Register an existing ServletHolder with this handler . |
122,870 | public ServletHolder [ ] getServlets ( ) { HashSet holder_set = new HashSet ( _nameMap . size ( ) ) ; holder_set . addAll ( _nameMap . values ( ) ) ; ServletHolder holders [ ] = ( ServletHolder [ ] ) holder_set . toArray ( new ServletHolder [ holder_set . size ( ) ] ) ; java . util . Arrays . sort ( holders ) ; return ... | Get Servlets . |
122,871 | public void initializeServlets ( ) throws Exception { MultiException mx = new MultiException ( ) ; ServletHolder [ ] holders = getServlets ( ) ; for ( int i = 0 ; i < holders . length ; i ++ ) { try { holders [ i ] . start ( ) ; } catch ( Exception e ) { log . debug ( LogSupport . EXCEPTION , e ) ; mx . add ( e ) ; } }... | Initialize load - on - startup servlets . Called automatically from start if autoInitializeServlet is true . |
122,872 | public URL getResource ( String uriInContext ) throws MalformedURLException { if ( uriInContext == null || ! uriInContext . startsWith ( "/" ) ) throw new MalformedURLException ( uriInContext ) ; try { Resource resource = getHttpContext ( ) . getResource ( uriInContext ) ; if ( resource != null && resource . exists ( )... | Get a Resource . If no resource is found resource aliases are tried . |
122,873 | public RequestDispatcher getNamedDispatcher ( String name ) { if ( name == null || name . length ( ) == 0 ) name = __DEFAULT_SERVLET ; try { return new Dispatcher ( ServletHandler . this , name ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } return null ; } | Get Named dispatcher . |
122,874 | protected Object getContextAttribute ( String name ) { if ( ServletHandler . __J_S_CONTEXT_TEMPDIR . equals ( name ) ) { Object t = getHttpContext ( ) . getAttribute ( ServletHandler . __J_S_CONTEXT_TEMPDIR ) ; if ( t instanceof File ) return ( File ) t ; return getHttpContext ( ) . getTempDirectory ( ) ; } if ( _attri... | Get context attribute . Tries ServletHandler attributes and then delegated to HttpContext . |
122,875 | protected Enumeration getContextAttributeNames ( ) { if ( _attributes . size ( ) == 0 ) return getHttpContext ( ) . getAttributeNames ( ) ; HashSet set = new HashSet ( _attributes . keySet ( ) ) ; Enumeration e = getHttpContext ( ) . getAttributeNames ( ) ; while ( e . hasMoreElements ( ) ) set . add ( e . nextElement ... | Get context attribute names . Combines ServletHandler and HttpContext attributes . |
122,876 | public void configure ( Object obj ) throws ClassNotFoundException , NoSuchMethodException , InvocationTargetException , InstantiationException , IllegalAccessException { Class oClass = nodeClass ( _config ) ; if ( oClass != null ) { if ( obj != null && ! oClass . isInstance ( obj ) ) throw new IllegalArgumentException... | Configure an object . If the object is of the approprate class the XML configuration script is applied to the object . |
122,877 | public Object newInstance ( ) throws ClassNotFoundException , NoSuchMethodException , InvocationTargetException , InstantiationException , IllegalAccessException { Class oClass = nodeClass ( _config ) ; Object obj = null ; if ( oClass != null ) obj = oClass . newInstance ( ) ; configure ( obj , _config , 0 ) ; return o... | Create a new object and configure it . A new object is created and configured . |
122,878 | public void configureWebApp ( ) throws Exception { if ( _context . isStarted ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Cannot configure webapp after it is started" ) ; } ; return ; } if ( log . isDebugEnabled ( ) ) log . debug ( "Configuring web-jetty.xml" ) ; Resource webInf = getWebApplicationContext (... | configureWebApp Apply web - jetty . xml configuration |
122,879 | public void addVirtualHost ( String hostname ) { if ( ! _vhosts . contains ( hostname ) ) { _vhosts . add ( hostname ) ; _contextName = null ; if ( _httpServer != null ) { if ( _vhosts . size ( ) == 1 ) _httpServer . removeMapping ( null , this ) ; _httpServer . addMapping ( hostname , this ) ; } _vhostsArray = null ; ... | Add a virtual host alias to this context . |
122,880 | public void removeVirtualHost ( String hostname ) { if ( _vhosts . remove ( hostname ) ) { _contextName = null ; if ( _httpServer != null ) { _httpServer . removeMapping ( hostname , this ) ; if ( _vhosts . size ( ) == 0 ) _httpServer . addMapping ( null , this ) ; } _vhostsArray = null ; } } | remove a virtual host alias to this context . |
122,881 | public void prewrite ( byte [ ] b ) { ensureReserve ( b . length ) ; System . arraycopy ( b , 0 , _buf , _start - b . length , b . length ) ; _start -= b . length ; } | Write byte array to start of the buffer . |
122,882 | public void prewrite ( byte [ ] b , int offset , int length ) { ensureReserve ( length ) ; System . arraycopy ( b , offset , _buf , _start - length , length ) ; _start -= length ; } | Write byte range to start of the buffer . |
122,883 | public void postwrite ( byte [ ] b , int offset , int length ) throws IOException { System . arraycopy ( b , offset , _buf , _pos , length ) ; _pos += length ; } | Write bytes into the postreserve . The capacity is not checked . |
122,884 | protected AJP13Connection createConnection ( Socket socket ) throws IOException { return new AJP13Connection ( this , socket . getInputStream ( ) , socket . getOutputStream ( ) , socket , getBufferSize ( ) ) ; } | Create an AJP13Connection instance . This method can be used to override the connection instance . |
122,885 | public Link target ( String t ) { if ( t != null && t . length ( ) > 0 ) attribute ( "target" , t ) ; return this ; } | Set the link target frame . |
122,886 | public void write ( Writer out ) throws IOException { if ( codeBase != null ) attribute ( "codebase" , codeBase ) ; if ( debug ) paramHolder . add ( "<param name=\"debug\" value=\"yes\">" ) ; if ( params != null ) for ( Enumeration enm = params . keys ( ) ; enm . hasMoreElements ( ) ; ) { String key = enm . nextElement... | Write out the HTML |
122,887 | public Composite add ( Object o ) { if ( nest != null ) nest . add ( o ) ; else { if ( o != null ) { if ( o instanceof Element ) { if ( o instanceof Page ) throw new IllegalArgumentException ( "Can't insert Page in Composite" ) ; elements . add ( o ) ; } else if ( o instanceof String ) elements . add ( o ) ; else eleme... | Add an Object to the Composite by converting it to a Element or . String |
122,888 | public Composite nest ( Composite c ) { if ( nest != null ) return nest . nest ( c ) ; else { add ( c ) ; nest = c ; } return this ; } | Nest a Composite within a Composite . The passed Composite is added to this Composite . Adds to this composite are actually added to the nested Composite . Calls to nest are passed the nested Composite |
122,889 | public void write ( Writer out ) throws IOException { for ( int i = 0 ; i < elements . size ( ) ; i ++ ) { Object element = elements . get ( i ) ; if ( element instanceof Element ) ( ( Element ) element ) . write ( out ) ; else if ( element == null ) out . write ( "null" ) ; else out . write ( element . toString ( ) ) ... | Write the composite . The default implementation writes the elements sequentially . May be overridden for more specialized behaviour . |
122,890 | public String contents ( ) { StringBuffer buf = new StringBuffer ( ) ; synchronized ( buf ) { for ( int i = 0 ; i < elements . size ( ) ; i ++ ) { Object element = elements . get ( i ) ; if ( element == null ) buf . append ( "null" ) ; else buf . append ( element . toString ( ) ) ; } } return buf . toString ( ) ; } | Contents of the composite . |
122,891 | public boolean replace ( Object oldObj , Object newObj ) { if ( nest != null ) { return nest . replace ( oldObj , newObj ) ; } else { int sz = elements . size ( ) ; for ( int i = 0 ; i < sz ; i ++ ) { if ( elements . get ( i ) == oldObj ) { elements . set ( i , newObj ) ; return true ; } } } return false ; } | Replace an object within the composite . |
122,892 | public synchronized void log ( String formattedLog ) { if ( _reopen || _out == null ) { stop ( ) ; start ( ) ; } try { _buffer . write ( formattedLog ) ; _buffer . write ( StringUtil . __LINE_SEPARATOR ) ; if ( _flushOn || _buffer . size ( ) > _bufferSize ) { _buffer . writeTo ( _out ) ; _buffer . resetWriter ( ) ; _ou... | Log a message . The formatted log string is written to the log sink . The default implementation writes the message to an outputstream . |
122,893 | public synchronized void start ( ) { _buffer = new ByteArrayISO8859Writer ( _bufferSize ) ; _reopen = false ; if ( _started ) return ; if ( _out == null && _filename != null ) { try { RolloverFileOutputStream rfos = new RolloverFileOutputStream ( _filename , _append , _retainDays ) ; _out = rfos ; } catch ( IOException... | Start a log sink . The default implementation does nothing |
122,894 | public synchronized void stop ( ) { _started = false ; if ( _out != null ) { try { if ( _buffer . size ( ) > 0 ) { _buffer . writeTo ( _out ) ; } _out . flush ( ) ; _buffer = null ; } catch ( Exception e ) { if ( _logImpl != null && _logImpl . getDebug ( ) ) e . printStackTrace ( ) ; } Thread . yield ( ) ; } if ( _out ... | Stop a log sink . An opportunity for subclasses to clean up . The default implementation does nothing |
122,895 | public String [ ] getPartNames ( ) { Set s = _partMap . keySet ( ) ; return ( String [ ] ) s . toArray ( new String [ s . size ( ) ] ) ; } | Get the part names . |
122,896 | public boolean contains ( String name ) { Part part = ( Part ) _partMap . get ( name ) ; return ( part != null ) ; } | Check if a named part is present |
122,897 | public String getString ( String name ) { List part = _partMap . getValues ( name ) ; if ( part == null ) return null ; if ( _encoding != null ) { try { return new String ( ( ( Part ) part . get ( 0 ) ) . _data , _encoding ) ; } catch ( UnsupportedEncodingException uee ) { if ( log . isDebugEnabled ( ) ) log . debug ( ... | Get the data of a part as a string . |
122,898 | public InputStream getInputStream ( String name ) { List part = ( List ) _partMap . getValues ( name ) ; if ( part == null ) return null ; return new ByteArrayInputStream ( ( ( Part ) part . get ( 0 ) ) . _data ) ; } | Get the data of a part as a stream . |
122,899 | public Hashtable getParams ( String name ) { List part = ( List ) _partMap . getValues ( name ) ; if ( part == null ) return null ; return ( ( Part ) part . get ( 0 ) ) . _headers ; } | Get the MIME parameters associated with a part . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.