Package com.pugh.sockso.web

Examples of com.pugh.sockso.web.BadRequestException


        final String type = req.getUrlParam( 1 );

        if ( type.equals("playlist"))
            playlist();

        else throw new BadRequestException( "unknown browse type '" + type + "'", 400 );

    }
View Full Code Here


        final Database db = getDatabase();
        final int id = Integer.parseInt( req.getUrlParam(2)  );       
        final Playlist playlist = Playlist.find( db, id );
       
        if ( playlist == null ) {
            throw new BadRequestException( "Invalid playlist ID", 404 );
        }
       
        final List<Track> tracks = playlist.getTracks( db );

        showPlaylist( playlist, tracks );
View Full Code Here

                    " limit 1 ";
            st = db.prepare( sql );
            st.setInt( 1, id );
            rs = st.executeQuery();
            if ( !rs.next() )
                throw new BadRequestException( "album not found", 404 );

            final Artist artist = new Artist.Builder()
                    .id(rs.getInt("artistId"))
                    .name(rs.getString("artistName"))
                    .build();
View Full Code Here

                  " limit 1 ";
            st = db.prepare( sql );
            st.setInt( 1, artistId );
            rs = st.executeQuery();
            if ( !rs.next() )
                throw new BadRequestException( "artist not found", 404 );
           
            return new Artist.Builder()
                .id(rs.getInt("id"))
                .name(rs.getString("name"))
                .dateAdded(rs.getDate("date_added"))
View Full Code Here

        List<Artist> artists = new ArrayList<Artist>();
        artists.add(new Artist.Builder().id(1).name("FooFoo").dateAdded(new Date()).build());
        artists.add(new Artist.Builder().id(2).name("BarBar").dateAdded(new Date()).build());
       
        expect( related.getRelatedArtistsFor(1) ).andReturn( artists );
        expect( related.getRelatedArtistsFor(99) ).andThrow( new BadRequestException("") );
        replay( related );
        res = new TestResponse();
        action = new ArtistRelatedAction( related );
        action.setResponse( res );
    }
View Full Code Here

                (orderBySql.equals("") ? " order by al.name asc, t.track_no asc " : orderBySql);
       
        else if ( type.equals("pl") )
            return Playlist.getSelectTracksSql( id, orderBySql.equals("") ? " order by pt.id asc " : orderBySql );
       
        else throw new BadRequestException( "unknown play type: " + type, 400 );

    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.web.BadRequestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.