Fix url for static
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.exceptions;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ImportUnexpectedException
|
||||
extends WiseMappingException {
|
||||
private byte[] freemindXml;
|
||||
|
||||
|
||||
public ImportUnexpectedException(@NotNull Throwable e, @NotNull byte[] map) {
|
||||
super("Unexpected expected error importing freemind. Please, try latter.", e);
|
||||
this.freemindXml = map;
|
||||
}
|
||||
|
||||
public ImportUnexpectedException(String str, Exception e) {
|
||||
super(str);
|
||||
initCause(e);
|
||||
}
|
||||
|
||||
public byte[] getFreemindXml() {
|
||||
return freemindXml;
|
||||
}
|
||||
}
|
@@ -20,13 +20,13 @@ package com.wisemapping.filter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
public class RequestPropertiesInterceptor extends HandlerInterceptorAdapter {
|
||||
public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
||||
@Value("${google.analytics.enabled}")
|
||||
private Boolean analyticsEnabled;
|
||||
|
||||
@@ -54,6 +54,7 @@ public class RequestPropertiesInterceptor extends HandlerInterceptorAdapter {
|
||||
@Value("${security.type}")
|
||||
private String securityType;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception {
|
||||
|
||||
request.setAttribute("google.analytics.enabled", analyticsEnabled);
|
||||
|
@@ -18,72 +18,6 @@
|
||||
|
||||
package com.wisemapping.filter;
|
||||
|
||||
import com.wisemapping.util.Browser;
|
||||
import com.wisemapping.util.UserAgent;
|
||||
import com.wisemapping.util.Version;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SupportedUserAgent implements Serializable {
|
||||
public static final String USER_AGENT_HEADER = "User-Agent";
|
||||
transient private UserAgent userAgent;
|
||||
private final String header;
|
||||
|
||||
private SupportedUserAgent(@NotNull final String header) {
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
public static SupportedUserAgent create(@NotNull final HttpServletRequest request) {
|
||||
return new SupportedUserAgent(request.getHeader(USER_AGENT_HEADER));
|
||||
}
|
||||
|
||||
public boolean isBrowserSupported() {
|
||||
|
||||
// final UserAgent userAgent = this.getUserAgent();
|
||||
// final Browser browser = userAgent.getBrowser();
|
||||
// final OperatingSystem os = userAgent.getOperatingSystem();
|
||||
// final Version version = userAgent.getBrowserVersion();
|
||||
// final int majorVersion = version != null ? Integer.parseInt(version.getMajorVersion()) : -1;
|
||||
//
|
||||
// boolean result = browser == Browser.FIREFOX && majorVersion >= 10;
|
||||
// result = result || browser == Browser.FIREFOX2 && majorVersion >= 17;
|
||||
// result = result || browser == Browser.FIREFOX3 && majorVersion >= 29;
|
||||
// result = result || browser == Browser.FIREFOX4 && majorVersion >= 40;
|
||||
// result = result || browser == Browser.IE8 || browser == Browser.IE9 || browser == Browser.IE11 ;
|
||||
// result = result || browser == Browser.IE && majorVersion >= 8;
|
||||
// result = result || browser == Browser.OPERA10 && majorVersion >= 11;
|
||||
// result = result || browser == Browser.CHROME && majorVersion >= 18;
|
||||
// result = result || browser == Browser.SAFARI5;
|
||||
// result = result || browser == Browser.SAFARI && majorVersion >= 5;
|
||||
// result = result || browser == Browser.MOBILE_SAFARI;
|
||||
// result = result || os.isMobileDevice() && (os == OperatingSystem.ANDROID || os == OperatingSystem.iOS4_IPHONE);
|
||||
// result = result || browser.getBrowserType() == BrowserType.ROBOT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
synchronized
|
||||
private UserAgent getUserAgent() {
|
||||
if (userAgent == null) {
|
||||
userAgent = new UserAgent(header);
|
||||
}
|
||||
return userAgent;
|
||||
}
|
||||
|
||||
public boolean needsGCF() {
|
||||
final UserAgent userAgent = this.getUserAgent();
|
||||
final Browser browser = userAgent.getBrowser();
|
||||
final Version version = userAgent.getBrowserVersion();
|
||||
|
||||
return (browser == Browser.IE8 || browser == Browser.IE && Integer.parseInt(version.getMajorVersion()) == 8) && !header.contains("chromeframe");
|
||||
}
|
||||
|
||||
public static SupportedUserAgent create(@NotNull final String userAgent) {
|
||||
return new SupportedUserAgent(userAgent);
|
||||
}
|
||||
|
||||
|
||||
public interface SupportedUserAgent{
|
||||
String USER_AGENT_HEADER = "User-Agent";
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ package com.wisemapping.filter;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
@@ -29,8 +30,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Locale;
|
||||
|
||||
public class UserLocaleInterceptor extends HandlerInterceptorAdapter {
|
||||
public class UserLocaleInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception {
|
||||
|
||||
final HttpSession session = request.getSession(false);
|
||||
|
@@ -19,7 +19,6 @@
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.wisemapping.exceptions.ClientException;
|
||||
import com.wisemapping.exceptions.ImportUnexpectedException;
|
||||
import com.wisemapping.exceptions.Severity;
|
||||
import com.wisemapping.mail.NotificationService;
|
||||
import com.wisemapping.model.User;
|
||||
@@ -64,15 +63,6 @@ public class BaseController {
|
||||
return new RestErrors(ex.getMessage(), Severity.WARNING);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ImportUnexpectedException.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
public RestErrors handleImportErrors(@NotNull ImportUnexpectedException ex, @NotNull HttpServletRequest request) {
|
||||
final User user = Utils.getUser();
|
||||
notificationService.reportJavaException(ex, user, new String(ex.getFreemindXml()), request);
|
||||
return new RestErrors(ex.getMessage(), Severity.SEVERE);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ValidationException.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public RestErrors handleValidationErrors(@NotNull ValidationException ex) {
|
||||
|
@@ -60,19 +60,6 @@ public class MindmapController {
|
||||
return "mindmapPrint";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/share")
|
||||
public String showSharePage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException {
|
||||
final Mindmap mindmap = findMindmap(id);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapShare";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/sharef")
|
||||
public String showSharePageFull(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException {
|
||||
showSharePage(id, model);
|
||||
return "mindmapShareFull";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/")
|
||||
public String showListPage(@NotNull Model model) {
|
||||
return "mindmapList";
|
||||
|
Reference in New Issue
Block a user