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
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -482,6 +482,8 @@ public class UWSService implements UWS {
		this.urlInterpreter = urlInterpreter;
		if (name == null && urlInterpreter != null)
			name = urlInterpreter.getUWSName();
		if (this.urlInterpreter != null)
			this.urlInterpreter.setUwsURI(null);
	}

	/**
@@ -1048,7 +1050,7 @@ public class UWSService implements UWS {
		JobOwner user = null;

		try{
			if (urlInterpreter == null){
			if (this.urlInterpreter == null){
				// Initialize the URL interpreter if not already done:
				setUrlInterpreter(new UWSUrl(request));

@@ -1057,6 +1059,7 @@ public class UWSService implements UWS {
			}

			// Update the UWS URL interpreter:
			UWSUrl urlInterpreter = new UWSUrl(this.urlInterpreter);
			urlInterpreter.load(request);

			// Identify the user:
+8 −4
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ package uws.service;
 * along with UWSLibrary.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
 *                       Astronomishes Rechen Institut (ARI)
 *                       Astronomisches Rechen Institut (ARI)
 */

import java.io.Serializable;
@@ -110,11 +110,15 @@ public class UWSUrl implements Serializable {
	 * @see #extractBaseURI(HttpServletRequest)
	 */
	public UWSUrl(HttpServletRequest request) throws NullPointerException{
		// Extract the base URI:
		String uri = extractBaseURI(request);
		if (uri == null)
			throw new NullPointerException("The extracted base UWS URI is NULL!");

		else
			baseURI = normalizeURI(uri);

		// Load the rest of the request:
		load(request);
	}

	/**
@@ -503,9 +507,9 @@ public class UWSUrl implements Serializable {
	public final void setUwsURI(String uwsURI){
		if (uwsURI == null || uwsURI.trim().length() == 0)
			this.uwsURI = null;
		else{
		else
			this.uwsURI = uwsURI.trim();
		}

		loadUwsURI();
		updateRequestURL();
	}