Skip to content
Snippets Groups Projects
Commit 3d248715 authored by gmantele's avatar gmantele
Browse files

[UWS] Correct the way the URL interpreter is used: at initilization with a...

[UWS] Correct the way the URL interpreter is used: at initilization with a HttpServletRequest, the full URL until the base URI should be saved + In UWSService, the used URL interpreter was a class attribute, which is a bad thing (this object is shared by several threads).
parent 5640573c
No related branches found
No related tags found
No related merge requests found
...@@ -482,6 +482,8 @@ public class UWSService implements UWS { ...@@ -482,6 +482,8 @@ public class UWSService implements UWS {
this.urlInterpreter = urlInterpreter; this.urlInterpreter = urlInterpreter;
if (name == null && urlInterpreter != null) if (name == null && urlInterpreter != null)
name = urlInterpreter.getUWSName(); name = urlInterpreter.getUWSName();
if (this.urlInterpreter != null)
this.urlInterpreter.setUwsURI(null);
} }
/** /**
...@@ -1048,7 +1050,7 @@ public class UWSService implements UWS { ...@@ -1048,7 +1050,7 @@ public class UWSService implements UWS {
JobOwner user = null; JobOwner user = null;
try{ try{
if (urlInterpreter == null){ if (this.urlInterpreter == null){
// Initialize the URL interpreter if not already done: // Initialize the URL interpreter if not already done:
setUrlInterpreter(new UWSUrl(request)); setUrlInterpreter(new UWSUrl(request));
...@@ -1057,6 +1059,7 @@ public class UWSService implements UWS { ...@@ -1057,6 +1059,7 @@ public class UWSService implements UWS {
} }
// Update the UWS URL interpreter: // Update the UWS URL interpreter:
UWSUrl urlInterpreter = new UWSUrl(this.urlInterpreter);
urlInterpreter.load(request); urlInterpreter.load(request);
// Identify the user: // Identify the user:
......
...@@ -17,7 +17,7 @@ package uws.service; ...@@ -17,7 +17,7 @@ package uws.service;
* along with UWSLibrary. If not, see <http://www.gnu.org/licenses/>. * along with UWSLibrary. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomishes Rechen Institut (ARI) * Astronomisches Rechen Institut (ARI)
*/ */
import java.io.Serializable; import java.io.Serializable;
...@@ -110,11 +110,15 @@ public class UWSUrl implements Serializable { ...@@ -110,11 +110,15 @@ public class UWSUrl implements Serializable {
* @see #extractBaseURI(HttpServletRequest) * @see #extractBaseURI(HttpServletRequest)
*/ */
public UWSUrl(HttpServletRequest request) throws NullPointerException{ public UWSUrl(HttpServletRequest request) throws NullPointerException{
// Extract the base URI:
String uri = extractBaseURI(request); String uri = extractBaseURI(request);
if (uri == null) if (uri == null)
throw new NullPointerException("The extracted base UWS URI is NULL!"); throw new NullPointerException("The extracted base UWS URI is NULL!");
else
baseURI = normalizeURI(uri); baseURI = normalizeURI(uri);
// Load the rest of the request:
load(request);
} }
/** /**
...@@ -503,9 +507,9 @@ public class UWSUrl implements Serializable { ...@@ -503,9 +507,9 @@ public class UWSUrl implements Serializable {
public final void setUwsURI(String uwsURI){ public final void setUwsURI(String uwsURI){
if (uwsURI == null || uwsURI.trim().length() == 0) if (uwsURI == null || uwsURI.trim().length() == 0)
this.uwsURI = null; this.uwsURI = null;
else{ else
this.uwsURI = uwsURI.trim(); this.uwsURI = uwsURI.trim();
}
loadUwsURI(); loadUwsURI();
updateRequestURL(); updateRequestURL();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment