From a0ea9a6980658a8ec7fa7a75ff048513993f6250 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 16 Sep 2012 20:02:08 -0300 Subject: [PATCH] - Add support for serialized sessions... --- .../filter/BrowserSupportInterceptor.java | 2 +- .../com/wisemapping/filter/WiseUserAgent.java | 17 +- .../com/wisemapping/model/Collaborator.java | 157 +++++++++--------- wise-webapp/src/main/webapp/WEB-INF/web.xml | 1 + 4 files changed, 95 insertions(+), 82 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java b/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java index 1cb523e9..8a0db4fb 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java @@ -32,7 +32,7 @@ import java.util.Set; public class BrowserSupportInterceptor extends HandlerInterceptorAdapter { private Set exclude; - public static final String USER_AGENT = "wisemapping.userAgent"; + public static final String USER_AGENT = "wisemapping.user_agent"; public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception { diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/WiseUserAgent.java b/wise-webapp/src/main/java/com/wisemapping/filter/WiseUserAgent.java index f78ec700..5e694acc 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/WiseUserAgent.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/WiseUserAgent.java @@ -26,13 +26,11 @@ import java.io.Serializable; public class WiseUserAgent implements Serializable { public static final String USER_AGENT_HEADER = "User-Agent"; - private UserAgent userAgent; + transient private UserAgent userAgent; private String header; private WiseUserAgent(@NotNull final String header) { this.header = header; - this.userAgent = new UserAgent(header); - } public static WiseUserAgent create(@NotNull final HttpServletRequest request) { @@ -41,6 +39,7 @@ public class WiseUserAgent implements Serializable { public boolean isBrowserSupported() { + final UserAgent userAgent = this.getUserAgent(); final Browser browser = userAgent.getBrowser(); final Version version = userAgent.getBrowserVersion(); final OperatingSystem os = userAgent.getOperatingSystem(); @@ -58,7 +57,17 @@ public class WiseUserAgent implements Serializable { return result; } + @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(); final OperatingSystem os = userAgent.getOperatingSystem(); @@ -70,4 +79,6 @@ public class WiseUserAgent implements Serializable { public static WiseUserAgent create(@NotNull final String userAgent) { return new WiseUserAgent(userAgent); } + + } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java index 0bc5b9a6..2006ba40 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java @@ -1,78 +1,79 @@ -/* -* Copyright [2011] [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.model; - -import org.jetbrains.annotations.NotNull; - -import java.util.Calendar; -import java.util.Set; -import java.util.HashSet; - - -public class Collaborator { - private long id; - private String email; - private Calendar creationDate; - private Set collaborations = new HashSet(); - - public Collaborator() {} - - public Collaborator(Set collaborations) { - this.collaborations = collaborations; - } - - public void setCollaborations(Set collaborations) - { - this.collaborations = collaborations; - } - - public void addCollaboration(@NotNull Collaboration collaboration) - { - collaborations.add(collaboration); - } - - public Set getCollaborations() - { - return collaborations; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Calendar getCreationDate() { - return creationDate; - } - - public void setCreationDate(Calendar creationDate) { - this.creationDate = creationDate; - } -} +/* +* Copyright [2011] [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.model; + +import org.jetbrains.annotations.NotNull; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.Set; +import java.util.HashSet; + + +public class Collaborator implements Serializable { + private long id; + private String email; + private Calendar creationDate; + private Set collaborations = new HashSet(); + + public Collaborator() {} + + public Collaborator(Set collaborations) { + this.collaborations = collaborations; + } + + public void setCollaborations(Set collaborations) + { + this.collaborations = collaborations; + } + + public void addCollaboration(@NotNull Collaboration collaboration) + { + collaborations.add(collaboration); + } + + public Set getCollaborations() + { + return collaborations; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Calendar getCreationDate() { + return creationDate; + } + + public void setCreationDate(Calendar creationDate) { + this.creationDate = creationDate; + } +} diff --git a/wise-webapp/src/main/webapp/WEB-INF/web.xml b/wise-webapp/src/main/webapp/WEB-INF/web.xml index aa88708e..5f69438f 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/web.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/web.xml @@ -5,6 +5,7 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> + javax.servlet.jsp.jstl.fmt.localizationContext messages