BBOS/src/bing/Bing.java
/**
	 * Perform a synchronous search on the Bing API.
	 * @param query A string specifying the query to perform
	 * @param request A BingRequest object
	 * @return The response from the Bing API
	 */
Perform a synchronous search on the Bing API.
@param query A string specifying the query to perform
@param request A BingRequest object
@return The response from the Bing API
Perform a synchronous search on the Bing API . @param query A string specifying the query to perform @param request A BingRequest object @return The response from the Bing API
public synchronized BingResponse search(final String query, BingRequest request)
	{
		String requestURL = this.requestUrl(query, request);
		System.out.println(format(_resources.getString(BingResource.SEARCH_SYNC), new Object[]{ requestURL }));
		BingXMLDelegate xmlDelegate = null;
		InputStream in = null;
		try
		{
			in = Connector.openInputStream(requestURL);
			SAXParserFactory factory = SAXParserFactory.newInstance();
			SAXParser builder = factory.newSAXParser();
			xmlDelegate = new BingXMLDelegate(this._resources
					, this.errorRet
					);
			builder.parse(in, xmlDelegate);
		}
		catch (Exception e)
		{
			xmlDelegate = null;
			System.out.println(_resources.getString(BingResource.SEARCH_ERROR));
		}
		finally
		{
			if(in != null)
			{
				try
				{
					in.close();
				}
				catch(Exception e)
				{
				}
			}
		}
		return xmlDelegate != null ? xmlDelegate.getResponse() : null;
	}
public synchronized BingResponse search ( final String query , BingRequest request ) { String requestURL = this . requestUrl ( query , request ) ; System . out . println ( format ( _resources . getString ( BingResource . SEARCH_SYNC ) , new Object [ ] { requestURL } ) ) ; BingXMLDelegate xmlDelegate = null ; InputStream in = null ; try { in = Connector . openInputStream ( requestURL ) ; SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; SAXParser builder = factory . newSAXParser ( ) ; xmlDelegate = new BingXMLDelegate ( this . _resources , this . errorRet ) ; builder . parse ( in , xmlDelegate ) ; } catch ( Exception e ) { xmlDelegate = null ; System . out . println ( _resources . getString ( BingResource . SEARCH_ERROR ) ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( Exception e ) { } } } return xmlDelegate != null ? xmlDelegate . getResponse ( ) : null ; }
Perform a synchronous search on the Bing API.
Perform a synchronous search on the Bing API .
//#ifdef BING_DEBUG
 //#endif
 //#ifdef BING_DEBUG
 //#endif
 //#ifdef BING_DEBUG
 //#endif
