Search in sources :

Example 1 with RecordSessionUrl

use of org.parosproxy.paros.db.RecordSessionUrl in project zaproxy by zaproxy.

the class SqlTableSessionUrl method getUrlsForType.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableSessionUrl#getUrlsForType(int)
	 */
@Override
public List<RecordSessionUrl> getUrlsForType(int type) throws DatabaseException {
    SqlPreparedStatementWrapper psGetAlluRLSForType = null;
    try {
        psGetAlluRLSForType = DbSQL.getSingleton().getPreparedStatement("sessionurl.ps.geturlsfortype");
        psGetAlluRLSForType.getPs().setInt(1, type);
        try (ResultSet rs = psGetAlluRLSForType.getPs().executeQuery()) {
            List<RecordSessionUrl> result = new ArrayList<>();
            while (rs.next()) {
                result.add(new RecordSessionUrl(rs.getLong(URLID), rs.getInt(TYPE), rs.getString(URL)));
            }
            return result;
        }
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbSQL.getSingleton().releasePreparedStatement(psGetAlluRLSForType);
    }
}
Also used : RecordSessionUrl(org.parosproxy.paros.db.RecordSessionUrl) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) ArrayList(java.util.ArrayList) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 2 with RecordSessionUrl

use of org.parosproxy.paros.db.RecordSessionUrl in project zaproxy by zaproxy.

the class Session method getSessionUrls.

public List<String> getSessionUrls(int type) throws DatabaseException {
    List<RecordSessionUrl> urls = model.getDb().getTableSessionUrl().getUrlsForType(type);
    List<String> list = new ArrayList<>(urls.size());
    for (RecordSessionUrl url : urls) {
        list.add(url.getUrl());
    }
    return list;
}
Also used : RecordSessionUrl(org.parosproxy.paros.db.RecordSessionUrl) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 RecordSessionUrl (org.parosproxy.paros.db.RecordSessionUrl)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 DatabaseException (org.parosproxy.paros.db.DatabaseException)1