[ 
http://jira.dspace.org/jira/browse/DS-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Wood updated DS-598:
-------------------------

    Status: Open  (was: Received)

> SWORD will only accept deposits on the URL configured in dspace.cfg
> -------------------------------------------------------------------
>
>                 Key: DS-598
>                 URL: http://jira.dspace.org/jira/browse/DS-598
>             Project: DSpace 1.x
>          Issue Type: Bug
>          Components: DSpace API
>            Reporter: Graham Triggs
>
> SWORDURLManager.getDSpaceObject() calls getBaseDepositUrl() to get the base 
> url to strip from the deposit location, in order to retrieve the handle.
> If the deposit is attempted on any url that is not either exactly as 
> configured, or exactly the same length as the url generated from the 
> dspace.url configuration, then the SWORD service will throw an exception 
> saying "The deposit URL does not resolve to a valid deposit target" (as the 
> retrieved handle will not actually be a valid handle).
> Alternate version of method:
>       public DSpaceObject getDSpaceObject(Context context, String location)
>               throws DSpaceSWORDException, SWORDErrorException
>       {
>               try
>               {
>                       URL baseUrl    = new URL(this.getBaseDepositUrl());
>                       URL depositUrl = new URL(location);
>                       
>                       String basePath    = baseUrl.getPath();
>                       String depositPath = depositUrl.getPath();
>                       
>                       if (basePath.length() == depositPath.length())
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>                       }
>                       String handle = 
> depositPath.substring(basePath.length());
>                       if (handle.startsWith("/"))
>                       {
>                               handle = handle.substring(1);
>                       }
>                       if ("".equals(handle))
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>                       }
>                       DSpaceObject dso = 
> HandleManager.resolveToObject(context, handle);
>                       if (!(dso instanceof Collection) && !(dso instanceof 
> Item))
>                       {
>                               throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL does not 
> resolve to a valid deposit target");
>                       }
>                       return dso;
>               }
>               catch (SQLException e)
>               {
>                       // log.error("Caught exception:", e);
>                       throw new DSpaceSWORDException("There was a problem 
> resolving the collection", e);
>               } catch (MalformedURLException e) {
>                       throw new 
> SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The deposit URL is 
> incomplete");
>               }
>       }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.dspace.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Dspace-devel mailing list
Dspace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to