idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
122,600 | public Email cc ( EmailAddress ... cc ) { for ( EmailAddress c : cc ) { recipient ( c , RecipientType . CC ) ; } return this ; } | Add a cc recipient address . |
122,601 | public Email bcc ( EmailAddress ... bcc ) { for ( EmailAddress b : bcc ) { recipient ( b , RecipientType . BCC ) ; } return this ; } | Add a bcc recipient address . |
122,602 | public < T extends Builder < ? extends MessageSender > > T sender ( Class < T > builderClass ) { return senderBuilderHelper . register ( builderClass ) ; } | Registers and configures sender through a dedicated builder . |
122,603 | public static boolean isInlineModeAllowed ( Element img , InlineMode mode ) { if ( ! img . attr ( INLINED_ATTR ) . isEmpty ( ) ) { return false ; } if ( ! img . attr ( INLINE_MODE_ATTR ) . isEmpty ( ) && ! img . attr ( INLINE_MODE_ATTR ) . equals ( mode . mode ( ) ) ) { return false ; } return true ; } | Checks if inlining mode is allowed on the provided element . |
122,604 | public CharsetBuilder convert ( String nioCharsetName , String cloudhopperCharset ) { mappings . add ( new CharsetMapping ( nioCharsetName , cloudhopperCharset ) ) ; return this ; } | Registers a charset conversion . Conversion is required by Cloudhopper in order to use a charset supported by the SMPP protocol . |
122,605 | public ResourceResolver getSupportingResolver ( String path ) { LOG . debug ( "Finding resolver for resource {}..." , path ) ; for ( ResourceResolver resolver : resolvers ) { if ( resolver . supports ( path ) ) { LOG . debug ( "{} can handle resource {}" , resolver , path ) ; return resolver ; } } LOG . debug ( "No res... | Find the first supporting resolver . |
122,606 | public List < ResourceResolver > buildResolvers ( ) { List < ResourceResolver > resolvers = new ArrayList < > ( ) ; resolvers . addAll ( customResolvers ) ; List < ResolverHelper > helpers = new ArrayList < > ( ) ; if ( classPath != null ) { helpers . add ( new ResolverHelper ( classPath . getLookups ( ) , classPath ) ... | Build the list of resource resolvers . |
122,607 | public CloudhopperBuilder port ( String ... port ) { for ( String p : port ) { if ( port != null ) { ports . add ( p ) ; } } return this ; } | Set the SMPP server port . |
122,608 | public CloudhopperBuilder interfaceVersion ( String ... version ) { for ( String v : version ) { if ( v != null ) { interfaceVersions . add ( v ) ; } } return this ; } | Set the SMPP protocol version . |
122,609 | public void addContentHandler ( Class < ? extends Content > clazz , JavaMailContentHandler handler ) { map . put ( clazz , handler ) ; } | Register a new content handler . |
122,610 | public void configure ( ) { Collections . sort ( configurers , new PriorityComparator ( ) ) ; for ( PrioritizedConfigurer configurer : configurers ) { configurer . getConfigurer ( ) . configure ( this ) ; } } | Apply all registered configurers on this builder instance . |
122,611 | public MessagingService build ( ) { LOG . info ( "Using service that calls all registered senders" ) ; List < ConditionalSender > senders = buildSenders ( ) ; LOG . debug ( "Registered senders: {}" , senders ) ; MessagingService service = new EverySupportingMessagingService ( senders ) ; if ( wrapUncaught ) { service =... | Builds the messaging service . The messaging service relies on the generated senders . Each sender is able to manage one or multiple messages . The default implementation of the messaging service is to ask each sender if it is able to handle the message and if it the case then use this sender to really send the message... |
122,612 | public void addResourceHandler ( Class < ? extends NamedResource > clazz , JavaMailAttachmentResourceHandler handler ) { map . put ( clazz , handler ) ; } | Register a new attachment resource handler . |
122,613 | public boolean exists ( String className ) { if ( this . classLoader != null ) { if ( exists ( className , this . classLoader ) ) { LOG . debug ( "class {} found using class specific class loader" , className ) ; return true ; } return false ; } if ( existsWithDefaultClassLoader ( className ) ) { LOG . debug ( "class {... | Test if the class name is defined in the classpath . |
122,614 | public EqualsBuilder append ( Object objectFieldValue , Object otherFieldValue ) { if ( equals && ! same ) { delegate . append ( objectFieldValue , otherFieldValue ) ; } return this ; } | Test if two Objects are equal using their equals method . |
122,615 | public final FluentCondition < T > and ( Condition < T > ... conditions ) { List < Condition < T > > merged = new ArrayList < > ( ) ; merged . add ( delegate ) ; for ( Condition < T > condition : conditions ) { merged . add ( condition ) ; } return Conditions . and ( merged ) ; } | Create a logical AND operator between current condition and conditions provided in parameters . |
122,616 | public FixedDelayBuilder < RetryBuilder < P > > fixedDelay ( ) { if ( fixedDelay == null ) { fixedDelay = new FixedDelayBuilder < > ( this , environmentBuilder ) ; } return fixedDelay ; } | Retry several times with a fixed delay between each try until the maximum attempts is reached . |
122,617 | public UsernamePasswordAuthenticatorBuilder username ( String ... username ) { for ( String u : username ) { if ( u != null && ! u . isEmpty ( ) ) { usernames . add ( u ) ; } } return this ; } | Set the username to use for the authentication . |
122,618 | public UsernamePasswordAuthenticatorBuilder password ( String ... password ) { for ( String p : password ) { if ( p != null && ! p . isEmpty ( ) ) { passwords . add ( p ) ; } } return this ; } | Set the password to use for the authentication . |
122,619 | public FixedDelayBuilder < P > maxRetries ( String ... maxRetries ) { for ( String m : maxRetries ) { if ( m != null ) { maxRetriesProps . add ( m ) ; } } return this ; } | Set the maximum number of attempts . |
122,620 | private void handleResponse ( Sms message , Response response ) throws IOException , JsonProcessingException , MessageNotSentException { if ( response . getStatus ( ) . isSuccess ( ) ) { JsonNode json = mapper . readTree ( response . getBody ( ) ) ; int ovhStatus = json . get ( "status" ) . asInt ( ) ; if ( ovhStatus >... | Handle OVH response . If status provided in response is less than 200 then the message has been sent . Otherwise the message has not been sent . |
122,621 | private static List < String > convert ( List < Recipient > recipients ) throws PhoneNumberException { List < String > tos = new ArrayList < > ( recipients . size ( ) ) ; for ( Recipient recipient : recipients ) { tos . add ( toInternational ( recipient . getPhoneNumber ( ) ) ) ; } return tos ; } | Convert the list of SMS recipients to international phone numbers usable by OVH . |
122,622 | public OvhSmsBuilder url ( String ... url ) { for ( String u : url ) { if ( u != null ) { urls . add ( u ) ; } } return this ; } | Set the URL of the OVH SMS HTTP API . |
122,623 | public OvhSmsBuilder account ( String ... account ) { for ( String a : account ) { if ( a != null ) { accounts . add ( a ) ; } } return this ; } | Set the OVH account identifier . |
122,624 | public OvhSmsBuilder login ( String ... login ) { for ( String l : login ) { if ( l != null ) { logins . add ( l ) ; } } return this ; } | Set the OVH username . |
122,625 | public OvhSmsBuilder password ( String ... password ) { for ( String p : password ) { if ( p != null ) { passwords . add ( p ) ; } } return this ; } | Set the OVH password . |
122,626 | public SendGridContentHandler register ( final Class < ? extends Content > clazz , final SendGridContentHandler handler ) { if ( handler == null ) { throw new IllegalArgumentException ( "[handler] cannot be null" ) ; } if ( clazz == null ) { throw new IllegalArgumentException ( "[clazz] cannot be null" ) ; } LOG . debu... | Registers a handler for a given content type . |
122,627 | public FreemarkerConfigurationBuilder < MYSELF > configuration ( ) { if ( configurationBuilder == null ) { configurationBuilder = new FreemarkerConfigurationBuilder < > ( myself , environmentBuilder ) ; } return configurationBuilder ; } | Fluent configurer for Freemarker configuration . |
122,628 | private MimeMessage createMimeMessage ( ) { Session session = Session . getInstance ( properties , authenticator ) ; return new MimeMessage ( session ) ; } | Initialize the session and create the mime message . |
122,629 | private void setFrom ( Email email , MimeMessage mimeMsg ) throws MessagingException , AddressException , UnsupportedEncodingException { if ( email . getFrom ( ) == null ) { throw new IllegalArgumentException ( "The sender address has not been set" ) ; } mimeMsg . setFrom ( toInternetAddress ( email . getFrom ( ) ) ) ;... | Set the sender address on the mime message . |
122,630 | private void setRecipients ( Email email , MimeMessage mimeMsg ) throws MessagingException , AddressException , UnsupportedEncodingException { for ( Recipient recipient : email . getRecipients ( ) ) { mimeMsg . addRecipient ( convert ( recipient . getType ( ) ) , toInternetAddress ( recipient . getAddress ( ) ) ) ; } } | Set the recipients addresses on the mime message . |
122,631 | private void setMimeContent ( Email email , MimeMessage mimeMsg ) throws MessagingException , ContentHandlerException , AttachmentResourceHandlerException { LOG . debug ( "Add message content for email {}" , email ) ; MimeMultipart rootContainer = new MimeMultipart ( "mixed" ) ; MimeMultipart relatedContainer = new Mim... | Set the content on the mime message . |
122,632 | private void addAttachment ( Multipart multipart , Attachment attachment ) throws AttachmentResourceHandlerException { MimeBodyPart part = new MimeBodyPart ( ) ; try { part . setFileName ( attachment . getResource ( ) . getName ( ) ) ; part . setDisposition ( attachment . getDisposition ( ) ) ; part . setDescription ( ... | Add an attachment on the mime message . |
122,633 | public final MultiImplementationSender < M > addImplementation ( Condition < Message > condition , MessageSender implementation ) { implementations . add ( new Implementation ( condition , implementation ) ) ; return this ; } | Register a new possible implementation with the associated condition . The implementation is added at the end so any other possible implementation will be used before this one if the associated condition allow it . |
122,634 | public JavaMailBuilder port ( String ... port ) { for ( String p : port ) { if ( p != null ) { ports . add ( p ) ; } } return this ; } | Set the mail server port . |
122,635 | public JavaMailBuilder charset ( String ... charsets ) { for ( String c : charsets ) { if ( c != null ) { this . charsets . add ( c ) ; } } return this ; } | Set charset to use for email body . |
122,636 | private void internStyles ( Document doc , List < ExternalCss > cssContents ) { Elements els = doc . select ( CSS_LINKS_SELECTOR ) ; for ( Element e : els ) { if ( ! TRUE_VALUE . equals ( e . attr ( SKIP_INLINE ) ) ) { String path = e . attr ( HREF_ATTR ) ; Element style = new Element ( Tag . valueOf ( STYLE_TAG ) , ""... | Replace link tags with style tags in order to keep the same inclusion order |
122,637 | private static List < Parameter > convert ( Map < String , Object > map ) { Set < Entry < String , Object > > entries = map . entrySet ( ) ; List < Parameter > parameters = new ArrayList < > ( entries . size ( ) ) ; for ( Entry < String , Object > entry : entries ) { if ( entry . getValue ( ) != null ) { parameters . a... | Convert the map into a list of parameters |
122,638 | public final SimpleContext addValue ( String variable , Object value ) { variables . put ( variable , value ) ; return this ; } | Add a new variable entry . |
122,639 | public static void ignoreSslIssues ( final HttpObjectConfig . Execution execution ) { execution . setSslContext ( acceptingSslContext ( ) ) ; execution . setHostnameVerifier ( ANY_HOSTNAME ) ; } | Configuration helper used to ignore any SSL certificate - related issues by configuring an SSLContext that allows everything . |
122,640 | public UriBuilder setPath ( final String str ) { final String [ ] parts ; if ( str . startsWith ( "/" ) ) { parts = new String [ ] { str } ; } else { final String base = getPath ( ) . toString ( ) ; parts = new String [ ] { base , base . endsWith ( "/" ) ? "" : "/" , str } ; } return setPath ( new GStringImpl ( EMPTY ,... | Sets the path part of the URI . |
122,641 | public URI toURI ( ) throws URISyntaxException { final String scheme = traverse ( this , UriBuilder :: getParent , UriBuilder :: getScheme , Traverser :: notNull ) ; final Integer port = traverse ( this , UriBuilder :: getParent , UriBuilder :: getPort , notValue ( DEFAULT_PORT ) ) ; final String host = traverse ( this... | Converts the parts of the UriBuilder to the URI object instance . |
122,642 | private static Map < String , Collection < String > > extractQueryMap ( final String queryString ) { final Map < String , Collection < String > > map = new HashMap < > ( ) ; for ( final String nvp : queryString . split ( "&" ) ) { final String [ ] pair = nvp . split ( "=" ) ; map . computeIfAbsent ( pair [ 0 ] , k -> {... | does not do any encoding |
122,643 | public MultipartContent part ( String fieldName , String value ) { return part ( fieldName , null , ContentTypes . TEXT . getAt ( 0 ) , value ) ; } | Configures a field part with the given field name and value . |
122,644 | public static HttpBuilder configure ( final Function < HttpObjectConfig , ? extends HttpBuilder > factory , @ DelegatesTo ( HttpObjectConfig . class ) final Closure closure ) { HttpObjectConfig impl = new HttpObjectConfigImpl ( ) ; closure . setDelegate ( impl ) ; closure . setResolveStrategy ( Closure . DELEGATE_FIRST... | Creates an HttpBuilder configured with the provided configuration closure using the defaultFactory as the client factory . |
122,645 | public static HttpBuilder configure ( final Function < HttpObjectConfig , ? extends HttpBuilder > factory , final Consumer < HttpObjectConfig > configuration ) { HttpObjectConfig impl = new HttpObjectConfigImpl ( ) ; configuration . accept ( impl ) ; return factory . apply ( impl ) ; } | Creates an HttpBuilder using the provided client factory function configured with the provided configuration function . |
122,646 | public < T > T get ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . GET ) . apply ( configureRequest ( type , HttpVerb . GET , closure ) , this :: doGet ) ) ; } | Executes a GET request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,647 | public < T > T get ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . GET ) . apply ( configureRequest ( type , HttpVerb . GET , configuration ) , this :: doGet ) ) ; } | Executes a GET request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,648 | public < T > T head ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . HEAD ) . apply ( configureRequest ( type , HttpVerb . HEAD , configuration ) , this :: doHead ) ) ; } | Executes a HEAD request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,649 | public < T > T post ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . POST ) . apply ( configureRequest ( type , HttpVerb . POST , closure ) , this :: doPost ) ) ; } | Executes an POST request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,650 | public < T > T post ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . POST ) . apply ( configureRequest ( type , HttpVerb . POST , configuration ) , this :: doPost ) ) ; } | Executes a POST request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,651 | public < T > T put ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . PUT ) . apply ( configureRequest ( type , HttpVerb . PUT , closure ) , this :: doPut ) ) ; } | Executes an PUT request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,652 | public < T > T put ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . PUT ) . apply ( configureRequest ( type , HttpVerb . PUT , configuration ) , this :: doPut ) ) ; } | Executes a PUT request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,653 | public < T > T delete ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . DELETE ) . apply ( configureRequest ( type , HttpVerb . DELETE , closure ) , this :: doDelete ) ) ; } | Executes an DELETE request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,654 | public < T > T delete ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . DELETE ) . apply ( configureRequest ( type , HttpVerb . DELETE , configuration ) , this :: doDelete ) ) ; } | Executes a DELETE request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,655 | public < T > T patch ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . PATCH ) . apply ( configureRequest ( type , HttpVerb . PATCH , closure ) , this :: doPatch ) ) ; } | Executes a PATCH request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,656 | public < T > T patch ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . PATCH ) . apply ( configureRequest ( type , HttpVerb . PATCH , configuration ) , this :: doPatch ) ) ; } | Executes a PATCH request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,657 | public < T > T options ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . OPTIONS ) . apply ( configureRequest ( type , HttpVerb . OPTIONS , configuration ) , this :: doOptions ) ) ; } | Executes a OPTIONS request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,658 | public < T > T trace ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { return type . cast ( interceptors . get ( HttpVerb . TRACE ) . apply ( configureRequest ( type , HttpVerb . TRACE , closure ) , this :: doTrace ) ) ; } | Executes a TRACE request on the configured URI with additional configuration provided by the configuration closure . The result will be cast to the specified type . |
122,659 | public < T > T trace ( final Class < T > type , final Consumer < HttpConfig > configuration ) { return type . cast ( interceptors . get ( HttpVerb . TRACE ) . apply ( configureRequest ( type , HttpVerb . TRACE , configuration ) , this :: doTrace ) ) ; } | Executes a TRACE request on the configured URI with additional configuration provided by the configuration function . The result will be cast to the specified type . |
122,660 | 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 |
122,661 | 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 = domai... | shamelessly copied from jdk8 source code for InMemoryCookieStore |
122,662 | 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... | Used to parse the server response content using the OpenCsv parser . |
122,663 | 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 ( ) ... | Used to encode the request content using the OpenCsv writer . |
122,664 | 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 Propert... | each cookie store controls its own directory we do not need to synchronize |
122,665 | @ 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 ( ) , ... | Used to parse the server response content using the Jackson JSON parser . |
122,666 | @ 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 . act... | Used to encode the request content using the Jackson JSON encoder . |
122,667 | 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 . |
122,668 | 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 . |
122,669 | public static void toFile ( final HttpConfig config , final File file ) { toFile ( config , ContentTypes . ANY . getAt ( 0 ) , file ) ; } | Downloads the content to a specified file . |
122,670 | 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 . |
122,671 | public static void toStream ( final HttpConfig config , final OutputStream ostream ) { toStream ( config , ContentTypes . ANY . getAt ( 0 ) , ostream ) ; } | Downloads the content into an OutputStream . |
122,672 | 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 . |
122,673 | 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 . |
122,674 | public final Page setBackGroundColor ( String color ) { properties . put ( BgColour , color ) ; attribute ( "bgcolor" , color ) ; return this ; } | Set page background color . |
122,675 | 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 . |
122,676 | 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> . |
122,677 | 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 ) ; o... | 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 . |
122,678 | 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 |
122,679 | 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 . |
122,680 | 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... | 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 . |
122,681 | 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 . |
122,682 | public String getServerAddr ( ) { if ( _connection instanceof Socket ) return ( ( Socket ) _connection ) . getLocalAddress ( ) . getHostAddress ( ) ; return _listener . getHost ( ) ; } | Get the listeners HttpServer . |
122,683 | 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 ( ... | Setup the reponse output stream . Use the current state of the request and response to set tranfer parameters such as chunking and content length . |
122,684 | 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 . |
122,685 | 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 . |
122,686 | 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 ) _inputStrea... | Destroy the connection . called by handle when handleNext returns false . |
122,687 | 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 . |
122,688 | 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 IllegalArgumentEx... | Dispatch type from name |
122,689 | 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 . |
122,690 | 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 . a... | Set proxy host white list . |
122,691 | 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 . |
122,692 | 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 . a... | Set proxy host black list . |
122,693 | 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 . |
122,694 | 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 . |
122,695 | 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 . |
122,696 | 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 . |
122,697 | 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 ) ... | Is scheme host & port Forbidden . |
122,698 | 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... | Add a mapping from a pathSpec to a Filter . |
122,699 | 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 Fi... | Add a servlet filter mapping |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.