idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
151,800 | public Client findClient ( String clientUUID , Integer profileId ) throws Exception { Client client = null ; if ( clientUUID == null ) { clientUUID = "" ; } if ( clientUUID . compareTo ( Constants . PROFILE_CLIENT_DEFAULT_ID ) != 0 && ! clientUUID . matches ( "[\\w]{8}-[\\w]{4}-[\\w]{4}-[\\w]{4}-[\\w]{12}" ) ) { Client... | Returns a Client object for a clientUUID and profileId |
151,801 | private Client getClientFromResultSet ( ResultSet result ) throws Exception { Client client = new Client ( ) ; client . setId ( result . getInt ( Constants . GENERIC_ID ) ) ; client . setUUID ( result . getString ( Constants . CLIENT_CLIENT_UUID ) ) ; client . setFriendlyName ( result . getString ( Constants . CLIENT_F... | Returns a client model from a ResultSet |
151,802 | public Client setFriendlyName ( int profileId , String clientUUID , String friendlyName ) throws Exception { Client client = this . findClientFromFriendlyName ( profileId , friendlyName ) ; if ( client != null && ! client . getUUID ( ) . equals ( clientUUID ) ) { throw new Exception ( "Friendly name already in use" ) ;... | Set a friendly name for a client |
151,803 | public void updateActive ( int profileId , String clientUUID , Boolean active ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_CLIENT + " SET " + Constants . CLIEN... | disables the current active id enables the new one selected |
151,804 | public void reset ( int profileId , String clientUUID ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { String queryString = "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . GENERIC_CLIENT_UUID + "= ? " + " AND "... | Resets all override settings for the clientUUID and disables it |
151,805 | public String getProfileIdFromClientId ( int id ) { return ( String ) sqlService . getFromTable ( Constants . CLIENT_PROFILE_ID , Constants . GENERIC_ID , id , Constants . DB_TABLE_CLIENT ) ; } | gets the profile_name associated with a specific id |
151,806 | @ RequestMapping ( value = "/scripts" , method = RequestMethod . GET ) public String scriptView ( Model model ) throws Exception { return "script" ; } | Returns script view |
151,807 | @ RequestMapping ( value = "/api/scripts" , method = RequestMethod . GET ) public HashMap < String , Object > getScripts ( Model model , @ RequestParam ( required = false ) Integer type ) throws Exception { Script [ ] scripts = ScriptService . getInstance ( ) . getScripts ( type ) ; return Utils . getJQGridJSON ( scrip... | Returns all scripts |
151,808 | @ RequestMapping ( value = "/api/scripts" , method = RequestMethod . POST ) public Script addScript ( Model model , @ RequestParam ( required = true ) String name , @ RequestParam ( required = true ) String script ) throws Exception { return ScriptService . getInstance ( ) . addScript ( name , script ) ; } | Add a new script |
151,809 | @ RequestMapping ( value = "group" , method = RequestMethod . GET ) public String newGroupGet ( Model model ) { model . addAttribute ( "groups" , pathOverrideService . findAllGroups ( ) ) ; return "groups" ; } | Redirect to page |
151,810 | protected void createKeystore ( ) { java . security . cert . Certificate signingCert = null ; PrivateKey caPrivKey = null ; if ( _caCert == null || _caPrivKey == null ) { try { log . debug ( "Keystore or signing cert & keypair not found. Generating..." ) ; KeyPair caKeypair = getRSAKeyPair ( ) ; caPrivKey = caKeypair ... | Creates writes and loads a new keystore and CA root certificate . |
151,811 | public synchronized void addCertAndPrivateKey ( String hostname , final X509Certificate cert , final PrivateKey privKey ) throws KeyStoreException , CertificateException , NoSuchAlgorithmException { _ks . deleteEntry ( hostname ) ; _ks . setCertificateEntry ( hostname , cert ) ; _ks . setKeyEntry ( hostname , privKey ,... | Stores a new certificate and its associated private key in the keystore . |
151,812 | public synchronized X509Certificate getCertificateByHostname ( final String hostname ) throws KeyStoreException , CertificateParsingException , InvalidKeyException , CertificateExpiredException , CertificateNotYetValidException , SignatureException , CertificateException , NoSuchAlgorithmException , NoSuchProviderExcep... | Returns the aliased certificate . Certificates are aliased by their hostname . |
151,813 | public synchronized X509Certificate getMappedCertificate ( final X509Certificate cert ) throws CertificateEncodingException , InvalidKeyException , CertificateException , CertificateNotYetValidException , NoSuchAlgorithmException , NoSuchProviderException , SignatureException , KeyStoreException , UnrecoverableKeyExcep... | This method returns the duplicated certificate mapped to the passed in cert or creates and returns one if no mapping has yet been performed . If a naked public key has already been mapped that matches the key in the cert the already mapped keypair will be reused for the mapped cert . |
151,814 | public X509Certificate getMappedCertificateForHostname ( String hostname ) throws CertificateParsingException , InvalidKeyException , CertificateExpiredException , CertificateNotYetValidException , SignatureException , CertificateException , NoSuchAlgorithmException , NoSuchProviderException , KeyStoreException , Unrec... | This method returns the mapped certificate for a hostname or generates a standard SSL server certificate issued by the CA to the supplied subject if no mapping has been created . This is not a true duplication just a shortcut method that is adequate for web browsers . |
151,815 | public synchronized PrivateKey getPrivateKeyForLocalCert ( final X509Certificate cert ) throws CertificateEncodingException , KeyStoreException , UnrecoverableKeyException , NoSuchAlgorithmException { String thumbprint = ThumbprintUtil . getThumbprint ( cert ) ; return ( PrivateKey ) _ks . getKey ( thumbprint , _keypas... | For a cert we have generated return the private key . |
151,816 | public synchronized void mapPublicKeys ( final PublicKey original , final PublicKey substitute ) { _mappedPublicKeys . put ( original , substitute ) ; if ( persistImmediately ) { persistPublicKeyMap ( ) ; } } | Stores a public key mapping . |
151,817 | public Script getScript ( int id ) { PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = SQLService . getInstance ( ) . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_SCRIPT + " WHERE id = ?" ) ; statement . setIn... | Get the script for a given ID |
151,818 | public Script [ ] getScripts ( Integer type ) { ArrayList < Script > returnData = new ArrayList < > ( ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = SQLService . getInstance ( ) . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "SELECT * FROM " ... | Return all scripts of a given type |
151,819 | public Script updateName ( int id , String name ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = SQLService . getInstance ( ) . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_SCRIPT + " SET " + Constants . SCRIPT_NAME + " =... | Update the name of a script |
151,820 | public void removeScript ( int id ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = SQLService . getInstance ( ) . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_SCRIPT + " WHERE " + Constants . GENERIC_ID + " = ?" ) ; ... | Remove script for a given ID |
151,821 | public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { final ServletRequest r1 = request ; chain . doFilter ( request , new HttpServletResponseWrapper ( ( HttpServletResponse ) response ) { @ SuppressWarnings ( "unchecked" ) public void set... | This looks at the servlet attributes to get the list of response headers to remove while the response object gets created by the servlet |
151,822 | public static int [ ] arrayFromStringOfIntegers ( String str ) throws IllegalArgumentException { StringTokenizer tokenizer = new StringTokenizer ( str , "," ) ; int n = tokenizer . countTokens ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String token = tokenizer . nextToken ( ) ; list [ i ] =... | Split string of comma - delimited ints into an a int array |
151,823 | public static File copyResourceToLocalFile ( String sourceResource , String destFileName ) throws Exception { try { Resource keystoreFile = new ClassPathResource ( sourceResource ) ; InputStream in = keystoreFile . getInputStream ( ) ; File outKeyStoreFile = new File ( destFileName ) ; FileOutputStream fop = new FileOu... | Copies file from a resource to a local temp file |
151,824 | public static int getSystemPort ( String portIdentifier ) { int defaultPort = 0 ; if ( portIdentifier . compareTo ( Constants . SYS_API_PORT ) == 0 ) { defaultPort = Constants . DEFAULT_API_PORT ; } else if ( portIdentifier . compareTo ( Constants . SYS_DB_PORT ) == 0 ) { defaultPort = Constants . DEFAULT_DB_PORT ; } e... | Returns the port as configured by the system variables fallback is the default port value |
151,825 | public static String getPublicIPAddress ( ) throws Exception { final String IPV4_REGEX = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z" ; String ipAddr = null ; Enumeration e = NetworkInterface . getNetworkInterfaces ( ) ; while ( e . hasMoreElements ( ) ) { NetworkInterface n = ( Ne... | This function returns the first external IP address encountered |
151,826 | public Configuration getConfiguration ( String name ) { Configuration [ ] values = getConfigurations ( name ) ; if ( values == null ) { return null ; } return values [ 0 ] ; } | Get the value for a particular configuration property |
151,827 | public Configuration [ ] getConfigurations ( String name ) { ArrayList < Configuration > valuesList = new ArrayList < Configuration > ( ) ; logger . info ( "Getting data for {}" , name ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) {... | Get the values for a particular configuration property |
151,828 | @ RequestMapping ( value = "api/edit/disableAll" , method = RequestMethod . POST ) public String disableAll ( Model model , int profileID , @ RequestParam ( defaultValue = Constants . PROFILE_CLIENT_DEFAULT_ID ) String clientUUID ) { editService . disableAll ( profileID , clientUUID ) ; return null ; } | Disables all the overrides for a specific profile |
151,829 | @ RequestMapping ( value = "api/edit/repeatNumber" , method = RequestMethod . POST ) public String updateRepeatNumber ( Model model , int newNum , int path_id , @ RequestParam ( defaultValue = Constants . PROFILE_CLIENT_DEFAULT_ID ) String clientUUID ) throws Exception { logger . info ( "want to update repeat number of... | Calls a method from editService to update the repeat number for a path |
151,830 | @ RequestMapping ( value = "api/edit/enable/custom" , method = RequestMethod . POST ) public String enableCustomResponse ( Model model , String custom , int path_id , @ RequestParam ( defaultValue = Constants . PROFILE_CLIENT_DEFAULT_ID ) String clientUUID ) throws Exception { if ( custom . equals ( "undefined" ) ) ret... | Enables a custom response |
151,831 | @ RequestMapping ( value = "api/edit/disable" , method = RequestMethod . POST ) public String disableResponses ( Model model , int path_id , @ RequestParam ( defaultValue = Constants . PROFILE_CLIENT_DEFAULT_ID ) String clientUUID ) throws Exception { OverrideService . getInstance ( ) . disableAllOverrides ( path_id , ... | disables the responses for a given pathname and user id |
151,832 | public void startServer ( ) throws Exception { if ( ! externalDatabaseHost ) { try { this . port = Utils . getSystemPort ( Constants . SYS_DB_PORT ) ; server = Server . createTcpServer ( "-tcpPort" , String . valueOf ( port ) , "-tcpAllowOthers" ) . start ( ) ; } catch ( SQLException e ) { if ( e . toString ( ) . conta... | Only meant to be called once |
151,833 | public void stopServer ( ) throws Exception { if ( ! externalDatabaseHost ) { try ( Connection sqlConnection = getConnection ( ) ) { sqlConnection . prepareStatement ( "SHUTDOWN" ) . execute ( ) ; } catch ( Exception e ) { } try { server . stop ( ) ; } catch ( Exception e ) { } } } | Shutdown the server |
151,834 | public static SQLService getInstance ( ) throws Exception { if ( _instance == null ) { _instance = new SQLService ( ) ; _instance . startServer ( ) ; int dbPool = 20 ; if ( Utils . getEnvironmentOptionValue ( Constants . SYS_DATABASE_POOL_SIZE ) != null ) { dbPool = Integer . valueOf ( Utils . getEnvironmentOptionValue... | Obtain instance of the SQL Service |
151,835 | public void updateSchema ( String migrationPath ) { try { logger . info ( "Updating schema... " ) ; int current_version = 0 ; HashMap < String , Object > configuration = getFirstResult ( "SELECT * FROM " + Constants . DB_TABLE_CONFIGURATION + " WHERE " + Constants . DB_TABLE_CONFIGURATION_NAME + " = \'" + Constants . D... | Update database schema |
151,836 | public int executeUpdate ( String query ) throws Exception { int returnVal = 0 ; Statement queryStatement = null ; try ( Connection sqlConnection = getConnection ( ) ) { queryStatement = sqlConnection . createStatement ( ) ; returnVal = queryStatement . executeUpdate ( query ) ; } catch ( Exception e ) { } finally { tr... | Wrapped version of standard jdbc executeUpdate Pays attention to DB locked exception and waits up to 1s |
151,837 | public HashMap < String , Object > getFirstResult ( String query ) throws Exception { HashMap < String , Object > result = null ; Statement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = getConnection ( ) ) { queryStatement = sqlConnection . createStatement ( ) ; results = queryStat... | Gets the first row for a query |
151,838 | public Clob toClob ( String stringName , Connection sqlConnection ) { Clob clobName = null ; try { clobName = sqlConnection . createClob ( ) ; clobName . setString ( 1 , stringName ) ; } catch ( SQLException e ) { logger . info ( "Unable to create clob object" ) ; e . printStackTrace ( ) ; } return clobName ; } | Converts the given string to a clob object |
151,839 | private String [ ] getColumnNames ( ResultSetMetaData rsmd ) throws Exception { ArrayList < String > names = new ArrayList < String > ( ) ; int numColumns = rsmd . getColumnCount ( ) ; for ( int i = 1 ; i < numColumns + 1 ; i ++ ) { String columnName = rsmd . getColumnName ( i ) ; names . add ( columnName ) ; } return ... | Gets all of the column names for a result meta data |
151,840 | public List < ServerRedirect > tableServers ( int clientId ) { List < ServerRedirect > servers = new ArrayList < > ( ) ; try { Client client = ClientService . getInstance ( ) . getClient ( clientId ) ; servers = tableServers ( client . getProfile ( ) . getId ( ) , client . getActiveServerGroup ( ) ) ; } catch ( SQLExce... | Get the server redirects for a given clientId from the database |
151,841 | public List < ServerRedirect > tableServers ( int profileId , int serverGroupId ) { ArrayList < ServerRedirect > servers = new ArrayList < > ( ) ; PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . pre... | Get the server redirects belonging to a server group |
151,842 | public List < ServerGroup > tableServerGroups ( int profileId ) { ArrayList < ServerGroup > serverGroups = new ArrayList < > ( ) ; PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( ... | Return all server groups for a profile |
151,843 | public ServerRedirect getRedirect ( int id ) throws Exception { PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_SERVERS + " WHERE " + Const... | Returns redirect information for the given ID |
151,844 | public ServerGroup getServerGroup ( int id , int profileId ) throws Exception { PreparedStatement queryStatement = null ; ResultSet results = null ; if ( id == 0 ) { return new ServerGroup ( 0 , "Default" , profileId ) ; } try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnectio... | Returns server group by ID |
151,845 | public int addServerRedirectToProfile ( String region , String srcUrl , String destUrl , String hostHeader , int profileId , int clientId ) throws Exception { int serverId = - 1 ; try { Client client = ClientService . getInstance ( ) . getClient ( clientId ) ; serverId = addServerRedirect ( region , srcUrl , destUrl , ... | Add server redirect to a profile using current active ServerGroup |
151,846 | public int addServerRedirect ( String region , String srcUrl , String destUrl , String hostHeader , int profileId , int groupId ) throws Exception { int serverId = - 1 ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlCon... | Add server redirect to a profile |
151,847 | public int addServerGroup ( String groupName , int profileId ) throws Exception { int groupId = - 1 ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "INSERT INTO " + Constants . DB_TABLE_S... | Add a new server group |
151,848 | public void setGroupName ( String name , int id ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_SERVER_GROUPS + " SET " + Constants . GENERIC_NAME + " = ?" + " WHERE " + Constants... | Set the group name |
151,849 | public void setSourceUrl ( String newUrl , int id ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_SERVERS + " SET " + Constants . SERVER_REDIRECT_SRC_URL + " = ?" + " WHERE " + Co... | Set source url for a server |
151,850 | public void deleteRedirect ( int id ) { try { sqlService . executeUpdate ( "DELETE FROM " + Constants . DB_TABLE_SERVERS + " WHERE " + Constants . GENERIC_ID + " = " + id + ";" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } | Deletes a redirect by id |
151,851 | public void deleteServerGroup ( int id ) { try { sqlService . executeUpdate ( "DELETE FROM " + Constants . DB_TABLE_SERVER_GROUPS + " WHERE " + Constants . GENERIC_ID + " = " + id + ";" ) ; sqlService . executeUpdate ( "DELETE FROM " + Constants . DB_TABLE_SERVERS + " WHERE " + Constants . SERVER_REDIRECT_GROUP_ID + " ... | Delete a server group by id |
151,852 | public Profile [ ] getProfilesForServerName ( String serverName ) throws Exception { int profileId = - 1 ; ArrayList < Profile > returnProfiles = new ArrayList < Profile > ( ) ; PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { query... | This returns all profiles associated with a server name |
151,853 | public static PluginManager getInstance ( ) { if ( _instance == null ) { _instance = new PluginManager ( ) ; _instance . classInformation = new HashMap < String , ClassInformation > ( ) ; _instance . methodInformation = new HashMap < String , com . groupon . odo . proxylib . models . Method > ( ) ; _instance . jarInfor... | Gets the current instance of plugin manager |
151,854 | public void identifyClasses ( final String pluginDirectory ) throws Exception { methodInformation . clear ( ) ; jarInformation . clear ( ) ; try { new FileTraversal ( ) { public void onDirectory ( final File d ) { } public void onFile ( final File f ) { try { if ( f . getName ( ) . endsWith ( ".class" ) ) { String clas... | This loads plugin file information into a hash for lazy loading later on |
151,855 | private String getClassNameFromPath ( String path ) { String className = path . replace ( ".class" , "" ) ; if ( className . startsWith ( "/" ) ) { className = className . substring ( 1 , className . length ( ) ) ; } className = className . replace ( "/" , "." ) ; if ( className . startsWith ( "\\" ) ) { className = cl... | Create a classname from a given path |
151,856 | public void loadClass ( String className ) throws Exception { ClassInformation classInfo = classInformation . get ( className ) ; logger . info ( "Loading plugin.: {}, {}" , className , classInfo . pluginPath ) ; File libFile = new File ( proxyLibPath ) ; URL libUrl = libFile . toURI ( ) . toURL ( ) ; File pluginDirect... | Loads the specified class name and stores it in the hash |
151,857 | public void callFunction ( String className , String methodName , PluginArguments pluginArgs , Object ... args ) throws Exception { Class < ? > cls = getClass ( className ) ; ArrayList < Object > newArgs = new ArrayList < > ( ) ; newArgs . add ( pluginArgs ) ; com . groupon . odo . proxylib . models . Method m = prepar... | Calls the specified function with the specified arguments . This is used for v2 response overrides |
151,858 | private synchronized Class < ? > getClass ( String className ) throws Exception { ClassInformation classInfo = classInformation . get ( className ) ; File classFile = new File ( classInfo . pluginPath ) ; if ( classFile . lastModified ( ) > classInfo . lastModified ) { logger . info ( "Class {} has been modified, reloa... | Obtain the class of a given className |
151,859 | public String [ ] getMethods ( String pluginClass ) throws Exception { ArrayList < String > methodNames = new ArrayList < String > ( ) ; Method [ ] methods = getClass ( pluginClass ) . getDeclaredMethods ( ) ; for ( Method method : methods ) { logger . info ( "Checking {}" , method . getName ( ) ) ; com . groupon . odo... | Returns a string array of the methods loaded for a class |
151,860 | public List < com . groupon . odo . proxylib . models . Method > getMethodsNotInGroup ( int groupId ) throws Exception { List < com . groupon . odo . proxylib . models . Method > allMethods = getAllMethods ( ) ; List < com . groupon . odo . proxylib . models . Method > methodsNotInGroup = new ArrayList < com . groupon ... | returns all methods not in the group |
151,861 | public Plugin [ ] getPlugins ( Boolean onlyValid ) { Configuration [ ] configurations = ConfigurationService . getInstance ( ) . getConfigurations ( Constants . DB_TABLE_CONFIGURATION_PLUGIN_PATH ) ; ArrayList < Plugin > plugins = new ArrayList < Plugin > ( ) ; if ( configurations == null ) { return new Plugin [ 0 ] ; ... | Returns the data about all of the plugins that are set |
151,862 | public byte [ ] getResource ( String pluginName , String fileName ) throws Exception { for ( String jarFilename : jarInformation ) { JarFile jarFile = new JarFile ( new File ( jarFilename ) ) ; Enumeration < ? > enumer = jarFile . entries ( ) ; String jarPluginName = jarFile . getManifest ( ) . getMainAttributes ( ) . ... | Gets a static resource from a plugin |
151,863 | public static boolean changeHost ( String hostName , boolean enable , boolean disable , boolean remove , boolean isEnabled , boolean exists ) throws Exception { File hostsFile = new File ( "/etc/hosts" ) ; FileInputStream fstream = new FileInputStream ( "/etc/hosts" ) ; File outFile = null ; BufferedWriter bw = null ; ... | Only one boolean param should be true at a time for this function to return the proper results |
151,864 | public static String getByteArrayDataAsString ( String contentEncoding , byte [ ] bytes ) { ByteArrayOutputStream byteout = null ; if ( contentEncoding != null && contentEncoding . equals ( "gzip" ) ) { ByteArrayInputStream bytein = null ; GZIPInputStream zis = null ; try { bytein = new ByteArrayInputStream ( bytes ) ;... | Decodes stream data based on content encoding |
151,865 | @ SuppressWarnings ( "deprecation" ) @ RequestMapping ( value = "/api/backup" , method = RequestMethod . GET ) public String getBackup ( Model model , HttpServletResponse response ) throws Exception { response . addHeader ( "Content-Disposition" , "attachment; filename=backup.json" ) ; response . setContentType ( "appl... | Get all backup data |
151,866 | @ RequestMapping ( value = "/api/backup" , method = RequestMethod . POST ) public Backup processBackup ( @ RequestParam ( "fileData" ) MultipartFile fileData ) throws Exception { if ( ! fileData . isEmpty ( ) ) { try { byte [ ] bytes = fileData . getBytes ( ) ; BufferedOutputStream stream = new BufferedOutputStream ( n... | Restore backup data |
151,867 | public static void enableHost ( String hostName ) throws Exception { Registry myRegistry = LocateRegistry . getRegistry ( "127.0.0.1" , port ) ; com . groupon . odo . proxylib . hostsedit . rmi . Message impl = ( com . groupon . odo . proxylib . hostsedit . rmi . Message ) myRegistry . lookup ( SERVICE_NAME ) ; impl . ... | Enable a host |
151,868 | public static boolean isAvailable ( ) throws Exception { try { Registry myRegistry = LocateRegistry . getRegistry ( "127.0.0.1" , port ) ; com . groupon . odo . proxylib . hostsedit . rmi . Message impl = ( com . groupon . odo . proxylib . hostsedit . rmi . Message ) myRegistry . lookup ( SERVICE_NAME ) ; return true ;... | Returns whether or not the host editor service is available |
151,869 | protected String getContextPath ( ) { if ( context != null ) return context ; if ( get ( "context_path" ) == null ) { throw new ViewException ( "context_path missing - red alarm!" ) ; } return get ( "context_path" ) . toString ( ) ; } | Returns this applications context path . |
151,870 | protected void process ( String text , Map params , Writer writer ) { try { Template t = new Template ( "temp" , new StringReader ( text ) , FreeMarkerTL . getEnvironment ( ) . getConfiguration ( ) ) ; t . process ( params , writer ) ; } catch ( Exception e ) { throw new ViewException ( e ) ; } } | Processes text as a FreeMarker template . Usually used to process an inner body of a tag . |
151,871 | protected Map getAllVariables ( ) { try { Iterator names = FreeMarkerTL . getEnvironment ( ) . getKnownVariableNames ( ) . iterator ( ) ; Map vars = new HashMap ( ) ; while ( names . hasNext ( ) ) { Object name = names . next ( ) ; vars . put ( name , get ( name . toString ( ) ) ) ; } return vars ; } catch ( Exception ... | Returns a map of all variables in scope . |
151,872 | @ Value ( "${org.apereo.portal.portlets.favorites.MarketplaceFunctionalName:null}" ) public void setMarketplaceFName ( String marketplaceFunctionalName ) { if ( ! StringUtils . hasText ( marketplaceFunctionalName ) || "null" . equalsIgnoreCase ( marketplaceFunctionalName ) ) { marketplaceFunctionalName = null ; } this ... | Configures FavoritesController to include a Marketplace portlet functional name in the Model which ultimately signals and enables the View to include convenient link to Marketplace for user to add new favorites . |
151,873 | @ EventMapping ( SearchConstants . SEARCH_RESULTS_QNAME_STRING ) public void handleSearchResult ( EventRequest request ) { final String searchLaunchFname = request . getPreferences ( ) . getValue ( SEARCH_LAUNCH_FNAME , null ) ; if ( searchLaunchFname != null ) { return ; } final Event event = request . getEvent ( ) ; ... | Handles all the SearchResults events coming back from portlets |
151,874 | public ModelAndView showSearchForm ( RenderRequest request , RenderResponse response ) { final Map < String , Object > model = new HashMap < > ( ) ; String viewName ; if ( isRestSearch ( request ) ) { viewName = "/jsp/Search/searchRest" ; } else { final boolean isMobile = isMobile ( request ) ; viewName = isMobile ? "/... | Display a search form |
151,875 | private String calculateSearchLaunchUrl ( RenderRequest request , RenderResponse response ) { final HttpServletRequest httpRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; final IPortalUrlBuilder portalUrlBuilder = this . portalUrlProvider . getPortalUrlBuilderByPortletFName ( httpRequest , "se... | Create an actionUrl for the indicated portlet The resource URL is for the ajax typing search results response . |
151,876 | @ ResourceMapping ( value = "retrieveSearchJSONResults" ) public ModelAndView showJSONSearchResults ( PortletRequest request ) { PortletPreferences prefs = request . getPreferences ( ) ; int maxTextLength = Integer . parseInt ( prefs . getValue ( AUTOCOMPLETE_MAX_TEXT_LENGTH_PREF_NAME , "180" ) ) ; final Map < String ,... | Display AJAX autocomplete search results for the last query |
151,877 | private SortedMap < Integer , List < AutocompleteResultsModel > > getCleanedAndSortedMapResults ( ConcurrentMap < String , List < Tuple < SearchResult , String > > > resultsMap , int maxTextLength ) { SortedMap < Integer , List < AutocompleteResultsModel > > prioritizedResultsMap = createAutocompletePriorityMap ( ) ; f... | Return the search results in a sorted map based on priority of the search result type |
151,878 | protected void modifySearchResultLinkTitle ( SearchResult result , final HttpServletRequest httpServletRequest , final IPortletWindowId portletWindowId ) { if ( result . getType ( ) . size ( ) > 0 && result . getTitle ( ) . contains ( "${" ) ) { final IPortletWindow portletWindow = this . portletWindowRegistry . getPor... | Since portlets don t have access to the portlet definition to create a useful search results link using something like the portlet definition s title post - process the link text and for those portlets whose type is present in the substitution set replace the title with the portlet definition s title . |
151,879 | protected String getResultUrl ( HttpServletRequest httpServletRequest , SearchResult result , IPortletWindowId portletWindowId ) { final String externalUrl = result . getExternalUrl ( ) ; if ( externalUrl != null ) { return externalUrl ; } UrlType urlType = UrlType . RENDER ; final PortletUrl portletUrl = result . getP... | Determine the url for the search result |
151,880 | public String getParameterValue ( String name ) { NodeList parms = node . getChildNodes ( ) ; for ( int i = 0 ; i < parms . getLength ( ) ; i ++ ) { Element parm = ( Element ) parms . item ( i ) ; if ( parm . getTagName ( ) . equals ( Constants . ELM_PARAMETER ) ) { String parmName = parm . getAttribute ( Constants . A... | Returns the value of an parameter or null if such a parameter is not defined on the underlying channel element . |
151,881 | @ RequestMapping ( value = USERINFO_ENDPOINT_URI , produces = USERINFO_CONTENT_TYPE , method = { RequestMethod . GET , RequestMethod . POST } ) public String userInfo ( HttpServletRequest request , @ RequestParam ( value = "claims" , required = false ) String claims , @ RequestParam ( value = "groups" , required = fals... | Obtain an OIDC Id token for the current user . |
151,882 | public void setTargets ( Collection < IPermissionTarget > targets ) { targetMap . clear ( ) ; for ( IPermissionTarget target : targets ) { targetMap . put ( target . getKey ( ) , target ) ; } } | Set the permission targets for this provider . |
151,883 | public IPersonAttributes getPerson ( String uid ) { final IPersonAttributes rslt = delegatePersonAttributeDao . getPerson ( uid ) ; if ( rslt == null ) { return null ; } return postProcessPerson ( rslt , uid ) ; } | This method is for filling a specific individual . |
151,884 | public synchronized String register ( ServletConfig config ) throws PortletContainerException { ServletContext servletContext = config . getServletContext ( ) ; String contextPath = servletContext . getContextPath ( ) ; if ( ! portletContexts . containsKey ( contextPath ) ) { PortletApplicationDefinition portletApp = t... | Retrieves the PortletContext associated with the given ServletContext . If one does not exist it is created . |
151,885 | public synchronized PortletApplicationDefinition getPortletAppDD ( ServletContext servletContext , String name , String contextPath ) throws PortletContainerException { PortletApplicationDefinition portletApp = this . portletAppDefinitionCache . get ( servletContext ) ; if ( portletApp == null ) { portletApp = createDe... | Retrieve the Portlet Application Deployment Descriptor for the given servlet context . Create it if it does not allready exist . |
151,886 | private PortletApplicationDefinition createDefinition ( ServletContext servletContext , String name , String contextPath ) throws PortletContainerException { PortletApplicationDefinition portletApp = null ; try { InputStream paIn = servletContext . getResourceAsStream ( PORTLET_XML ) ; InputStream webIn = servletContex... | Creates the portlet . xml deployment descriptor representation . |
151,887 | protected ClusterMutex getClusterMutexInternal ( final String mutexName ) { final TransactionOperations transactionOperations = this . getTransactionOperations ( ) ; return transactionOperations . execute ( new TransactionCallback < ClusterMutex > ( ) { public ClusterMutex doInTransaction ( TransactionStatus status ) {... | Retrieves a ClusterMutex in a new TX |
151,888 | protected void createClusterMutex ( final String mutexName ) { this . executeIgnoreRollback ( new TransactionCallbackWithoutResult ( ) { protected void doInTransactionWithoutResult ( TransactionStatus status ) { final EntityManager entityManager = getEntityManager ( ) ; final ClusterMutex clusterMutex = new ClusterMute... | Creates a new ClusterMutex with the specified name . Returns the created mutex or null if the mutex already exists . |
151,889 | protected void validateLockedMutex ( ClusterMutex clusterMutex ) { if ( ! clusterMutex . isLocked ( ) ) { throw new IllegalMonitorStateException ( "Mutex is not currently locked, it cannot be updated: " + clusterMutex ) ; } final String serverName = this . portalInfoProvider . getUniqueServerName ( ) ; if ( ! serverNam... | Validates that the specified mutex is locked by this server throws IllegalMonitorStateException if either test fails |
151,890 | protected void unlockAbandonedLock ( final String mutexName ) { this . executeIgnoreRollback ( new TransactionCallbackWithoutResult ( ) { protected void doInTransactionWithoutResult ( TransactionStatus status ) { final EntityManager entityManager = getEntityManager ( ) ; final ClusterMutex clusterMutex = getClusterMute... | Unlocks an abandoned mutex |
151,891 | protected < T > T executeIgnoreRollback ( TransactionCallback < T > action , T rollbackValue ) { try { return this . newTransactionTemplate . execute ( action ) ; } catch ( TransactionSystemException e ) { if ( e . getCause ( ) instanceof RollbackException ) { return rollbackValue ; } throw e ; } } | Utility for using TransactionTemplate when we know that a rollback might happen and just want to ignore it |
151,892 | public boolean hasAnyFavorites ( IUserLayout layout ) { Validate . notNull ( layout , "Cannot determine whether a null layout contains favorites." ) ; return ( ! getFavoritePortletLayoutNodes ( layout ) . isEmpty ( ) || ! getFavoriteCollections ( layout ) . isEmpty ( ) ) ; } | True if the layout contains any favorited collections or favorited individual portlets false otherwise . |
151,893 | public void perform ( ) throws PortalException { if ( nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) { Element plfNode = HandlerUtils . getPLFNode ( ilfNode , person , true , false ) ; plfNode . setAttribute ( name , value ) ; EditManager . addEditDirective ( plfNode , name , person ) ; } else { Document... | Apply the attribute change . |
151,894 | protected Map < String , String > getUserInfo ( String remoteUser , HttpServletRequest httpServletRequest , IPortletWindow portletWindow ) throws PortletContainerException { final IPersonAttributes personAttributes = this . personAttributeDao . getPerson ( remoteUser ) ; if ( personAttributes == null ) { return Collect... | Commons logic to get a subset of the user s attributes for the specified portlet window . |
151,895 | protected Map < String , String > generateUserInfo ( final IPersonAttributes personAttributes , final List < ? extends UserAttribute > expectedUserAttributes , HttpServletRequest httpServletRequest ) { final Map < String , String > portletUserAttributes = new HashMap < String , String > ( expectedUserAttributes . size ... | Using the Map of portal user attributes and a List of expected attributes generate the USER_INFO map for the portlet |
151,896 | public void service ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { response . setHeader ( "Pragma" , "no-cache" ) ; response . setHeader ( "Cache-Control" , "no-cache" ) ; response . setDateHeader ( "Expires" , 0 ) ; String redirectTarget = null ; final String refU... | Process the incoming HttpServletRequest . Note that this processing occurs after PortalPreAuthenticatedProcessingFilter has run and performed pre - processing . |
151,897 | protected void selectFormDefaultPortlet ( final F report ) { final Set < AggregatedPortletMapping > portlets = this . getPortlets ( ) ; if ( ! portlets . isEmpty ( ) ) { report . getPortlets ( ) . add ( portlets . iterator ( ) . next ( ) . getFname ( ) ) ; } } | Select the first portlet name by default for the form |
151,898 | private void getMetaData ( final Connection conn ) { try { final DatabaseMetaData dmd = conn . getMetaData ( ) ; this . databaseProductName = dmd . getDatabaseProductName ( ) ; this . databaseProductVersion = dmd . getDatabaseProductVersion ( ) ; this . driverName = dmd . getDriverName ( ) ; this . driverVersion = dmd ... | Gets meta data about the connection . |
151,899 | @ RequestMapping ( headers = { "org.apereo.portal.url.UrlType=ACTION" } , method = RequestMethod . POST ) public void actionRequest ( HttpServletRequest request , HttpServletResponse response ) throws IOException { final IPortalRequestInfo portalRequestInfo = this . urlSyntaxProvider . getPortalRequestInfo ( request ) ... | HTTP POST required for security . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.