Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get MultiPartRequestWrapper object in Jira

satya L May 20, 2012

Hi ,

I am trying to get "webwork.multipart.MultiPartRequestWrapper" obect in my Jira plugin code.

Actually i want to read all the request information like Filenames,contentType and FILE from the Jira UI.

I am using the below code in my class to get all these details , but i am getting the object as null.

import webwork.action.ActionContext;
import webwork.multipart.MultiPartRequestWrapper;

import jxl.Workbook;

public abstract class CSVImporterAction extends JiraWebActionSupport {

MultiPartRequestWrapper multiWrapper = ActionContext.getMultiPartRequest();


Enumeration enumeration = null;

enumeration = multiWrapper.getFileNames();

while (enumeration.hasMoreElements()) {

.

.

}

}

Can any one please suggest the solution to get the "MultiPartRequestWrapper" object and read all the information from Jira UI (like filename, contentType and FILE content) or share any sample working example.

Thanks in Advance,

Satya.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2012

Try (needs commons-io), there is no meta data other than in the File class:

MultiPartRequestWrapper wrapper=(MultiPartRequestWrapper)ServletActionContext.getRequest();
File f=wrapper.getFile("yourFileInputName");
byte[]data=IOUtils.toByteArray(new FileInputStream(f))

satya L May 23, 2012

Thanks for your Andy..

Now i got it. I am not getting because i have not mentioed enctype as "multipart/form-data.

Vikash Kumar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2013

@andy brook, @satya L

In my case i am still getting MultiPartRequestWrapper null as the request itself is plain/text seen in firebut.

Can you plz tell me how did you achive this.

Thanks in Adv. :)

TAGS
AUG Leaders

Atlassian Community Events