Skip to content

Commit

Permalink
Fix generation Widget URL #10727
Browse files Browse the repository at this point in the history
  • Loading branch information
anatol-sialitski committed Oct 14, 2024
1 parent cdec22e commit 8e35a5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public WebResponse handle( final WebRequest webRequest )
if ( widgetDescriptors.isNotEmpty() )
{
final String widgetApiBaseUrl = portalUrlService.apiUrl(
new ApiUrlParams().portalRequest( new PortalRequest( webRequest ) ).application( "admin" ).api( "widget" ) );
new ApiUrlParams().portalRequest( (PortalRequest) webRequest ).application( "admin" ).api( "widget" ) );

widgetDescriptors.forEach( widgetDescriptor -> result.add( convertToJson( widgetDescriptor, widgetApiBaseUrl ) ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import com.enonic.xp.i18n.MessageBundle;
import com.enonic.xp.icon.Icon;
import com.enonic.xp.page.DescriptorKey;
import com.enonic.xp.portal.PortalRequest;
import com.enonic.xp.portal.url.ApiUrlParams;
import com.enonic.xp.portal.url.PortalUrlService;
import com.enonic.xp.web.WebRequest;
import com.enonic.xp.web.WebResponse;
import com.enonic.xp.web.servlet.ServletRequestHolder;

Expand Down Expand Up @@ -66,7 +66,7 @@ void testHandle()
final Multimap<String, String> params = HashMultimap.create();
params.put( "widgetInterface", "myInterface" );

final WebRequest webRequest = mock( WebRequest.class );
final PortalRequest webRequest = mock( PortalRequest.class );
when( webRequest.getParams() ).thenReturn( params );

final Icon icon = mock( Icon.class );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ else if ( requestURI.startsWith( WEBAPP_PREFIX ) )
}

final String applicationKey =
Objects.requireNonNullElse( this.params.getApplication(), portalRequest.getApplicationKey().toString() );
Objects.requireNonNullElseGet( this.params.getApplication(), () -> portalRequest.getApplicationKey().toString() );

appendPart( url, applicationKey + ":" + this.params.getApi() );
appendSubPath( url, this.params.getPath() );
Expand Down

0 comments on commit 8e35a5e

Please sign in to comment.