Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generation Widget URL #10727 #10728

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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