* @see net.rim.device.api.browser.field2.BrowserFieldController
*/
public InputConnection handleResourceRequest( BrowserFieldRequest request ) throws Exception {
if( this._browserField == null ) {
return new HTTPResponseStatus( HTTPResponseStatus.SC_SERVER_ERROR, request ).getResponse();
}
if( request.getURL().startsWith( "http://localhost:8472/" ) ) {
URI requestURI = URI.create( request.getURL() );
String[] splitPath = StringUtilities.split( requestURI.getPath(), "/" );
String featureID = "";
for( int i = 0; i < splitPath.length - 1; i++ ) {
if( featureID == "" ) {
featureID = featureID + splitPath[ i ];
} else {
featureID = featureID + "." + splitPath[ i ];
}
}
Object ext = ( (WidgetConfigImpl) _widgetConfig ).getExtensionObjectForFeature( featureID );
if( ext != null && ext instanceof IJSExtension ) {
JSExtensionRequest req = new JSExtensionRequest( request.getURL(), request.getPostData(), request.getHeaders(),
( (WidgetConfigImpl) _widgetConfig ).getFeatureTable() );
JSExtensionResponse res = new JSExtensionResponse( request.getURL(), null, request.getHeaders() );
try {
( (IJSExtension) ext ).invoke( req, res );
return new BrowserFieldResponse( res.getURL(), res.getPostData(), res.getHeaders() );
} catch( net.rim.device.api.web.WidgetException e ) {
// this block is reached if the method cannot be found within the extension
return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_IMPLEMENTED, request ).getResponse();
}
} else {
if( ext == null ) {
return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_FOUND, request ).getResponse();
} else if( !( ext instanceof IJSExtension ) ) {
return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_IMPLEMENTED, request ).getResponse();
}
}
}
WidgetAccess access = _widgetPolicy.getElement( request.getURL(), _widgetConfig.getAccessList() );
if( access == null && !_hasMultiAccess ) {