mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[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:
@@ -1784,7 +1784,7 @@ crosswalk.submission.SWORD.stylesheet = crosswalks/sword-swap-ingest.xsl
|
||||
# which DSpace will construct the deposit location urls for
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# application in the servlet container, this will generate
|
||||
|
@@ -101,9 +101,9 @@ public class CollectionLocation
|
||||
* If the configuration sword.deposit.url is set, this will be returned,
|
||||
* 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
|
||||
* @throws DSpaceSWORDException
|
||||
@@ -114,10 +114,10 @@ public class CollectionLocation
|
||||
String depositUrl = ConfigurationManager.getProperty("sword.deposit.url");
|
||||
if (depositUrl == null || "".equals(depositUrl))
|
||||
{
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.url");
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
|
||||
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
|
||||
@@ -127,7 +127,7 @@ public class CollectionLocation
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -314,11 +314,11 @@ public class SWORDUrlManager
|
||||
String depositUrl = ConfigurationManager.getProperty("sword.servicedocument.url");
|
||||
if (depositUrl == null || "".equals(depositUrl))
|
||||
{
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.url");
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
|
||||
if (dspaceUrl == null || "".equals(dspaceUrl))
|
||||
{
|
||||
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
|
||||
@@ -328,7 +328,7 @@ public class SWORDUrlManager
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -346,9 +346,9 @@ public class SWORDUrlManager
|
||||
* If the configuration sword.deposit.url is set, this will be returned,
|
||||
* 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
|
||||
* @throws DSpaceSWORDException
|
||||
@@ -359,11 +359,11 @@ public class SWORDUrlManager
|
||||
String depositUrl = ConfigurationManager.getProperty("sword.deposit.url");
|
||||
if (depositUrl == null || "".equals(depositUrl))
|
||||
{
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.url");
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
|
||||
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");
|
||||
"sword.deposit.url and/or dspace.baseUrl");
|
||||
}
|
||||
|
||||
try
|
||||
@@ -373,7 +373,7 @@ public class SWORDUrlManager
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -475,11 +475,11 @@ public class SWORDUrlManager
|
||||
String mlUrl = ConfigurationManager.getProperty("sword.media-link.url");
|
||||
if (mlUrl == null || "".equals(mlUrl))
|
||||
{
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.url");
|
||||
String dspaceUrl = ConfigurationManager.getProperty("dspace.baseUrl");
|
||||
if (dspaceUrl == null || "".equals(dspaceUrl))
|
||||
{
|
||||
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
|
||||
@@ -489,7 +489,7 @@ public class SWORDUrlManager
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -10,14 +10,13 @@ package org.dspace.app.xmlui.aspect.artifactbrowser;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.cocoon.ResourceNotFoundException;
|
||||
import org.apache.cocoon.caching.CacheableProcessingComponent;
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.environment.http.HttpEnvironment;
|
||||
import org.apache.cocoon.util.HashUtil;
|
||||
import org.apache.excalibur.source.SourceValidity;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -58,6 +57,8 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Implements all the browse functionality (browse by title, subject, authors,
|
||||
* 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,
|
||||
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();
|
||||
|
||||
String type = info.getBrowseIndex().getName();
|
||||
@@ -605,8 +615,8 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
* @throws SQLException
|
||||
* @throws UIException
|
||||
*/
|
||||
private BrowseParams getUserParams() throws SQLException, UIException
|
||||
{
|
||||
private BrowseParams getUserParams() throws SQLException, UIException, ResourceNotFoundException, IllegalArgumentException {
|
||||
|
||||
if (this.userParams != null)
|
||||
{
|
||||
return this.userParams;
|
||||
@@ -638,11 +648,21 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
{
|
||||
String type = request.getParameter(BrowseParams.TYPE);
|
||||
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);
|
||||
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
|
||||
@@ -650,7 +670,7 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
{
|
||||
// Get the default one
|
||||
SortOption so = bi.getSortOption();
|
||||
if (so != null)
|
||||
if (so != null)
|
||||
{
|
||||
sortBy = so.getNumber();
|
||||
}
|
||||
@@ -769,7 +789,12 @@ public class ConfigurableBrowse extends AbstractDSpaceTransformer implements
|
||||
|
||||
// Get the parameters we will use for the browse
|
||||
// (this includes a browse scope)
|
||||
BrowseParams params = getUserParams();
|
||||
BrowseParams params = null;
|
||||
try {
|
||||
params = getUserParams();
|
||||
} catch (ResourceNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user