mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 18:27:56 +08:00
Получение URL страницы без параметров #PL-2122 Fixed
This commit is contained in:
parent
2e4d418021
commit
4ea7ee251a
@ -25,16 +25,22 @@ import java.util.UUID;
|
||||
public abstract class ControllerUtils {
|
||||
private static final String DISPATCHER = "dispatch";
|
||||
|
||||
public static String getWebControllerURL(String mapping) {
|
||||
if (mapping == null) throw new IllegalArgumentException("Mapping cannot be null");
|
||||
|
||||
public static String getLocationWithoutParams() {
|
||||
URI location = AppUI.getCurrent().getPage().getLocation();
|
||||
String baseUrl;
|
||||
try {
|
||||
baseUrl = location.toURL().toExternalForm();
|
||||
StringBuilder baseUrl = new StringBuilder(location.toURL().toExternalForm());
|
||||
if (location.getQuery() != null) {
|
||||
baseUrl.delete(baseUrl.indexOf(location.getQuery()) - 1, baseUrl.length());
|
||||
}
|
||||
return baseUrl.toString();
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getWebControllerURL(String mapping) {
|
||||
if (mapping == null) throw new IllegalArgumentException("Mapping cannot be null");
|
||||
String baseUrl = getLocationWithoutParams();
|
||||
|
||||
StringBuilder url = new StringBuilder(baseUrl).append(getDispatcher());
|
||||
if (!mapping.startsWith("/")) {
|
||||
|
@ -13,6 +13,7 @@ import com.haulmont.cuba.gui.components.DialogAction;
|
||||
import com.haulmont.cuba.gui.components.IFrame;
|
||||
import com.haulmont.cuba.security.global.NoUserSessionException;
|
||||
import com.haulmont.cuba.web.App;
|
||||
import com.haulmont.cuba.web.controllers.ControllerUtils;
|
||||
import com.vaadin.server.Page;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@ -60,7 +61,7 @@ public class NoUserSessionHandler extends AbstractExceptionHandler {
|
||||
|
||||
@Override
|
||||
public void actionPerform(Component component) {
|
||||
String url = Page.getCurrent().getLocation().toString() + "?restartApplication";
|
||||
String url = ControllerUtils.getLocationWithoutParams() + "?restartApplication";
|
||||
|
||||
Page.getCurrent().open(url, "_self");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user