I am experiencing some troubles adding some datastreams to my objects where the 
datastreams have filenames containing multibyte characters.

I have a series of PDF documents which I want to add to multiple objects as 
datastreams, a number of these PDF’s have filenames containing Japanese 
characters. I am constructing a URI and then posting that URI to my Fedora 
instance. An example of one of my URI’s would be:

http://192.168.10.65:8080/fedora/objects/UNU:720/datastreams/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf?controlGroup=M&dsLabel=My%20PDF%20Label&versionable=false&mimeType=application%2Fpdf&dsLocation=http%3A%2F%2Flocalhost%2Fingest%2F%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf

I am using CURL and PHP to perform the POST. In this example the file name is 
日本語-test.pdf. When I POST this URI to the fedora instance I get the following 
error:

javax.ws.rs.WebApplicationException: 
org.fcrepo.server.errors.HttpServiceNotFoundException: 
[DefaultExternalContentManager] re                 turned an error.  The 
underlying error was a org.fcrepo.server.errors.GeneralException  The message 
was  "Error getting http://localhost/ing                 est/日本語-Test.pdf"  .
        at 
org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:172)
        at 
org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:583)
        at 
org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:358)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractReso
                 urceMethodDispatchProvider.java:175)
        at 
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
        at 
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)
        at 
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
        at 
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
        at 
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
        at 
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:689)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:647)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:638)
        at 
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
        at 
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
        at 
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
        at 
org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at 
org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at 
org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at 
org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at 
org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        at 
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.fcrepo.server.errors.HttpServiceNotFoundException: 
[DefaultExternalContentManager] returned an error.  The underlying error w      
           as a org.fcrepo.server.errors.GeneralException  The message was  
"Error getting http://localhost/ingest/日本語-Test.pdf";  .
        at 
org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:155)
        at 
org.fcrepo.server.storage.DefaultDOManager.doCommit(DefaultDOManager.java:1203)
        at 
org.fcrepo.server.storage.SimpleDOWriter.commit(SimpleDOWriter.java:509)
        at 
org.fcrepo.server.management.DefaultManagement.modifyDatastreamByReference(DefaultManagement.java:790)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.fcrepo.server.messaging.NotificationInvocationHandler.invoke(NotificationInvocationHandler.java:68)
        at $Proxy4.modifyDatastreamByReference(Unknown Source)
        at 
org.fcrepo.server.management.ManagementModule.modifyDatastreamByReference(ManagementModule.java:378)
        at 
org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:527)
        ... 50 more
Caused by: org.fcrepo.server.errors.GeneralException: Error getting 
http://localhost/ingest/日本語-Test.pdf
        at 
org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:184)
        at 
org.fcrepo.server.storage.DefaultExternalContentManager.getFromWeb(DefaultExternalContentManager.java:326)
        at 
org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:149)
        ... 61 more
Caused by: java.lang.IllegalArgumentException: Invalid uri 
'http://localhost/ingest/日本語-Test.pdf': escaped absolute path not valid
        at 
org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
        at 
org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
        at org.fcrepo.common.http.WebClient.get(WebClient.java:163)
        at org.fcrepo.common.http.WebClient.get(WebClient.java:136)
        at 
org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:172)


I have already set URIEncoding to UTF-8 in my server.xml and if I submit a 
different document without multibyte characters in their filename I have no 
problems. The main problem appears to be when Fedora attempts to actuire the 
datastream from the dsLocation provided. In this example if I attempt to 
connect to http://localhost/ingest/日本語-Test.pdf (via wget or links) I have no 
problem.

I have been searching through the archives and various other sites and the only 
piece of advice I have found is to configure URIEncoding. All my server locale 
values are set to UTF-8 and my JAVA_OPTS value includes -Dfile.encoding=UTF-8

Cheers,

Conor
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to