[DS-860] SWORD still uses dspace.url rather than dspace.baseUrl

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@6262 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Kim Shepherd
2011-03-28 08:34:14 +00:00
parent 0e484e542f
commit b1a5a717d4
4 changed files with 55 additions and 30 deletions

View File

@@ -1784,7 +1784,7 @@ crosswalk.submission.SWORD.stylesheet = crosswalks/sword-swap-ingest.xsl
# which DSpace will construct the deposit location urls for # which DSpace will construct the deposit location urls for
# collections. # collections.
# #
# The default is {dspace.url}/sword/deposit # The default is {dspace.baseUrl}/sword/deposit
# #
# In the event that you are not deploying DSpace as the ROOT # In the event that you are not deploying DSpace as the ROOT
# application in the servlet container, this will generate # application in the servlet container, this will generate
@@ -1797,7 +1797,7 @@ crosswalk.submission.SWORD.stylesheet = crosswalks/sword-swap-ingest.xsl
# URL from which DSpace will construct the service document # URL from which DSpace will construct the service document
# location urls for the site, and for individual collections # location urls for the site, and for individual collections
# #
# The default is {dspace.url}/sword/servicedocument # The default is {dspace.baseUrl}/sword/servicedocument
# #
# In the event that you are not deploying DSpace as the ROOT # In the event that you are not deploying DSpace as the ROOT
# application in the servlet container, this will generate # application in the servlet container, this will generate
@@ -1810,7 +1810,7 @@ crosswalk.submission.SWORD.stylesheet = crosswalks/sword-swap-ingest.xsl
# which DSpace will use to construct the media link urls # which DSpace will use to construct the media link urls
# for items which are deposited via sword # for items which are deposited via sword
# #
# The default is {dspace.url}/sword/media-link # The default is {dspace.baseUrl}/sword/media-link
# #
# In the event that you are not deploying DSpace as the ROOT # In the event that you are not deploying DSpace as the ROOT
# application in the servlet container, this will generate # application in the servlet container, this will generate

View File

@@ -101,9 +101,9 @@ public class CollectionLocation
* If the configuration sword.deposit.url is set, this will be returned, * If the configuration sword.deposit.url is set, this will be returned,
* but if not, it will construct the url as follows: * but if not, it will construct the url as follows:
* *
* [dspace.url]/dspace-sword/deposit * [dspace.baseUrl]/sword/deposit
* *
* where dspace.url is also in the configuration file. * where dspace.baseUrl is also in the configuration file.
* *
* @return the base URL for sword deposit * @return the base URL for sword deposit
* @throws DSpaceSWORDException * @throws DSpaceSWORDException
@@ -114,10 +114,10 @@ public class CollectionLocation
String depositUrl = ConfigurationManager.getProperty("sword.deposit.url"); String depositUrl = ConfigurationManager.getProperty("sword.deposit.url");
if (depositUrl == null || "".equals(depositUrl)) if (depositUrl == null || "".equals(depositUrl))
{ {
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
if (dspaceUrl == null || "".equals(dspaceUrl)) if (dspaceUrl == null || "".equals(dspaceUrl))
{ {
throw new DSpaceSWORDException("Unable to construct deposit urls, due to missing/invalid config in sword.deposit.url and/or dspace.url"); throw new DSpaceSWORDException("Unable to construct deposit urls, due to missing/invalid config in sword.deposit.url and/or dspace.baseUrl");
} }
try try
@@ -127,7 +127,7 @@ public class CollectionLocation
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
throw new DSpaceSWORDException("Unable to construct deposit urls, due to invalid dspace.url " + e.getMessage(),e); throw new DSpaceSWORDException("Unable to construct deposit urls, due to invalid dspace.baseUrl " + e.getMessage(),e);
} }

View File

@@ -314,11 +314,11 @@ public class SWORDUrlManager
String depositUrl = ConfigurationManager.getProperty("sword.servicedocument.url"); String depositUrl = ConfigurationManager.getProperty("sword.servicedocument.url");
if (depositUrl == null || "".equals(depositUrl)) if (depositUrl == null || "".equals(depositUrl))
{ {
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
if (dspaceUrl == null || "".equals(dspaceUrl)) if (dspaceUrl == null || "".equals(dspaceUrl))
{ {
throw new DSpaceSWORDException("Unable to construct service document urls, due to missing/invalid " + throw new DSpaceSWORDException("Unable to construct service document urls, due to missing/invalid " +
"config in sword.servicedocument.url and/or dspace.url"); "config in sword.servicedocument.url and/or dspace.baseUrl");
} }
try try
@@ -328,7 +328,7 @@ public class SWORDUrlManager
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
throw new DSpaceSWORDException("Unable to construct service document urls, due to invalid dspace.url " + throw new DSpaceSWORDException("Unable to construct service document urls, due to invalid dspace.baseUrl " +
e.getMessage(),e); e.getMessage(),e);
} }
@@ -346,9 +346,9 @@ public class SWORDUrlManager
* If the configuration sword.deposit.url is set, this will be returned, * If the configuration sword.deposit.url is set, this will be returned,
* but if not, it will construct the url as follows: * but if not, it will construct the url as follows:
* *
* [dspace.url]/dspace-sword/deposit * [dspace.baseUrl]/sword/deposit
* *
* where dspace.url is also in the configuration file. * where dspace.baseUrl is also in the configuration file.
* *
* @return the base URL for sword deposit * @return the base URL for sword deposit
* @throws DSpaceSWORDException * @throws DSpaceSWORDException
@@ -359,11 +359,11 @@ public class SWORDUrlManager
String depositUrl = ConfigurationManager.getProperty("sword.deposit.url"); String depositUrl = ConfigurationManager.getProperty("sword.deposit.url");
if (depositUrl == null || "".equals(depositUrl)) if (depositUrl == null || "".equals(depositUrl))
{ {
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
if (dspaceUrl == null || "".equals(dspaceUrl)) if (dspaceUrl == null || "".equals(dspaceUrl))
{ {
throw new DSpaceSWORDException("Unable to construct deposit urls, due to missing/invalid config in " + throw new DSpaceSWORDException("Unable to construct deposit urls, due to missing/invalid config in " +
"sword.deposit.url and/or dspace.url"); "sword.deposit.url and/or dspace.baseUrl");
} }
try try
@@ -373,7 +373,7 @@ public class SWORDUrlManager
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
throw new DSpaceSWORDException("Unable to construct deposit urls, due to invalid dspace.url " + throw new DSpaceSWORDException("Unable to construct deposit urls, due to invalid dspace.baseUrl " +
e.getMessage(),e); e.getMessage(),e);
} }
@@ -475,11 +475,11 @@ public class SWORDUrlManager
String mlUrl = ConfigurationManager.getProperty("sword.media-link.url"); String mlUrl = ConfigurationManager.getProperty("sword.media-link.url");
if (mlUrl == null || "".equals(mlUrl)) if (mlUrl == null || "".equals(mlUrl))
{ {
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
if (dspaceUrl == null || "".equals(dspaceUrl)) if (dspaceUrl == null || "".equals(dspaceUrl))
{ {
throw new DSpaceSWORDException("Unable to construct media-link urls, due to missing/invalid config in " + throw new DSpaceSWORDException("Unable to construct media-link urls, due to missing/invalid config in " +
"sword.media-link.url and/or dspace.url"); "sword.media-link.url and/or dspace.baseUrl");
} }
try try
@@ -489,7 +489,7 @@ public class SWORDUrlManager
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
throw new DSpaceSWORDException("Unable to construct media-link urls, due to invalid dspace.url " + throw new DSpaceSWORDException("Unable to construct media-link urls, due to invalid dspace.baseUrl " +
e.getMessage(),e); e.getMessage(),e);
} }

View File

@@ -10,14 +10,13 @@ package org.dspace.app.xmlui.aspect.artifactbrowser;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashMap; import java.util.*;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.cocoon.caching.CacheableProcessingComponent;
import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.http.HttpEnvironment;
import org.apache.cocoon.util.HashUtil; import org.apache.cocoon.util.HashUtil;
import org.apache.excalibur.source.SourceValidity; import org.apache.excalibur.source.SourceValidity;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@@ -58,6 +57,8 @@ import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.servlet.http.HttpServletResponse;
/** /**
* Implements all the browse functionality (browse by title, subject, authors, * Implements all the browse functionality (browse by title, subject, authors,
* etc.) The types of browse available are configurable by the implementor. See * etc.) The types of browse available are configurable by the implementor. See
@@ -244,7 +245,16 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, public void addBody(Body body) throws SAXException, WingException, UIException, SQLException,
IOException, AuthorizeException IOException, AuthorizeException
{ {
BrowseParams params = getUserParams(); BrowseParams params = null;
try {
params = getUserParams();
} catch (ResourceNotFoundException e) {
HttpServletResponse response = (HttpServletResponse)objectModel
.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
BrowseInfo info = getBrowseInfo(); BrowseInfo info = getBrowseInfo();
String type = info.getBrowseIndex().getName(); String type = info.getBrowseIndex().getName();
@@ -605,8 +615,8 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
* @throws SQLException * @throws SQLException
* @throws UIException * @throws UIException
*/ */
private BrowseParams getUserParams() throws SQLException, UIException private BrowseParams getUserParams() throws SQLException, UIException, ResourceNotFoundException, IllegalArgumentException {
{
if (this.userParams != null) if (this.userParams != null)
{ {
return this.userParams; return this.userParams;
@@ -639,10 +649,20 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
String type = request.getParameter(BrowseParams.TYPE); String type = request.getParameter(BrowseParams.TYPE);
int sortBy = RequestUtils.getIntParameter(request, BrowseParams.SORT_BY); int sortBy = RequestUtils.getIntParameter(request, BrowseParams.SORT_BY);
if(!request.getParameters().containsKey("type"))
{
// default to first browse index.
String defaultBrowseIndex = ConfigurationManager.getProperty("webui.browse.index.1");
if(defaultBrowseIndex != null)
{
type = defaultBrowseIndex.split(":")[0];
}
}
BrowseIndex bi = BrowseIndex.getBrowseIndex(type); BrowseIndex bi = BrowseIndex.getBrowseIndex(type);
if (bi == null) if (bi == null)
{ {
throw new BrowseException("There is no browse index of the type: " + type); throw new ResourceNotFoundException("Browse index " + type + " not found");
} }
// If we don't have a sort column // If we don't have a sort column
@@ -769,7 +789,12 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
// Get the parameters we will use for the browse // Get the parameters we will use for the browse
// (this includes a browse scope) // (this includes a browse scope)
BrowseParams params = getUserParams(); BrowseParams params = null;
try {
params = getUserParams();
} catch (ResourceNotFoundException e) {
return null;
}
try try
{ {