Thanks Paul.
I declared my form in my jsp as ,
<form action="/REST-POST-Demo/resources/filepost/form-data"
method="POST" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="upload" />
</form>
when I select a particular file and click on Upload, I just wanted to
read the content of the file and print it on Console.
How can I do that.
bp.getContentDisposition().getParameters().get("name") is returning me
the value as "file"
Thanks,
Anil
Paul Sandoz wrote:
>
> On Nov 24, 2009, at 1:52 PM, Anil Kumar Veeramalli wrote:
>
>> Hi,
>>
>> 1)
>> bp.getParameterizedHeaders().getFirst("Content-Disposition").getParameters().get("name"),
>> used to print the content of the file.
>> 2) as per your new API, I used
>> bp.getContentDisposition().getParameters().get("name"). is not
>> showing the content of the file I uploaded.
>>
>
> Note that the "name" parameter is the name of the file and not the
> contents of the file.
>
> What is the value?
>
> You should be able to use:
>
> bp.getContentDisposition().getName();
>
> and it should have the same value as obtained from:
>
> bp.getContentDisposition().getParameters().get("name")
>
> because the former is obtained from the latter:
>
> public FormDataContentDisposition(HttpHeaderReader reader) throws
> ParseException {
> super(reader);
> if (!getType().equalsIgnoreCase("form-data")) {
> throw new IllegalArgumentException("The content dispostion
> type is not equal to form-data");
> }
>
> name = getParameters().get("name");
> if (name == null) {
> throw new IllegalArgumentException("The name parameter is
> not present");
> }
> }
>
>
> BTW it is not necessary to manually call bp.cleanup, it will be
> performed by Jersey if you utilize the injection mechanism for
> obtaining body parts.
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>