|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Accessing tiff file using webdavHi,
I am trying to add a tiff file in 'default' workspace of Jackrabbit. And my code snippet is as follows:- Credentials cred = new SimpleCredentials("user", new char[] { 'p', 'w', 'd' }); session = repository.login(cred); File file = new File( "C:\\ Image.tif"); MimeTable mt = MimeTable.getDefaultTable(); String mimeType = mt.getContentTypeFor(file .getName()); if (mimeType == null) mimeType = "application/octet-stream"; Node root = session.getRootNode(); Node tiffNode = root.addNode(file.getName(), "nt:folder"); Node fileNode = tiffNode.addNode(file.getName(), "nt:file"); Node resNode = fileNode.addNode("jcr:content", "nt:resource"); resNode.setProperty("jcr:mimeType", mimeType); resNode.setProperty("jcr:encoding", ""); resNode.setProperty("jcr:data", new FileInputStream(file)); Calendar lastModified = Calendar.getInstance(); lastModified.setTimeInMillis(file.lastModified()); resNode.setProperty("jcr:lastModified", lastModified); session.save(); session.logout(); Actually, I am able to add the tiff file to the workspace by using the code above. But my problem is when I am trying to access this tiff file via browser (using webdav functionality), the tiff file is not opening up (i.e its not asking for an option to save or open) instead it opens up like a folder structure in browser (/default/Original Image.tif/Original Image.tif/jcr:content). But I want to get the actual tiff file via browser using webdav.How do I do that? Please advice... Thanks & Regards, Gandhi Rajan.N ________________________________ | iSIGHT Development Team | iGATE Global Solutions| T: +91-80-4104 1312| M: +91 9886834626 | gandhirajan.natarajan@... | | 158-162 & 165-170 EPIP Phase II Whitefield Bangalore - 560 066 India | www.igate.com <http://www.igate.com/> | iGATE is Ranked No. 3 in DQ-IDC best IT employer survey and Ranked No.6 by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India ----------------------------------------------------------------DISCLAIMER--------------------------------------------------------- Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@... and delete this EMAIL including any attachments |
|
|
Re: Accessing tiff file using webdavhi
> Node tiffNode = root.addNode(file.getName(), "nt:folder"); > Node fileNode = tiffNode.addNode(file.getName(), "nt:file"); > Node resNode = fileNode.addNode("jcr:content", "nt:resource"); [...] > Actually, I am able to add the tiff file to the workspace by using the > code above. But my problem is when I am trying to access this tiff file > via browser (using webdav functionality), the tiff file is not opening > up (i.e its not asking for an option to save or open) instead it opens > up like a folder structure in browser (/default/Original > Image.tif/Original Image.tif/jcr:content). > But I want to get the actual tiff file via browser using webdav.How do I > do that? if you are using the SimpleWebdavServlet it should work as expected. can you please check if you are not (just by coincidence) accessing the JcrServerServlet? if you are indeed using the simple server, you may provide a log of the http conversation... i wouldn't know just from the top of my head, what would be wrong then. angela |
|
|
RE: Accessing tiff file using webdavCould it be because you used application/octet-stream as mime type rather
than image/tiff? ** julio -----Original Message----- From: Angela Schreiber [mailto:anchela@...] Sent: Wednesday, May 07, 2008 11:37 PM To: users@... Subject: Re: Accessing tiff file using webdav hi > Node tiffNode = root.addNode(file.getName(), "nt:folder"); > Node fileNode = tiffNode.addNode(file.getName(), "nt:file"); > Node resNode = fileNode.addNode("jcr:content", "nt:resource"); [...] > Actually, I am able to add the tiff file to the workspace by using the > code above. But my problem is when I am trying to access this tiff > file via browser (using webdav functionality), the tiff file is not > opening up (i.e its not asking for an option to save or open) instead > it opens up like a folder structure in browser (/default/Original > Image.tif/Original Image.tif/jcr:content). > But I want to get the actual tiff file via browser using webdav.How do > I do that? if you are using the SimpleWebdavServlet it should work as expected. can you please check if you are not (just by coincidence) accessing the JcrServerServlet? if you are indeed using the simple server, you may provide a log of the http conversation... i wouldn't know just from the top of my head, what would be wrong then. angela |
|
|
RE: Accessing tiff file using webdavHi, Thanks for ur response. Actually, I am setting the mime type as "application/octet-stream" if mime type is null.But in my case,I am getting the mime type as "image/tiff" as you said rightly.but still I am facing the issue :( Thanks & Regards, Gandhi Rajan.N ________________________________ -----Original Message----- From: Julio Castillo [mailto:jcastillo@...] Sent: Thursday, May 08, 2008 12:14 PM To: users@... Subject: RE: Accessing tiff file using webdav Could it be because you used application/octet-stream as mime type rather than image/tiff? ** julio -----Original Message----- From: Angela Schreiber [mailto:anchela@...] Sent: Wednesday, May 07, 2008 11:37 PM To: users@... Subject: Re: Accessing tiff file using webdav hi > Node tiffNode = root.addNode(file.getName(), "nt:folder"); > Node fileNode = tiffNode.addNode(file.getName(), "nt:file"); > Node resNode = fileNode.addNode("jcr:content", "nt:resource"); [...] > Actually, I am able to add the tiff file to the workspace by using the > code above. But my problem is when I am trying to access this tiff > file via browser (using webdav functionality), the tiff file is not > opening up (i.e its not asking for an option to save or open) instead > it opens up like a folder structure in browser (/default/Original > Image.tif/Original Image.tif/jcr:content). > But I want to get the actual tiff file via browser using webdav.How do > I do that? if you are using the SimpleWebdavServlet it should work as expected. can you please check if you are not (just by coincidence) accessing the JcrServerServlet? if you are indeed using the simple server, you may provide a log of the http conversation... i wouldn't know just from the top of my head, what would be wrong then. angela iGATE is Ranked No. 3 in DQ-IDC best IT employer survey and Ranked No.6 by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India ----------------------------------------------------------------DISCLAIMER--------------------------------------------------------- Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@... and delete this EMAIL including any attachments |
|
|
Re: Accessing tiff file using webdavhi
> Actually, I am setting the mime type as "application/octet-stream" if > mime type is null. the "application/octet-stream" shouldn't prevent the client from either opening the file or displaying the 'save-as' box. angela |
|
|
|
|
|
Re: Accessing tiff file using webdavhi,
i'm not sure, but maybe the folder should not have an extension? regards, toby On 5/13/08, Gandhirajan Natarajan <Gandhirajan.Natarajan@...> wrote: > > > Hi, > > > > I am still facing this issue. Please help me out. > > > > I am trying to add a tiff file in 'default' workspace of Jackrabbit. And > my code snippet is as follows:- > > > > Credentials cred = new SimpleCredentials("user", > > new char[] { 'p', 'w', 'd' }); > > > > session = repository.login(cred); > > > > File file = new File( > > "C:\\ Image.tif"); > > MimeTable mt = MimeTable.getDefaultTable(); > > String mimeType = mt.getContentTypeFor(file > > .getName()); > > > > if (mimeType == null) > > mimeType = "application/octet-stream"; > > > > > > Node root = session.getRootNode(); > > Node tiffNode = root.addNode(file.getName(), > > "nt:folder"); > > > > Node fileNode = tiffNode.addNode(file.getName(), > > "nt:file"); > > Node resNode = fileNode.addNode("jcr:content", > > "nt:resource"); > > resNode.setProperty("jcr:mimeType", mimeType); > > resNode.setProperty("jcr:encoding", ""); > > resNode.setProperty("jcr:data", > > new FileInputStream(file)); > > Calendar lastModified = Calendar.getInstance(); > > lastModified.setTimeInMillis(file.lastModified()); > > resNode.setProperty("jcr:lastModified", > > lastModified); > > > > session.save(); > > > > > > Actually, I am able to add the tiff file to the workspace by using the > code above. But my problem is when I am trying to access this tiff file > via browser (using webdav functionality), the tiff file is not opening > up (i.e its not asking for an option to save or open) instead it opens > up like a folder structure in browser (/default/Original > Image.tif/Original Image.tif/jcr:content). > > > > But I want to get the actual tiff file via browser using webdav.How do I > do that? > > > > Please advice... > > > > Thanks & Regards, > > Gandhi Rajan.N > > > > iGATE is Ranked No. 3 in DQ-IDC best IT employer survey and Ranked No.6 > by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India > ----------------------------------------------------------------DISCLAIMER--------------------------------------------------------- > Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual > or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under > applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@... > and delete this EMAIL including any attachments > |
| Free Forum Powered by Nabble | Forum Help |