idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
2,700 | protected ClassLoader initClassLoader ( String baseDirPath ) throws MalformedURLException { File webAppClasses = new File ( baseDirPath + WEB_INF_CLASSES_DIR_PATH ) ; File [ ] webAppLibs = new File ( baseDirPath + WEB_INF_LIB_DIR_PATH ) . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String na... | Initialize the classloader |
2,701 | protected ServletContext initServletContext ( Document webXmlDoc , String baseDirPath , String tmpDirPath , String springConfigFiles , String servletAPIversion ) { MockServletContext servletContext = new MockServletContext ( servletAPIversion , baseDirPath , tmpDirPath ) ; Map < String , Object > servletContextInitPara... | Initalize the servlet context |
2,702 | protected List < ServletDefinition > getWebXmlServletDefinitions ( Document webXmlDoc , ServletContext servletContext , List < String > servletsToInitialize , ClassLoader webAppClassLoader ) throws ClassNotFoundException { NodeList servletNodes = webXmlDoc . getElementsByTagName ( SERVLET_TAG_NAME ) ; List < ServletDef... | Returns the list of servlet definition which must be initialize |
2,703 | protected List < ServletDefinition > initJawrSpringControllers ( ServletContext servletContext ) throws ServletException { SpringControllerBundleProcessor springBundleProcessor = new SpringControllerBundleProcessor ( ) ; return springBundleProcessor . initJawrSpringServlets ( servletContext ) ; } | Initialize the Jawr spring controller |
2,704 | protected List < ServletDefinition > initServlets ( List < ServletDefinition > servletDefinitions ) throws Exception { Collections . sort ( servletDefinitions ) ; ThreadLocalJawrContext . setBundleProcessingAtBuildTime ( true ) ; List < ServletDefinition > jawrServletDefinitions = new ArrayList < ServletDefinition > ( ... | Initialize the servlets and returns only the list of Jawr servlets |
2,705 | protected void initializeInitParams ( Node initParamNode , Map < String , Object > initParameters ) { String paramName = null ; String paramValue = null ; NodeList childNodes = initParamNode . getChildNodes ( ) ; for ( int j = 0 ; j < childNodes . getLength ( ) ; j ++ ) { Node childNode = childNodes . item ( j ) ; Stri... | Initialize the init parameters define in the servlet config |
2,706 | protected void processJawrServlets ( String destDirPath , List < ServletDefinition > jawrServletDefinitions , boolean keepUrlMapping ) throws Exception { String appRootDir = "" ; String jsServletMapping = "" ; String cssServletMapping = "" ; String binaryServletMapping = "" ; for ( Iterator < ServletDefinition > iterat... | Process the Jawr Servlets |
2,707 | protected void createApacheRewriteConfigFile ( String cdnDestDirPath , String appRootDir , String jsServletMapping , String cssServletMapping , String imgServletMapping ) throws IOException { BufferedReader templateFileReader = null ; FileWriter fileWriter = null ; try { templateFileReader = new BufferedReader ( new In... | Create the apache rewrite configuration file |
2,708 | protected void createBundles ( HttpServlet servlet , ResourceBundlesHandler bundleHandler , String destDirPath , String servletMapping , boolean keepUrlMapping ) throws IOException , ServletException { List < JoinableResourceBundle > bundles = bundleHandler . getContextBundles ( ) ; Iterator < JoinableResourceBundle > ... | Creates the bundles in the destination directory |
2,709 | protected void setRequestUrl ( MockServletRequest request , Map < String , String > variantMap , String path , JawrConfig config ) { String domainURL = JawrConstant . HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL ; if ( JawrConstant . SSL . equals ( variantMap . get ( JawrConstant . CONNECTION_TYPE_VARIANT_TYPE ) ) ) { if ( Str... | Set the request URL |
2,710 | public String getFinalBundlePath ( String path , JawrConfig jawrConfig , Map < String , String > variantMap ) { String finalPath = path ; int jawrGenerationParamIdx = finalPath . indexOf ( JawrRequestHandler . GENERATION_PARAM ) ; if ( jawrGenerationParamIdx != - 1 ) { try { finalPath = URLDecoder . decode ( path , "UT... | Retrieves the final path where the servlet mapping and the cache prefix have been removed and take also in account the jawr generator URLs . |
2,711 | public String getImageFinalPath ( String path , JawrConfig jawrConfig ) { String finalPath = path ; finalPath = removeServletMappingFromPath ( finalPath , jawrConfig . getServletMapping ( ) ) ; if ( finalPath . startsWith ( "/" ) ) { finalPath = finalPath . substring ( 1 ) ; } int idx = finalPath . indexOf ( "/" ) ; fi... | Retrieves the image final path where the servlet mapping and the cache prefix have been removed |
2,712 | protected String removeServletMappingFromPath ( String path , String mapping ) { if ( mapping != null && mapping . length ( ) > 0 ) { int idx = path . indexOf ( mapping ) ; if ( idx > - 1 ) { path = path . substring ( idx + mapping . length ( ) ) ; } path = PathNormalizer . asPath ( path ) ; } return path ; } | Remove the servlet mapping from the path |
2,713 | protected void createBinaryBundle ( HttpServlet servlet , BinaryResourcesHandler binaryRsHandler , String destDirPath , ServletConfig servletConfig , boolean keepUrlMapping ) throws IOException , ServletException { Map < String , String > bundleImgMap = binaryRsHandler . getBinaryPathMap ( ) ; Iterator < String > bundl... | Create the image bundle |
2,714 | protected void createBundleFile ( HttpServlet servlet , MockServletResponse response , MockServletRequest request , String path , File destFile , String mapping ) throws IOException , ServletException { request . setRequestPath ( mapping , path ) ; if ( ! destFile . getParentFile ( ) . exists ( ) ) { boolean dirsCreate... | Create the bundle file |
2,715 | protected List < RenderedLink > createLinkToBundle ( ResourceBundlesHandler handler , String path , String resourceType , Map < String , String > variantMap ) throws IOException { ArrayList < RenderedLink > linksToBundle = new ArrayList < RenderedLink > ( ) ; BasicBundleRenderer bundleRenderer = new BasicBundleRenderer... | Returns the link to the bundle |
2,716 | public static FilePathMapping buildFilePathMapping ( String path , ResourceReaderHandler rsHandler ) { return buildFilePathMapping ( null , path , rsHandler ) ; } | Builds the File path mapping |
2,717 | public static FilePathMapping buildFilePathMapping ( JoinableResourceBundle bundle , String path , ResourceReaderHandler rsHandler ) { FilePathMapping fPathMapping = null ; String filePath = rsHandler . getFilePath ( path ) ; if ( filePath != null ) { File f = new File ( filePath ) ; if ( f . exists ( ) ) { fPathMappin... | Builds the File path mapping and add it to the file mappings of the bundle |
2,718 | public StringBuffer minifyStringBuffer ( StringBuffer sb , Charset charset ) throws IOException , JSMinException { byte [ ] bundleBytes = sb . toString ( ) . getBytes ( charset . name ( ) ) ; ByteArrayInputStream bIs = new ByteArrayInputStream ( bundleBytes ) ; ByteArrayOutputStream bOs = new ByteArrayOutputStream ( ) ... | Utility method for components that need to use JSMin in a different context other than bundle postprocessing . |
2,719 | private StringBuffer byteArrayToString ( Charset charset , byte [ ] minified ) throws IOException { ReadableByteChannel chan = Channels . newChannel ( new ByteArrayInputStream ( minified ) ) ; Reader rd = Channels . newReader ( chan , charset . newDecoder ( ) , - 1 ) ; StringWriter writer = new StringWriter ( ) ; IOUti... | Convert a byte array to a String buffer taking into account the charset |
2,720 | public final static JsBundleLinkRenderer getJsBundleRenderer ( ResourceBundlesHandler bundler , String type , Boolean useRandomParam , Boolean async , Boolean defer , String crossorigin ) { JsBundleLinkRenderer renderer = ( JsBundleLinkRenderer ) ClassLoaderResourceUtils . buildObjectInstance ( bundler . getConfig ( ) ... | Returns the JS Bundle renderer |
2,721 | public final static CssBundleLinkRenderer getCssBundleRenderer ( ResourceBundlesHandler bundler , Boolean useRandomParam , String media , boolean alternate , boolean displayAlternateStyles , String title ) { CssBundleLinkRenderer renderer = ( CssBundleLinkRenderer ) ClassLoaderResourceUtils . buildObjectInstance ( bund... | Returns the CSS Bundle renderer |
2,722 | public final static ImgRenderer getImgRenderer ( JawrConfig config , boolean isPlainImg ) { ImgRenderer renderer = ( ImgRenderer ) ClassLoaderResourceUtils . buildObjectInstance ( config . getImgRendererClass ( ) ) ; renderer . init ( isPlainImg ) ; return renderer ; } | Returns the image renderer |
2,723 | public Reader createResource ( GeneratorContext context ) { InputStream is = createStreamResource ( context ) ; ReadableByteChannel chan = Channels . newChannel ( is ) ; return Channels . newReader ( chan , context . getCharset ( ) . newDecoder ( ) , - 1 ) ; } | Finds a resource from the classpath and returns a reader on it . |
2,724 | public InputStream createStreamResource ( GeneratorContext context ) { InputStream is = null ; try { String resourcePath = context . getPath ( ) ; String path = getCompletePath ( resourcePath ) ; is = ClassLoaderResourceUtils . getResourceAsStream ( path , this ) ; } catch ( FileNotFoundException e ) { throw new Bundli... | Finds a resource from the classpath and returns an input stream on it . |
2,725 | private String getCompletePath ( String resourcePath ) { String path = PathNormalizer . normalizePath ( classpathPrefix + resourcePath ) ; return path ; } | Returns the complete path with the classpath prefix |
2,726 | private Set < String > getResourceNamesFromJar ( String path , URL resourceURL ) { URLConnection con = null ; try { if ( resourceURL . toString ( ) . startsWith ( JawrConstant . JAR_URL_PREFIX ) ) { con = resourceURL . openConnection ( ) ; } } catch ( IOException e ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debu... | Returns the resources name from a Jar file . |
2,727 | public Map < String , List < String > > filterPathSet ( Collection < String > paths ) { Map < String , List < String > > expressions = new HashMap < > ( ) ; List < String > toRemove = new ArrayList < > ( ) ; for ( Iterator < String > it = paths . iterator ( ) ; it . hasNext ( ) ; ) { String path = it . next ( ) ; if ( ... | Finds all the paths in a collection which contain IE conditional comment syntax extracts all of them from the collection . |
2,728 | private String createExpressionKey ( String suffix ) { String [ ] parts = suffix . split ( "_" ) ; StringBuilder ret = new StringBuilder ( "[if " ) ; boolean ieAdded = false ; for ( String part : parts ) { if ( "" . equals ( part ) ) { continue ; } if ( "ie" . equals ( part ) ) { break ; } else if ( Pattern . matches (... | Creates an IE conditional expression by transforming the suffix of a filename . |
2,729 | private HttpServletResponse getHttpServletResponseUrlEncoder ( final Response response ) { return new HttpServletResponse ( ) { public void setLocale ( Locale loc ) { } public void setContentType ( String type ) { } public void setContentLength ( int len ) { } public void setBufferSize ( int size ) { } public void rese... | Returns the HttpServletResponse which will be used to encode the URL |
2,730 | private void addLinkedResource ( FilePathMapping linkedResource ) { linkedResources . add ( linkedResource ) ; if ( parent != null ) { parent . addLinkedResource ( linkedResource ) ; } } | Adds a linked resource to the less source |
2,731 | private Reader getResourceReader ( String resource ) throws ResourceNotFoundException { List < Class < ? > > excluded = new ArrayList < > ( ) ; excluded . add ( ILessCssResourceGenerator . class ) ; return rsReaderHandler . getResource ( bundle , resource , false , excluded ) ; } | Returns the resource reader |
2,732 | public String getFinalFullBundlePath ( BundleProcessingStatus status ) { JawrConfig jawrConfig = status . getJawrConfig ( ) ; String bundleName = status . getCurrentBundle ( ) . getId ( ) ; String bundlePrefix = getBundlePrefix ( status , jawrConfig , bundleName ) ; String fullBundlePath = PathNormalizer . concatWebPat... | Returns the full path for the CSS bundle taking in account the css servlet path if defined the caching prefix and the url context path overridden |
2,733 | protected String getBundlePrefix ( BundleProcessingStatus status , JawrConfig jawrConfig , String bundleName ) { String bundlePrefix = status . getCurrentBundle ( ) . getBundlePrefix ( ) ; if ( bundlePrefix == null ) { bundlePrefix = "" ; } else { bundlePrefix = PathNormalizer . asPath ( bundlePrefix ) ; } if ( ! bundl... | Returns the bundle prefix |
2,734 | private Set < String > initExcludedPathList ( Set < String > paths ) { Set < String > toExclude = new HashSet < > ( ) ; if ( null == paths ) return toExclude ; for ( String path : paths ) { path = PathNormalizer . asPath ( path ) ; toExclude . add ( path ) ; } return toExclude ; } | Determine which paths are to be excluded based on a set of path mappings from the configuration . |
2,735 | protected void addBundlesToMapping ( ) throws DuplicateBundlePathException { Set < String > paths = rsHandler . getResourceNames ( baseDir ) ; for ( String path : paths ) { path = PathNormalizer . joinPaths ( baseDir , path ) ; if ( ! excludedPaths . contains ( path ) && rsHandler . isDirectory ( path ) ) { String bund... | Generates the resource bundles mapping expressions . |
2,736 | public List < String > getSortedResources ( ) { List < String > resources = new ArrayList < > ( ) ; try ( BufferedReader bf = new BufferedReader ( reader ) ) { String res ; while ( ( res = bf . readLine ( ) ) != null ) { String name = PathNormalizer . normalizePath ( res . trim ( ) ) ; for ( String available : availabl... | Creates a list with the ordered resource names and returns it . If a resource is not in the resources dir it is ignored . |
2,737 | public static String evalString ( String propertyName , String propertyValue , Tag tag , PageContext pageContext ) throws JspException { return ( String ) ExpressionEvaluatorManager . evaluate ( propertyName , propertyValue , String . class , tag , pageContext ) ; } | Evaluate the string EL expression passed as parameter |
2,738 | public static Boolean evalBoolean ( String propertyName , String propertyValue , Tag tag , PageContext pageContext ) throws JspException { return ( Boolean ) ExpressionEvaluatorManager . evaluate ( propertyName , propertyValue , Boolean . class , tag , pageContext ) ; } | Evaluate the boolean EL expression passed as parameter |
2,739 | public List < JoinableResourceBundle > getResourceBundles ( Properties properties ) { PropertiesConfigHelper props = new PropertiesConfigHelper ( properties , resourceType ) ; String fileExtension = "." + resourceType ; List < JoinableResourceBundle > customBundles = new ArrayList < > ( ) ; if ( null != props . getProp... | Returns the list of joinable resource bundle |
2,740 | private JoinableResourceBundle getBundleFromName ( String bundleName , List < JoinableResourceBundle > bundles ) { JoinableResourceBundle bundle = null ; List < String > names = new ArrayList < > ( ) ; names . add ( bundleName ) ; List < JoinableResourceBundle > result = getBundlesFromName ( names , bundles ) ; if ( ! ... | Returns a bundle using the bundle name from a list of bundles |
2,741 | private List < JoinableResourceBundle > getBundlesFromName ( List < String > names , List < JoinableResourceBundle > bundles ) { List < JoinableResourceBundle > resultBundles = new ArrayList < > ( ) ; for ( String name : names ) { for ( JoinableResourceBundle bundle : bundles ) { if ( bundle . getName ( ) . equals ( na... | Returns a list of bundles using the bundle names from a list of bundles |
2,742 | private void verifyIfBundleIsModified ( JoinableResourceBundleImpl bundle , List < String > mappings , PropertiesConfigHelper props ) { Map < String , VariantSet > variants = new TreeMap < > ( ) ; for ( String mapping : mappings ) { variants = VariantUtils . concatVariants ( variants , generatorRegistry . getAvailableV... | Verify f the bundle has been modified |
2,743 | private InclusionPattern getInclusionPattern ( PropertiesConfigHelper props , String bundleName ) { boolean isGlobal = Boolean . parseBoolean ( props . getCustomBundleProperty ( bundleName , PropertiesBundleConstant . BUNDLE_FACTORY_CUSTOM_GLOBAL_FLAG , "false" ) ) ; int order = 0 ; if ( isGlobal ) { order = Integer . ... | Returns the inclusion pattern for a bundle |
2,744 | protected boolean isBinaryResource ( String resourcePath ) { String extension = FileNameUtils . getExtension ( resourcePath ) ; if ( extension != null ) { extension = extension . toLowerCase ( ) ; } return MIMETypesSupport . getSupportedProperties ( this ) . containsKey ( extension ) ; } | Checks if the resource is an binary resource |
2,745 | private String addCacheBuster ( String url , BinaryResourcesHandler binaryRsHandler ) throws IOException { if ( binaryRsHandler != null ) { FilePathMappingUtils . buildFilePathMapping ( bundle , url , binaryRsHandler . getRsReaderHandler ( ) ) ; } String newUrl = null ; if ( binaryMapping != null ) { newUrl = binaryMap... | Adds the cache buster to the CSS image |
2,746 | protected String getBody ( HttpEntity entity , String enc ) throws IOException { final StringBuilder body = new StringBuilder ( ) ; String buffer = "" ; if ( entity != null ) { final BufferedReader reader = new BufferedReader ( new InputStreamReader ( entity . getContent ( ) , enc ) ) ; while ( ( buffer = reader . read... | Get the body . |
2,747 | protected Map < String , String > getHeaders ( HttpResponse resp ) { final Map < String , String > headersAndValues = new HashMap < String , String > ( ) ; final Header [ ] httpHeaders = resp . getAllHeaders ( ) ; for ( Header header : httpHeaders ) { headersAndValues . put ( header . getName ( ) , header . getValue ( ... | Get the headers from the response . |
2,748 | public static String convertToClob ( final String varchar ) { int startIndex = 0 ; int endIndex = Math . min ( startIndex + 4000 , varchar . length ( ) ) ; final StringBuilder clobs = new StringBuilder ( "TO_CLOB('" ) . append ( varchar . substring ( startIndex , endIndex ) ) . append ( "')" ) ; while ( endIndex < varc... | Generates the SQL to convert the given string to a CLOB . |
2,749 | public static String getOracleSrid ( final String srid , final Database database ) { final String oracleSrid ; if ( StringUtils . trimToNull ( srid ) == null ) { oracleSrid = null ; } else if ( EPSG_TO_ORACLE_MAP . containsKey ( srid ) ) { oracleSrid = EPSG_TO_ORACLE_MAP . get ( srid ) ; } else { oracleSrid = loadOracl... | Converts the given EPSG SRID to the corresponding Oracle SRID . |
2,750 | public static String loadOracleSrid ( final String srid , final Database database ) { final String oracleSrid ; final JdbcConnection jdbcConnection = ( JdbcConnection ) database . getConnection ( ) ; final Connection connection = jdbcConnection . getUnderlyingConnection ( ) ; Statement statement = null ; try { statemen... | Queries to the database to convert the given EPSG SRID to the corresponding Oracle SRID . |
2,751 | protected void dropSpatialIndexIfExists ( final String catalogName , final String schemaName , final String tableName , final Database database , final List < Sql > list ) { final DropSpatialIndexGeneratorGeoDB generator = new DropSpatialIndexGeneratorGeoDB ( ) ; final DropSpatialIndexStatement statement = new DropSpat... | Adds the SQL statement to drop the spatial index if it is present . |
2,752 | public ValidationErrors validate ( final DropSpatialIndexStatement statement , final Database database , final SqlGeneratorChain sqlGeneratorChain ) { final ValidationErrors validationErrors = new ValidationErrors ( ) ; validationErrors . checkRequiredField ( "tableName" , statement . getTableName ( ) ) ; return valida... | Ensures that the table name is populated . |
2,753 | public Sql [ ] generateSqlIfExists ( final DropSpatialIndexStatement statement , final Database database ) { final String catalogName = statement . getTableCatalogName ( ) ; final String schemaName = statement . getTableSchemaName ( ) ; final String tableName = statement . getTableName ( ) ; final SpatialIndexExistsPre... | Generates the SQL statement to drop the spatial index if it exists . |
2,754 | protected String generateCreateIndexSql ( final CreateSpatialIndexStatement statement , final Database database ) { final StringBuilder sql = new StringBuilder ( ) ; sql . append ( "CREATE INDEX " ) ; final String schemaName = statement . getTableSchemaName ( ) ; final String catalogName = statement . getTableCatalogNa... | Generates the SQL for creating the spatial index . |
2,755 | protected Collection < String > getParameters ( final CreateSpatialIndexStatement statement ) { final Collection < String > parameters = new ArrayList < String > ( ) ; if ( StringUtils . trimToNull ( statement . getGeometryType ( ) ) != null ) { final String gType = getGtype ( statement . getGeometryType ( ) . trim ( )... | Creates the parameters to the spatial index creation statement . |
2,756 | @ SuppressWarnings ( "deprecation" ) public static DefaultHttpClient getClientThatAllowAnyHTTPS ( ThreadSafeClientConnManager cm ) { final TrustManager easyTrustManager = new X509TrustManager ( ) { public void checkClientTrusted ( X509Certificate [ ] xcs , String string ) throws CertificateException { } public void che... | Get a HttpClient that accept any HTTP certificate . |
2,757 | public Set < CrawlerURL > get ( HTMLPageResponse theResponse ) { final String url = theResponse . getUrl ( ) ; Set < CrawlerURL > ahrefs = new HashSet < CrawlerURL > ( ) ; if ( theResponse . getResponseCode ( ) == HttpStatus . SC_OK ) { ahrefs = fetch ( AHREF , ABS_HREF , theResponse . getBody ( ) , url ) ; } return ah... | Get all ahref links within this page response . |
2,758 | protected Options getOptions ( ) { final Options options = super . getOptions ( ) ; final Option urlOption = new Option ( "u" , "the page that is the startpoint of the crawl, examle http://mydomain.com/mypage" ) ; urlOption . setLongOpt ( URL ) ; urlOption . setArgName ( "URL" ) ; urlOption . setRequired ( true ) ; url... | Get hold of the default options . |
2,759 | public Sql [ ] generateSql ( final InsertStatement statement , final Database database , final SqlGeneratorChain sqlGeneratorChain ) { for ( final Entry < String , Object > entry : statement . getColumnValues ( ) . entrySet ( ) ) { entry . setValue ( handleColumnValue ( entry . getValue ( ) , database ) ) ; } return su... | Find any fields that look like WKT or EWKT and replace them with the database - specific value . |
2,760 | public ValidationErrors validate ( final CreateSpatialIndexStatement statement , final Database database , final SqlGeneratorChain sqlGeneratorChain ) { final ValidationErrors validationErrors = new ValidationErrors ( ) ; validationErrors . checkRequiredField ( "tableName" , statement . getTableName ( ) ) ; validationE... | Ensures that the table name and columns are populated . |
2,761 | public static String convertToFunction ( final String wkt , final String srid , final Database database , final WktInsertOrUpdateGenerator generator ) { if ( wkt == null || wkt . equals ( "" ) ) { throw new IllegalArgumentException ( "The Well-Known Text cannot be null or empty" ) ; } if ( generator == null ) { throw n... | Converts the given Well - Known Text and SRID to the appropriate function call for the database . |
2,762 | public String getGeometryType ( ) { String geometryType = null ; if ( getParameters ( ) . length > 0 && getParameters ( ) [ 0 ] != null ) { geometryType = getParameters ( ) [ 0 ] . toString ( ) ; } return geometryType ; } | Returns the value geometry type parameter . |
2,763 | public Integer getSRID ( ) { Integer srid = null ; if ( getParameters ( ) . length > 1 && getParameters ( ) [ 1 ] != null ) { srid = Integer . valueOf ( getParameters ( ) [ 1 ] . toString ( ) ) ; } return srid ; } | Returns the value SRID parameter . |
2,764 | public HttpClient get ( ) { final ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager ( ) ; cm . setMaxTotal ( nrOfThreads ) ; cm . setDefaultMaxPerRoute ( maxToRoute ) ; final DefaultHttpClient client = HTTPSFaker . getClientThatAllowAnyHTTPS ( cm ) ; client . getParams ( ) . setParameter ( "http.socket.t... | Get the client . |
2,765 | public Map < String , String > createHeadersFromString ( String headersAndValues ) { if ( headersAndValues == null || headersAndValues . isEmpty ( ) ) return Collections . emptyMap ( ) ; final StringTokenizer token = new StringTokenizer ( headersAndValues , "@" ) ; final Map < String , String > theHeaders = new HashMap... | Create headers from a string . |
2,766 | public Set < Auth > createAuthsFromString ( String authInfo ) { if ( "" . equals ( authInfo ) || authInfo == null ) return Collections . emptySet ( ) ; String [ ] parts = authInfo . split ( "," ) ; final Set < Auth > auths = new HashSet < Auth > ( ) ; try { for ( String auth : parts ) { StringTokenizer tokenizer = new ... | Create a auth object from a String looking like . |
2,767 | protected String getHatboxTableName ( ) { final String tableName ; if ( ! StringUtils . hasUpperCase ( getTableName ( ) ) ) { tableName = getTableName ( ) + "_hatbox" ; } else { tableName = getTableName ( ) + "_HATBOX" ; } return tableName ; } | Generates the table name containing the Hatbox index . |
2,768 | public DatabaseObject getExample ( final Database database , final String tableName ) { final Schema schema = new Schema ( getCatalogName ( ) , getSchemaName ( ) ) ; final DatabaseObject example ; if ( database instanceof DerbyDatabase || database instanceof H2Database ) { final String correctedTableName = database . c... | Creates an example of the database object for which to check . |
2,769 | private static TrustManager [ ] getNonValidatingTrustManagers ( String [ ] acceptedIssuers ) { X509TrustManager x509TrustManager = new CustomX509TrustManager ( acceptedIssuers ) ; return new TrustManager [ ] { x509TrustManager } ; } | we want to allow self - signed certificates . |
2,770 | public String convertToFunction ( final String wkt , final String srid , final Database database ) { final String oracleWkt = OracleSpatialUtils . getOracleWkt ( wkt ) ; final String oracleSrid = OracleSpatialUtils . getOracleSrid ( srid , database ) ; return super . convertToFunction ( oracleWkt , oracleSrid , databas... | Handles the Well - Known Text and SRID for Oracle . |
2,771 | public CrawlerResult getUrls ( CrawlerConfiguration configuration ) { final Map < String , String > requestHeaders = configuration . getRequestHeadersMap ( ) ; final HTMLPageResponse resp = verifyInput ( configuration . getStartUrl ( ) , configuration . getOnlyOnPath ( ) , requestHeaders ) ; int level = 0 ; final Set <... | Get the urls . |
2,772 | protected Set < CrawlerURL > fetchNextLevelLinks ( Map < Future < HTMLPageResponse > , CrawlerURL > responses , Set < CrawlerURL > allUrls , Set < HTMLPageResponse > nonWorkingUrls , Set < HTMLPageResponse > verifiedUrls , String host , String onlyOnPath , String notOnPath ) { final Set < CrawlerURL > nextLevel = new L... | Fetch links to the next level of the crawl . |
2,773 | private void verifyUrls ( Set < CrawlerURL > allUrls , Set < HTMLPageResponse > verifiedUrls , Set < HTMLPageResponse > nonWorkingUrls , Map < String , String > requestHeaders ) { Set < CrawlerURL > urlsThatNeedsVerification = new LinkedHashSet < CrawlerURL > ( allUrls ) ; urlsThatNeedsVerification . removeAll ( verifi... | Verify that all urls in allUrls returns 200 . If not they will be removed from that set and instead added to the nonworking list . |
2,774 | public void setAdditionalHeaders ( Map < String , String > additionalHeaders ) { Map < String , String > newMap = new HashMap < > ( ) ; for ( Entry < String , String > e : additionalHeaders . entrySet ( ) ) { boolean found = false ; for ( String restrictedHeaderField : RESTRICTED_HTTP_HEADERS ) { if ( e . getKey ( ) . ... | Sets additional overall HTTP headers to add to the upload POST request . There s rarely a need to use this method . |
2,775 | protected void configure ( ) { super . configure ( ) ; bind ( Crawler . class ) . to ( DefaultCrawler . class ) ; bind ( ExecutorService . class ) . toProvider ( ExecutorServiceProvider . class ) ; bind ( HTMLPageResponseFetcher . class ) . to ( HTTPClientResponseFetcher . class ) ; bind ( HttpClient . class ) . toProv... | Bind the classes . |
2,776 | private static boolean byteSizeIsKnown ( Collection < ? extends UploadItem > uploadItems ) { for ( UploadItem uploadItem : uploadItems ) { if ( uploadItem . getSizeInBytes ( ) == - 1 ) { return false ; } } return true ; } | Determines if there are upload items where the size is unknown in advance . This means we cannot predict the total upload size . |
2,777 | public static boolean isWatchConnected ( final Context context ) { Cursor c = null ; try { c = queryProvider ( context ) ; if ( c == null || ! c . moveToNext ( ) ) { return false ; } return c . getInt ( KIT_STATE_COLUMN_CONNECTED ) == 1 ; } finally { if ( c != null ) { c . close ( ) ; } } } | Synchronously query the Pebble application to see if an active Bluetooth connection to a watch currently exists . |
2,778 | public static boolean areAppMessagesSupported ( final Context context ) { Cursor c = null ; try { c = queryProvider ( context ) ; if ( c == null || ! c . moveToNext ( ) ) { return false ; } return c . getInt ( KIT_STATE_COLUMN_APPMSG_SUPPORT ) == 1 ; } finally { if ( c != null ) { c . close ( ) ; } } } | Synchronously query the Pebble application to see if the connected watch is running a firmware version that supports PebbleKit messages . |
2,779 | public static FirmwareVersionInfo getWatchFWVersion ( final Context context ) { Cursor c = null ; try { c = queryProvider ( context ) ; if ( c == null || ! c . moveToNext ( ) ) { return null ; } int majorVersion = c . getInt ( KIT_STATE_COLUMN_VERSION_MAJOR ) ; int minorVersion = c . getInt ( KIT_STATE_COLUMN_VERSION_M... | Get the version information of the firmware running on a connected watch . |
2,780 | public static boolean isDataLoggingSupported ( final Context context ) { Cursor c = null ; try { c = queryProvider ( context ) ; if ( c == null || ! c . moveToNext ( ) ) { return false ; } return c . getInt ( KIT_STATE_COLUMN_DATALOGGING_SUPPORT ) == 1 ; } finally { if ( c != null ) { c . close ( ) ; } } } | Synchronously query the Pebble application to see if the connected watch is running a firmware version that supports PebbleKit data logging . |
2,781 | public static void startAppOnPebble ( final Context context , final UUID watchappUuid ) throws IllegalArgumentException { if ( watchappUuid == null ) { throw new IllegalArgumentException ( "uuid cannot be null" ) ; } final Intent startAppIntent = new Intent ( INTENT_APP_START ) ; startAppIntent . putExtra ( APP_UUID , ... | Send a message to the connected Pebble to launch an application identified by a UUID . If another application is currently running it will be terminated and the new application will be brought to the foreground . |
2,782 | public static void closeAppOnPebble ( final Context context , final UUID watchappUuid ) throws IllegalArgumentException { if ( watchappUuid == null ) { throw new IllegalArgumentException ( "uuid cannot be null" ) ; } final Intent stopAppIntent = new Intent ( INTENT_APP_STOP ) ; stopAppIntent . putExtra ( APP_UUID , wat... | Send a message to the connected Pebble to close an application identified by a UUID . If this application is not currently running the message is ignored . |
2,783 | public static void sendDataToPebble ( final Context context , final UUID watchappUuid , final PebbleDictionary data ) throws IllegalArgumentException { sendDataToPebbleWithTransactionId ( context , watchappUuid , data , - 1 ) ; } | Send one - or - more key - value pairs to the watch - app identified by the provided UUID . This is the primary method for sending data from the phone to a connected Pebble . |
2,784 | public static void sendDataToPebbleWithTransactionId ( final Context context , final UUID watchappUuid , final PebbleDictionary data , final int transactionId ) throws IllegalArgumentException { if ( watchappUuid == null ) { throw new IllegalArgumentException ( "uuid cannot be null" ) ; } if ( data == null ) { throw ne... | Send one - or - more key - value pairs to the watch - app identified by the provided UUID . |
2,785 | public static BroadcastReceiver registerPebbleConnectedReceiver ( final Context context , final BroadcastReceiver receiver ) { return registerBroadcastReceiverInternal ( context , INTENT_PEBBLE_CONNECTED , receiver ) ; } | A convenience function to assist in programatically registering a broadcast receiver for the CONNECTED intent . |
2,786 | public static BroadcastReceiver registerPebbleDisconnectedReceiver ( final Context context , final BroadcastReceiver receiver ) { return registerBroadcastReceiverInternal ( context , INTENT_PEBBLE_DISCONNECTED , receiver ) ; } | A convenience function to assist in programatically registering a broadcast receiver for the DISCONNECTED intent . |
2,787 | public static BroadcastReceiver registerReceivedDataHandler ( final Context context , final PebbleDataReceiver receiver ) { return registerBroadcastReceiverInternal ( context , INTENT_APP_RECEIVE , receiver ) ; } | A convenience function to assist in programatically registering a broadcast receiver for the RECEIVE intent . |
2,788 | public static BroadcastReceiver registerReceivedAckHandler ( final Context context , final PebbleAckReceiver receiver ) { return registerBroadcastReceiverInternal ( context , INTENT_APP_RECEIVE_ACK , receiver ) ; } | A convenience function to assist in programatically registering a broadcast receiver for the RECEIVE_ACK intent . |
2,789 | public static BroadcastReceiver registerReceivedNackHandler ( final Context context , final PebbleNackReceiver receiver ) { return registerBroadcastReceiverInternal ( context , INTENT_APP_RECEIVE_NACK , receiver ) ; } | A convenience function to assist in programatically registering a broadcast receiver for the RECEIVE_NACK intent . |
2,790 | private static BroadcastReceiver registerBroadcastReceiverInternal ( final Context context , final String action , final BroadcastReceiver receiver ) { if ( receiver == null ) { return null ; } IntentFilter filter = new IntentFilter ( action ) ; context . registerReceiver ( receiver , filter ) ; return receiver ; } | Register broadcast receiver internal . |
2,791 | public static BroadcastReceiver registerDataLogReceiver ( final Context context , final PebbleDataLogReceiver receiver ) { IntentFilter filter = new IntentFilter ( ) ; filter . addAction ( INTENT_DL_RECEIVE_DATA ) ; filter . addAction ( INTENT_DL_FINISH_SESSION ) ; context . registerReceiver ( receiver , filter ) ; ret... | A convenience function to assist in programatically registering a broadcast receiver for the DATA_AVAILABLE intent . |
2,792 | public static void requestDataLogsForApp ( final Context context , final UUID appUuid ) { final Intent requestIntent = new Intent ( INTENT_DL_REQUEST_DATA ) ; requestIntent . putExtra ( APP_UUID , appUuid ) ; context . sendBroadcast ( requestIntent ) ; } | A convenience function to emit an intent to pebble . apk to request the data logs for a particular app . If data is available pebble . apk will advertise the data via INTENT_DL_RECEIVE_DATA intents . |
2,793 | private static Cursor queryProvider ( final Context context ) { Cursor c = context . getContentResolver ( ) . query ( Constants . URI_CONTENT_BASALT , null , null , null , null ) ; if ( c != null ) { if ( c . moveToFirst ( ) ) { if ( c . getInt ( KIT_STATE_COLUMN_CONNECTED ) == 1 ) { c . moveToPrevious ( ) ; return c ;... | Query the Pebble ContentProvider - utility method for various PebbleKit helper methods |
2,794 | private int getPerPage ( Context context ) { return ( context . getResources ( ) . getDisplayMetrics ( ) . heightPixels / context . getResources ( ) . getDimensionPixelSize ( R . dimen . repo_item_height ) ) + 3 ; } | Get items to load per page onScroll . |
2,795 | public static GitHub getClient ( ) { RestAdapter restAdapter = new RestAdapter . Builder ( ) . setEndpoint ( API_URL ) . setLogLevel ( RestAdapter . LogLevel . BASIC ) . build ( ) ; return restAdapter . create ( GitHub . class ) ; } | Get github client . |
2,796 | public void addBytes ( int key , byte [ ] bytes ) { PebbleTuple t = PebbleTuple . create ( key , PebbleTuple . TupleType . BYTES , PebbleTuple . Width . NONE , bytes ) ; addTuple ( t ) ; } | Associate the specified byte array with the provided key in the dictionary . If another key - value pair with the same key is already present in the dictionary it will be replaced . |
2,797 | public void addString ( int key , String value ) { PebbleTuple t = PebbleTuple . create ( key , PebbleTuple . TupleType . STRING , PebbleTuple . Width . NONE , value ) ; addTuple ( t ) ; } | Associate the specified String with the provided key in the dictionary . If another key - value pair with the same key is already present in the dictionary it will be replaced . |
2,798 | public void addInt8 ( final int key , final byte b ) { PebbleTuple t = PebbleTuple . create ( key , PebbleTuple . TupleType . INT , PebbleTuple . Width . BYTE , b ) ; addTuple ( t ) ; } | Associate the specified signed byte with the provided key in the dictionary . If another key - value pair with the same key is already present in the dictionary it will be replaced . |
2,799 | public void addUint8 ( final int key , final byte b ) { PebbleTuple t = PebbleTuple . create ( key , PebbleTuple . TupleType . UINT , PebbleTuple . Width . BYTE , b ) ; addTuple ( t ) ; } | Associate the specified unsigned byte with the provided key in the dictionary . If another key - value pair with the same key is already present in the dictionary it will be replaced . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.