Where do I get the Request-Object

Dear Friends,
I want to upload a file via HTTP multipart-formdata request (POST).
For that reason I use the FileUpload-API:
http://jakarta.apache.org/commons/fileupload/using.html
Everything is described perfectly and I am very happy that there is such a project!
But they didn't write how I could create a new Request-Object.
How do I do that?
Are there are different types of Request-Objects?
Here is my test-code so far:
public class FileUploader12 {
    List items = new ArrayList();
    /** Creates a new instance of FileUploader12 */
    public FileUploader12() {
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
Request request = new Request();
/*FileItem */ items = upload.parseRequest(request);
//Create a progress listener
ProgressListener progressListener = new ProgressListener(){
   private long megaBytes = -1;
   public void update(long pBytesRead, long pContentLength, int pItems) {
       long mBytes = pBytesRead / 1000000;
       if (megaBytes == mBytes) {
           return;
       megaBytes = mBytes;
       System.out.println("We are currently reading item " + pItems);
       if (pContentLength == -1) {
           System.out.println("So far, " + pBytesRead + " bytes have been read.");
       } else {
           System.out.println("So far, " + pBytesRead + " of " + pContentLength
                              + " bytes have been read.");
}Thank you very much!
With best Regards
MfG
Inno

Yes, please understand that commons-fileupload is intended to receive uploaded files on the server, NOT to upload the files to a server.
If you want to perform a form post from Java code, you should use the commons-httpclient package: http://jakarta.apache.org/commons/httpclient/

Similar Messages

  • Getting the Request Object in the EJB published as a Web Service

    Hi experts,
    I have a Portal Service that call a BAPI in a back-end system with the Connector Framework. I have a Portal Component that calls the Portal Service, passing the Locale (request.getLocale()) and the User (request.getUser()) object. It's work fine!
    I need to call the Portal Service by an EJB that is published as a Web Service. The connection between the EJB and Portal Service is ok, but I don't know how to get the Locale and the User object in the EJB to pass to the Portal Service.
    Is possible to get the request object from the HTTP SOAP Request?
    Thanks,
    Gustavo

    Hey Alice!
    The Feature Hashing module is actually a wrapper around
    Vowpal Wabbit's implementation of the murmurhash. Thus, it takes text in, and produces 2^N new features based on the text, where N is the bitsize specified in the module. These features (and not the original text!) should be used during model training.
    The Learner will then keep track of these features behind the scenes.
    When you publish your web service and these features are recomputed for new input text (same N), they are used as the features for scoring.
    Does that make sense?
    Regards,
    AK

  • Adobe Photoshop 12 -- Adobe asking for request code in order to register online -- where does one get the request code?

    Where does one get the request code in order to register online?

    If you have a redemption code you can redeem it here to get the serial number:
    https://redeem.licenses.adobe.com/getserial

  • I am trying to register my product online and am being asked for a request code -- where do I get the request code?

    I am trying to get a request code so that I can register.

    Do you mean a redemption code? Not sure at all what a request code would be. If it's a redemption code, you would have gotten that on a card in the box or possibly on your receipt when you bought PSE. Then you use that to get a serial number, which you enter when installing PSE:
    Redemption Code Help

  • How do I get to the request object in a webflow.

    How do I get to the request object in a webflow.
    I created a input process and one function it needs to do is create a cookie.
    Problem is I don't have a response object.
    How do I create/get the response object so I can create a cookie.
    Thanks
    Michael C Ford
    ------------------ Code Line ------------------------------------
    public Object process(HttpServletRequest req, Object requestContext)
    throws ProcessingException
    // get the pipeline and namespace info for the process
    PipelineSession pSession = null;
    String namespace = null;
    String username = req.getRemoteUser();
    pSession = getPipelineSession(req);
    namespace = getCurrentNamespace(pSession);
    /* ***** DO THE INITIAL CREATE OF THE BEAN *** */
         try {
              Properties props = new Properties();
              props.put(
                   Context.INITIAL_CONTEXT_FACTORY,
                   "weblogic.jndi.WLInitialContextFactory");
              Context ctx = new InitialContext(props);
              Object homeObject = ctx.lookup("com.??.??PortalMgr");
              SeechangePortalMgrHome seechangePortalMgrHome =
              (SeechangePortalMgrHome) javax.rmi.PortableRemoteObject.narrow(
                                                      homeObject,
                                                      SeechangePortalMgrHome.class);
              SeechangePortalMgr portalMgr = seechangePortalMgrHome.create();
    /* Set the initail user */
    portalMgr.setUser(username);          
              UserRuntime userRuntime = (UserRuntime)portalMgr.getRuntimeObject();
              System.out.print("Run Time User is " + userRuntime.getUserName());
              System.out.print("Run Time User is " + userRuntime.getOrgSeq());
    // ** cookies for Actuate XXX=(customer sequence ID), YYY=ZZZ is a dummy per
    their requirement
              Cookie cCustSeqNumber = new Cookie("XXX",userRuntime.getOrgSeq());
              Cookie cPassword = new Cookie("YYY","ZZZ");
              cCustSeqNumber.setPath("/");
              cPassword.setPath("/");
              ??response.addCookie(cCustSeqNumber);
              ??response.addCookie(cPassword);          
         } catch (Exception ee) {
              System.out.print("Unable to create Portal Manager" + ee);
    // at this point we add the logic to produce the bean
    return "success";

    Thanks
    Just what I needed, except I needed to caste response.
    Michael C
    "Daniel Selman" <[email protected]> wrote:
    Michael,
    // get the HttpServletResponse from the HttpServletRequest
    HttpServletResponse response =
    equest.getAttribute( WebflowConstants.HTTP_SERVLET_RESPONSE );
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    response.addCookie(cCustSeqNumber);
    response.addCookie(cPassword);
    You HAVE the HttpServletRequest...
    public Object process(HttpServletRequest req, ObjectrequestContext)
    throws ProcessingExceptionMake sense?
    Dan
    "michael C Ford" <[email protected]> wrote in message
    news:[email protected]...
    How can I get to the response this way ?
    this just stored the response as an attribute did it now ?
    If I don't have it, how can I use it in a setAttribute ?
    Sorry just a little slow
    I can't do this can I ?
    request.setAttribute(WebflowConstants.HTTP_SERVLET_RESPONSE,response);
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    response.addCookie(cCustSeqNumber);
    response.addCookie(cPassword);
    "Daniel Selman" <[email protected]> wrote:
    Michael,
    I found this handy snippet in our code:
    // Put the httpServletResponse into the request, this is done
    in
    case IPs want to
    // use the response to deposit cookies. The IPs maynot howeverwrite
    // anything to the response as this will cause an
    IllegalStateException
    request.setAttribute(WebflowConstants.HTTP_SERVLET_RESPONSE,
    response);
    So, the HttpServletResponse is bound into the HttpServletRequest usingthe
    key, WebflowConstants.HTTP_SERVLET_RESPONSE.
    Magic!
    Sincerely,
    Daniel Selman
    "michael C Ford" <[email protected]> wrote in message
    news:[email protected]...
    How do I get to the request object in a webflow.
    I created a input process and one function it needs to do is create
    a
    cookie.
    Problem is I don't have a response object.
    How do I create/get the response object so I can create a cookie.
    Thanks
    Michael C Ford
    ------------------ Code Line ------------------------------------
    public Object process(HttpServletRequest req, Object
    requestContext)
    throws ProcessingException
    // get the pipeline and namespace info for the process
    PipelineSession pSession = null;
    String namespace = null;
    String username = req.getRemoteUser();
    pSession = getPipelineSession(req);
    namespace = getCurrentNamespace(pSession);
    /* ***** DO THE INITIAL CREATE OF THE BEAN *** */
    try {
    Properties props = new Properties();
    props.put(
    Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    Context ctx = new InitialContext(props);
    Object homeObject = ctx.lookup("com.??.??PortalMgr");
    SeechangePortalMgrHome seechangePortalMgrHome =
    (SeechangePortalMgrHome) javax.rmi.PortableRemoteObject.narrow(
    homeObject,
    SeechangePortalMgrHome.class);
    SeechangePortalMgr portalMgr = seechangePortalMgrHome.create();
    /* Set the initail user */
    portalMgr.setUser(username);
    UserRuntime userRuntime = (UserRuntime)portalMgr.getRuntimeObject();
    System.out.print("Run Time User is " + userRuntime.getUserName());
    System.out.print("Run Time User is " + userRuntime.getOrgSeq());
    // ** cookies for Actuate XXX=(customer sequence ID), YYY=ZZZ isa
    dummy per
    their requirement
    Cookie cCustSeqNumber = new
    Cookie("XXX",userRuntime.getOrgSeq());
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    ??response.addCookie(cCustSeqNumber);
    ??response.addCookie(cPassword);
    } catch (Exception ee) {
    System.out.print("Unable to create Portal Manager" + ee);
    // at this point we add the logic to produce the bean
    return "success";

  • [Solved] The requested object does not exist. (Exception from HRESULT: 0x80010114)

    I have a 8 node cluster with Hyper-V, which will be 10 nodes when it's finally done.
    Recently I've been try to add nodes and though that went fine, after about a week I could not open the Failover Cluster Manager anymore.
    After some checking I found out that the latest added node was giving problems.
    VM's on the node still run and function properly, but most Powershell commands result in a "The requested object does not exist. (Exception from HRESULT: 0x80010114)".
    I can suspend the node with Suspend-ClusterNode, but draining roles was unsuccesful in one case.
    In the other there were no VM's on the node so suspending went fine.
    What I did find out was that when I tried to ping the node from another, proper functioning node, it took a while before the pinging started. It felt like the interface had to come back online on the problem node.
    After that, I could add the cluster to the Failover Cluster Manager. However, Powershell commands still give a 0x80010114 error or a CIM error for when I use Get-NetAdapter.
    A reboot resolves the problem, but only for about a week.
    I know there is a topic with the same title already, but the wbemtest en rollup update "answer" is totally unclear to me why I should change something with wbemtest, or why to install updates that to me have nothing to do with this problem.
    Before I did the ping test from a functioning node I pinged my DC and another node from the problem node just fine.
    No waiting at all.
    The cluster has three networks. Management (host only), Live Migration and iSCSI (also a VMSwitch for certain VM's).
    I have no idea where to look. Evenviewer doesn't give me anything I can work with that I can find...

    Hi,
    Are you using the HP servers? It seems is the HP Nic team service was causing the issue, please try to
     disabled the HP NIC team service from services and restarted the WMI service.
    The related third party information:
    Advisory: (Revision) HP ProLiant Servers - Systems Running Microsoft Windows Server 2012 or 2012 R2 May Experience a Memory Leak Up To 5 Mb/ Hour for Some NIC Teaming Configurations
    http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay/?javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken&javax.portlet.prp_ba847bafb2a2d782fcbb0710b053ce01=wsrp-navigationalState%3DdocId%253Demr_na-c04209163-2%257CdocLocale%253D%257CcalledBy%253D&javax.portlet.tpst=ba847bafb2a2d782fcbb0710b053ce01&ac.admitted=1401176219136.876444892.199480143
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • Where can I get the latest Microsoft.SharePoint.ApplicationPages.dll for SharePoint 2010?

    Can somebody point me to where I can get the latest Microsoft.SharePoint.ApplicationPages.dll for SharePoint 2010?
    When I go into Library Settings on any library or list in SharePoint 2010 I’m getting an unexpected error; I see this in the SharePoint log:
    11/18/2014 13:12:26.36 w3wp.exe (0x2260)                       0x33EC  SharePoint Foundation        
            Runtime                                      
    tkau       Unexpected       System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks()    
    at Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventArgs e)     at ASP._layouts_listedit_aspx.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 03c7c5b4-407f-461c-9cf7-0304eb797b1a
    I searched online and found this:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/ed5aa58a-f5cc-4449-8bfd-65ca6f101641/list-settings-page-error-on-all-type-of-sharepoint-2010-listslibraries?forum=sharepointgeneralprevious.  It says:
    We noticed exactly the same issue after applying some SharePoint updates (SP1 + October 2011 CU).  The problem turned out to be that there was an older version (V14.0.4762.1000) of Microsoft.SharePoint.ApplicationPages.dll in the GAC. 
    This version was being loaded instead of the latest version of the DLL (14.0.6112.5000).
    Loading the latest version of Microsoft.SharePoint.ApplicationPages.dll fixed the problem with the List/Library settings page.
    I check our Microsoft.SharePoint.ApplicationPages.dll and found that we have version 14.0.6024.1000.
    I would like to try replacing it with the latest version to see if that could fix the problem going into library settings.
    Does someone know where I can get the latest Microsoft.SharePoint.ApplicationPages.dll for SharePoint 2010?
    David

    You would need to extract it from an update. Pre-SP2 SharePoint 2010 is no longer supported, I'd recommend upgrading to SP2 which should take care of any versioning issues.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How to get the request in a SearchComponent

    Hello,
    I developed a search component and want to implement a language specific logic.
    Therefore I tried to get the component request to get the user to get the users language.
    But unfortunatly I'm not able to get the request. In a normal AbstractPortalComponent there's no problem to get the request, but my interface ISearchComponent, which I have to use, does not provide any kind of request...
    Please help,
    Regards,
    Axel

    Hi Axel,
    Did you just implement an ISearchComponent interface? If yes, then you have implemented setDynPage(dynPage) which is called by the framework passing a DynPage object. On that you can call getRequest(). See http://media.sdn.sap.com/html/submitted_docs/nw_kmc/javadoc/com/sapportals/wcm/control/util/search/ISearchComponent.html and https://media.sdn.sap.com/javadocs/NW04/SPS15/hb/com/sapportals/htmlb/page/DynPage.html for details.
    If the answer to the initial question is "no", please provide details which class you may have extended etc.
    Hope it helps
    Detlev

  • Can I get the HttpServletRequest object in my custom auth providers?

    Hello -
    If I write a custom authentication or identity assertion provider, is there a way to get the HttpServletRequest object of the user's request?
    Thanks,
    -- Scott

    You can do it from your identity asserter in the following way!
    public CallbackHandler assertIdentity(String type, Object token, ContextHandler context) throws IdentityAssertionException
    Object requestValue = context.getValue("com.bea.contextelement.servlet.HttpServletRequest");
    HttpServletRequest request = (HttpServletRequest) requestValue;
    -Faisal
    http://www.weblogic-wonders.com

  • Where could I get the Adobe Reader Mobile 9 SDK?

    I am develop a windows mobile 6.5 application and want to do some tests on viewing PDF file with the mobile.
    http://www.adobe.com/devnet/readermobile/
    I followed as above instruction to mail to [email protected] several times but returned with Mail Failure each time.
    Then where could I get the Adobe Reader Mobile 9 SDK, please? Thanks.
    Besk Regards

    You sure?
    http://www.adobe.com/devnet/readermobile/
    According to the text of that link, the Reader 9 Mobile SDK supersedes the 2.5 SDK. The same page has a link ot a request form, which I guess could get the ball rolling for a proper conversation on the SDK and whether Reader 9 Mobile would work for you.
    I just reread your message - obviously you tried there already. I'll have a dig about see if I can rustle up some extra info for you.
    HTH.
    Steve
    Message was edited by: Steve Howard * ACE *

  • The requested object is locked by another transaction

    Hi All,
    I got a problem while loading data from an ODS to another ODS, it shows 450 records but request is red, it says
    'The requested object is locked by another transaction'
    Message no. MC602
    Diagnosis
    A lock requested by calling an ENQUEUE function module cannot be provided because the object in question has already been locked by its own transaction.
    Technical Information: The C_ENQUEUE routine returns the following values:
    COLLISION_OBJECT = ERSMONFACT
    COLLISION_UNAME = SINGH
    System response
    The ENQUEUE function module triggers an appropriate exception. If this exception was not intercepted by the application program, it leads automatically to the active SAP transaction being cancelled.
    Procedure
    Once the ENQUEUE function module is called, the application program should intercept this exception and react to it appropriately.
    I tried SM12 but there is no lock entry, can u suggest some thing?
    Regards,

    Hello,
    here your dso seems to be lock as some read and write opertaion is happening at the time u r running the dtp.
    Here two things to look :
    1.Check the error that ur getting while running a dtp the process monitor etc try to find the request id which has locked the dso . Copy that request id go to t-code RSRQ see whats this request who is user,target etc..contact user for cancelling the job if it has been stuck for long long time. Copy the JOB ID from  RSRQ for that rquest go to SM37 give the date as there in RSRQ and kill the job
    2.GO to SM12 try to search the object there and remove the lock.
    Thanks,
    Deepak

  • Getting the connection object in graph

    As part of Denormalizer component's Denormalize property where we have the logic of collapsing/denormalising the records we want to execute a sql query using PreparedStatement which requires Connection object.how do I get the connection object and execute a query.Can some one please share the java doc of the classes I can use.
    Do I get any class under org.jetel package which can be useful to get the Connection object.

    As part of Denormalizer component's Denormalize property where we have the logic of collapsing/denormalising the records we want to execute a sql query using PreparedStatement which requires Connection object.how do I get the connection object and execute a query.Can some one please share the java doc of the classes I can use.
    Do I get any class under org.jetel package which can be useful to get the Connection object.

  • Remove-DfsnRootTarget - The requested object could not be found

    Hi,
    I just discovered that both target paths in a DFS root target is referenced by NetBIOS name, not FQDN (the names is generalized):
    Get-DfsnRootTarget -Path \\Contoso.local\AccountingSoftware| Format-List
    Path                  :
    \\Contoso.local\AccountingSoftware
    TargetPath            :
    \\Contoso-FS1\AccountingSoftware
    State                 : Online
    ReferralPriorityClass : sitecost-normal
    ReferralPriorityRank  : 0
    Path                  :
    \\Contoso.local\AccountingSoftware
    TargetPath            :
    \\Contoso-FS2\AccountingSoftware
    State                 : Online
    ReferralPriorityClass : sitecost-normal
    ReferralPriorityRank  : 0
    The goal is to remove and re-add the target paths one by one in order to use FQDN.
    When trying to remove one of the targets, I receive the following error:
    Remove-DfsnRootTarget -TargetPath "\\Contoso-FS2\AccountingSoftware" -Path "\\Contoso.local\AccountingSoftware"
    Remove-DfsnRootTarget : The requested object could not be found.
    What could be the reason for this? I get a similar error message both when using the DFS MMC tool and dfsutil.

    Hi,
    Based on your description, we can follow the article below to configure DFS to use fully qualified domain names in referrals.
    How to configure DFS to use fully qualified domain names in referrals
    http://support.microsoft.com/kb/244380/en-us
    Best regards,
    Frank Shen

  • What is gWinCal in dat picker and from where can i get the details

    hello,
    i saw the use of gWinCal in the datepicker and in many js files.
    in calander of js files gWinCal is used.
    what is gWinCal and where can i get the description about gWinCal ?
    i also saw
    this.gWinCal.document.close();
    this.gWinCal.document.open();
    etc..
    where the this.gWiinCal is defined and what is it ?
    please help me in this regard.
    thanks
    Archana

    Hi Archana-
    I tried to analyse the following URLs.
    http://www.koders.com/javascript/fidDEECF746921981FD9BD64B2B0EF7402979BF0570.aspx
    http://www.wodeveloper.com/omniLists/webobjects-dev/2002/June/msg00804.html
    function show_yearly_calendar(p_item, p_year, p_format) {
         // Load the defaults..
         if (p_year == null || p_year == "")
              p_year = new String(gNow.getFullYear().toString());
         if (p_format == null || p_format == "")
              p_format = "MM/DD/YYYY";
         var vWinCal = window.open("", "Calendar", "scrollbars=yes");
         vWinCal.opener = self;
         ggWinCal = vWinCal;
         Build(p_item, null, p_year, p_format);
    Mainly in the code snippet from the second URL I could find that this is nothing but a variable.
    for example vWinCal above , is a local variable which points to the calendar above.
    similarly gWinCal is a global Calendar-Window object and nothing more.
    You were not able to find it - since you will not find much of code level variable definitions
    anywhere.
    It is everewhere used as a object only which has reference to the calendar window.
    I hope it makes sense to you.
    Regards,
    Vishal

Maybe you are looking for

  • TS3276 Lost messages in the sent messages folder?

    Has anyone lost mobileme (icloud) messages in the sent messages folder?

  • FTP: Want to check if the file is completely being written in the server or

    Hi, I am very much new to this FTP, I am using the apache API (commons-net.jar) in my ftp client. I have a problem here, I want to find out whether the remote file (in the server) is completely written or not. Is there anyway in which the mode (writi

  • Pse6 organizer to editor issues

    On occasion I cannot open a file in the editor after clicking on it in the organizer. After selecting "full edit" in organizer, the editor will open but then it stops cold- fully functional, but without my image to edit. Any suggestions will be much

  • What is the DW CS3 license ?

    Hi there, I am a single programmer/web developer. Who has a workstation as my main computer and a notebook for when visiting client's and travelling. With the CS3 products requiring activation, am I permitted to install on both my computers ? TIA - D

  • IOS8.1.2 won't display the battery info after restating my iPhone!

    There is a problem on iOS8.1.2 just have found it this morning and it is related to the battery usage information after you restart or shutdown your iPhone it goes blank and won't show you information about the usage until recharge the phone again!