I am using a web fragement and a REST endpoint and I would like to show a screen letting the user know that the issue has no components, here is an example of the new page I would like to be shown after clicking the button if the issue does not have any components.

Here is my code below:
package SuperFeature
import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue;
import javax.ws.rs.core.Response
import org.apache.log4j.Logger
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import javax.ws.rs.core.MultivaluedMap
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.Response
import com.opensymphony.workflow.WorkflowException
@BaseScript CustomEndpointDelegate delegate
mounaGenerate(httpMethod: "GET", groups: ["jira-users"])
{
MultivaluedMap queryParams, String body ->
def log1 = Logger.getLogger("atlassian-jira.log")
def issueId = queryParams.getFirst("issueId") as Long
Issue myissue = ComponentAccessor.getIssueManager().getIssueObject(issueId)
def issueKey = myissue.getKey()
def componentNames = myissue.getComponents()*.name
log1.warn("MOUNA componentNames "+componentNames)
if(componentNames.empty) {
log.warn("MOUNA EMPTY")
// WRITE NEW CODE HERE TO DISPLAY THE NEW PAGE SAYING THAT THE ISSUE
//DOES NOT HAVE COMPONENTS
throw new WorkflowException("Issue does not have components")
}else{
log1.warn("MOUNA componentNames NOT EMPTY")
}
}