You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Bruno Vaz de Melo Rodrigues <br...@gmail.com> on 2012/01/16 12:38:52 UTC

Problem Retrieve a file with webdav

I put a file in jackrabbit workspace using webdav, but i can't retrieve
this file. I try this:
public byte[] readFile(WebDavServerConfig serverConfig, String path,
String fileName) throws BasicException {
	//String resource =
		"http://localhost:9080/jackrabbit-webapp-2.3.6/default/file.zip";

	HttpClient client = getClient(serverConfig);
	PropFindMethod method = null;
	try {
		method = new PropFindMethod(resource);
		// Execute the method.
		int statusCode = client.executeMethod(method);
		// Read the response body.
		byte[] responseBody = method.getResponseBody();
	
		return responseBody;
	} finally {
		// Release the connection.
		method.releaseConnection();
	}
}

but when "method = new PropFindMethod(resource);" is executed my
aplication go to finally and don't put nothing in the log, what i need
to do to retrieve a file?

Thanks,
Bruno Vaz de Melo


Re: Problem Retrieve a file with webdav

Posted by Bruno Vaz de Melo Rodrigues <br...@gmail.com>.
This thing don't throwns exception.... i change the PropFindMethod to
GetMethod and works. I don't know its the best thing but works.

Thanks.

Em Seg, 2012-01-16 às 18:58 +0000, Tobias Bocanegra escreveu:
> Hi,
> what's the exception that is thrown?
> 
> --
> toby
> 
> On Mon, Jan 16, 2012 at 3:38 AM, Bruno Vaz de Melo Rodrigues
> <br...@gmail.com> wrote:
> >
> > I put a file in jackrabbit workspace using webdav, but i can't retrieve
> > this file. I try this:
> > public byte[] readFile(WebDavServerConfig serverConfig, String path,
> > String fileName) throws BasicException {
> >        //String resource =
> >                "http://localhost:9080/jackrabbit-webapp-2.3.6/default/file.zip";
> >
> >        HttpClient client = getClient(serverConfig);
> >        PropFindMethod method = null;
> >        try {
> >                method = new PropFindMethod(resource);
> >                // Execute the method.
> >                int statusCode = client.executeMethod(method);
> >                // Read the response body.
> >                byte[] responseBody = method.getResponseBody();
> >
> >                return responseBody;
> >        } finally {
> >                // Release the connection.
> >                method.releaseConnection();
> >        }
> > }
> >
> > but when "method = new PropFindMethod(resource);" is executed my
> > aplication go to finally and don't put nothing in the log, what i need
> > to do to retrieve a file?
> >
> > Thanks,
> > Bruno Vaz de Melo
> >



Re: Problem Retrieve a file with webdav

Posted by Tobias Bocanegra <tr...@adobe.com>.
Hi,
what's the exception that is thrown?

--
toby

On Mon, Jan 16, 2012 at 3:38 AM, Bruno Vaz de Melo Rodrigues
<br...@gmail.com> wrote:
>
> I put a file in jackrabbit workspace using webdav, but i can't retrieve
> this file. I try this:
> public byte[] readFile(WebDavServerConfig serverConfig, String path,
> String fileName) throws BasicException {
>        //String resource =
>                "http://localhost:9080/jackrabbit-webapp-2.3.6/default/file.zip";
>
>        HttpClient client = getClient(serverConfig);
>        PropFindMethod method = null;
>        try {
>                method = new PropFindMethod(resource);
>                // Execute the method.
>                int statusCode = client.executeMethod(method);
>                // Read the response body.
>                byte[] responseBody = method.getResponseBody();
>
>                return responseBody;
>        } finally {
>                // Release the connection.
>                method.releaseConnection();
>        }
> }
>
> but when "method = new PropFindMethod(resource);" is executed my
> aplication go to finally and don't put nothing in the log, what i need
> to do to retrieve a file?
>
> Thanks,
> Bruno Vaz de Melo
>