How to use the post method?

Hello

I need to send an image on the server using the post method.

I connect using Http, like this:

HttpConnection _http = (HttpConnection) Connector.open (address);

can someone provide an example of how can I use a post method to send the data to the server?

Kind regards

I solved the problem. Here is my code, which works:

Bitmap _bitmap = new Bitmap(Display.getWidth(), Display.getHeight());
            Display.screenshot(_bitmap);

JPEGEncodedImage _jpg = JPEGEncodedImage.encode(_bitmap, 20);
DataBuffer _db = new DataBuffer();
_db.write(_jpg.getData());

_http = (HttpConnection)                    Connector.open(_url, Connector.READ_WRITE);

_http.setRequestMethod("POST");

_http.openOutputStream().write(_db.toArray());
_http.getResponseCode();

Kind regards

Tags: BlackBerry Developers

Similar Questions

  • How to send images and a single parameter to the server by using the POST method. ?

    Hey

    I want to send images and a single parameter to the server by using the POST method.

    Please help me.

    Vaishali, take a look at this-

    http://developer.Nokia.com/community/wiki/HTTP_Post_multipart_file_upload_in_Java_ME

    Thank you.

  • How to use the find method to search for multiple items in a single paragraph?

    I'm desigining a script to find all instances where ctrl + b and ctrl + i are applied to body text and then replace the format of these characters replaced with chartag italic or bold.  Here's what the script is supposed to do:

    1. put the find method in a while loop that overrides seeks format character.
    2. If a substitution of format character is found, pass the text range returned by the find method and the CharPropsChange flag in the GetTextForRange method.
    3. Use a Boolean comparison between the idata of the text element to the angle of character and character constant weight.
    4. What that is the boolean is set to true, and then use the SetTextProp method to set the properties of the text range for the italic or bold character tag properties.

    This script works on the substitution of format first character found however it ignores other substitutions in the same paragraph. The cause of this is that the while loop updated the line of text control used by the find method for the following paragraph in the stream. I think I need to add an inner loop that runs through all the text in a single paragraph, where teaching iteration the loc text used by the find method is based on the same paragraph, but the offset is changed. I don't know how to do this.

    function removeOverrides (RPSC)

    {

    var vDocStart = pDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

    var vBoldFmt = getCharFmt (RPSC, "Bold")

    var vItalicFmt = getCharFmt (RPSC, 'Italic')

    initFA_errno ();

    While (FA_errno is constant .FE_Success)

    {

    var vTextLoc = new TextLoc(vDocStart,0);

    var vFindParams = findOverrideParams (CDRP);

    var vTextRange = pDoc.Find (vTextLoc, vFindParams);

    If (vTextRange.beg.obj.ObjectValid ())

    {

    var vTextItems = pDoc.GetTextForRange (vTextRange, Constants.FTI_CharPropsChange)

    If (vTextItems.length ==! 0)

    {

    If (vTextItems [0] .idata == constant .FTF_WEIGHT)

    {

    pDoc.SetTextProps (vTextRange, vBoldFmt.GetProps ())

    }

    If (vTextItems [0] .idata == constant .FTF_ANGLE)

    {

    pDoc.SetTextProps (vTextRange, vItalicFmt.GetProps ())

    }

    } else (Log (vLogFileName, ' \nERROR: none of the items were found in the table in text format but alternative size were found: ' + pDoc.Name))

    }

    vDocStart = vDocStart.NextPgfInFlow;

    }

    }

    function findOverrideParams (RPSC)

    {

    var vFindParams = AllocatePropVals (1);

    vFindParams [0].propIdent.num = Constants.FS_FindObject;

    vFindParams [0].propVal.valType = Constants.FT_Integer;

    vFindParams [0].propVal.ival = Constants.FV_FindCharacterFormatOverride;

    Return vFindParams;

    }

    Another approach (which is what I usually did) is after the first search to set vTextLoc = vTextRange.end

    Whatever it is, you might consider moving your initialization of vTextLoc and vFindParams outside the while loop. The settings do not change, why redefine them for each search?

  • How to use the find method to search for character format substitutions and FMP?

    I strongly suspect that I should be able to use the find method to search for paragraph substitutions and format as these options are available in the Find dialog box. However, because of the excruciating Extendscript documentation from Adobe, I not was able to find the key pieces of information that I need. I found these constants:

    • Constants.FV_FindPgfFormatOverride
    • Constants.FV_FindCharacterFormatOverride

    But he has literally no information about them. It is not yet a definition, so I'm actually just a guess. However, I think that I need to somehow use these constant within the parameters of the Find method. Any ideas on how to do it?

    You're right, there are still some bugs to work out of the documentation, although it has already improved since I started w / Extendscript last summer.

    Find two constants must be defined as the ival for a PropVal FindObject, for example:

    var myDoc is app. ActiveDoc;

    var docStart = myDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

    tloc var = new TextLoc(docStart,0);

    var findParams = AllocatePropVals (1);

    findParams [0].propIdent.num = Constants.FS_FindObject;

    findParams [0].propVal.valType = Constants.FT_Integer;

    findParams [0].propVal.ival = Constants.FV_FindCharacterFormatOverride;

    myDoc.Find (tloc, findParams);

    Depending on what you're trying to accomplish, you can also take a look at the property FormatOverride of the Doc, bmp and item objects.

  • Redirect to another page with parameter passing using the POST method

    Hello

    I need to redirect to another page and pass parameters to it with the POST (not GET) method. How can I do?

    So far, I tried the 2 options and none of them works very well:
    1. I wrote a pl/sql procedure, but if I run it, then the page runs on my server application instead of actually going to another page in another server (I see the neame of the procedure in the web browser's address bar). Is there a way to work around a bit so that really, it goes to another page and pass the variables?

    procedure do_post)
    p_api_url in varchar2)
    is
    l_http_req utl_http.req;
    l_http_resp utl_http.resp;
    l_response varchar2 (4000);
    l_post varchar2 (4000);
    v_line varchar2 (4000);
    v_wallet varchar2 (100): = "file:/etc/ORACLE/WALLETS/oracle5";
    v_wallet_pwd varchar2 (100): = "test1234".
    Start
    l_post: = ' VK_SERVICE = 1001 & VK_VERSION = 008 & VK_SND_ID = testvpos & VK_STAMP = 88';

    Utl_http.set_Proxy (apex_application.g_proxy_server, NULL);
    Utl_http.set_persistent_conn_support (true);
    Utl_http.set_transfer_timeout (300);
    Utl_http.set_wallet (v_wallet, v_wallet_pwd);
    l_http_req: = utl_http.begin_request (p_api_url, 'POST');
    Utl_http.set_header (l_http_req, "Proxy-Connection ',' Keep-Alive'");
    Utl_http.set_header ("l_http_req, 'Content-Type', ' application/x-www-formulaires-urlencoded; charset = utf-8 ');
    Utl_http.set_header (l_http_req, "Content-Length", length (l_post) ");
    Utl_http.write_text (l_http_req, l_post);
    l_http_resp: = utl_http.get_response (l_http_req);

    LOOP
    Utl_http.read_line (l_http_resp, v_line, TRUE);
    HTP.p (v_line);
    END LOOP;
    Utl_http.end_response (l_http_resp);

    EXCEPTION
    WHEN utl_http.end_of_body THEN
    Utl_http.end_response (l_http_resp);
    end do_post;


    2. the second option, I tried is to put this script to my page of request code:

    < name of the form = 'mounted' action = 'https://www.somekindofurl.com/cgi-bin/dv.sh/un3min.r. '
    method = "POST" target = "_top" >
    < input type = "hidden" name = "VK_SERVICE" value = "1001" >
    < input type = "hidden" name = "VK_VERSION" value = "008" >
    < input type = "hidden" name = "VK_SND_ID" value = "testvpos" >
    < input type = "hidden" name = "VK_STAMP" value = "88" >
    < input type = "submit" value = "Let's's Pay" >
    < / make >

    < / make >

    But it does not work as APEX has its own system of Forms control. Is it possible to play? I tried to delete #FORM # of page templates and it works fine then. The problem is that I have other forms on the page as well (login form + search form) so I can't remove this manipulation of shape native APEX. Is it possible to play with it?


    Thank you much in advance.

    Hi Ibenarobeno,

    Your form can live at the end of the page with all the hidden items.

    You can then control with buttons and fields within the form of the Apex.
    through a bit of javascript.

    Concerning

    Michael

  • How to use the scrollInToView method in Adobe edge animate

    I would use scrollInToView method in one of my pages long, but I can't call this code, any help would be greatly appreciated.

    Hi, Krutneam.

    We can get the DOM element using jQuery () .get () method.

    If you want to scroll the window for pos of the "Rectangle" on the main timeline. Like this.

    sym.$('Rectangle').get(0).scrollIntoView();
    

    Thank you.

    UME.

  • Using the addEventListener method

    I want to put an addEventListener on a group of radio buttons for any button is selected the same function is executed.  However, the function can you use a term like currentTarget to tell which button has been selected?  I know with actionScript, you can use MouseEvent.CLICK in the listener then event.currentTarget service, but this doesn't seem to work.  The listener doesn't like 'click' and everything I try with currentTarget generates a run-time error.  I know that I can use the function onClick for each button, but I was wondering how to use the addEventListener method.  For some reason, I still have a horrible time, understand the documentation from Adobe.  It comes to PS CS3 & CS4 PS.  Thank you!

    Here is an example of adding an event handler for a control that does not already have a built-in Manager:

    createDialog = function ( ) {
       var dlg = new Window( 'dialog', 'Image Mouse Event Example Script' );
       var i = ScriptUI.newImage( new File('/c/k.png'));
       dlg.image = dlg.add ('image' , undefined,  i, {name:'temp'});// also accepts jpg
       dlg.btnPnl = dlg.add( 'panel', undefined );
       dlg.btnPnl.orientation = "row";
       dlg.btnPnl.alignment = "right";
       dlg.btnPnl.preferredSize [ 80, 80 ]
       dlg.btnPnl.okBtn = dlg.btnPnl.add( 'button', undefined, 'Ok', { name:'ok' });
       dlg.btnPnl.cancelBtn = dlg.btnPnl.add( 'button', undefined, 'Cancel', { name:'cancel' });
       return dlg;
    };
    initializeDialog = function( w ) {
       // Set up initial control states
       ScriptUI.events.createEvent('MouseEvent');
       w.image.addEventListener ('mouseover', btnMouseEventHandler, false);
       w.image.addEventListener ('mouseout', btnMouseEventHandler, false);
        with ( w.btnPnl ) {
             // The Ok and Cancel buttons close this dialog
             okBtn.onClick = function ( ) { this.parent.parent.close( 1 ); };
             cancelBtn.onClick = function ( ) { this.parent.parent.close( 2 ); };
          }
     }
    
    runDialog = function( w ) {
       return w.show( );
    };
    var win = createDialog();
    initializeDialog(win);
    runDialog(win)
    
    function btnMouseEventHandler (event) {
         try {
              var m = event.type// 'mouseover or mouseout
              if ( m == 'mouseover' ) win.image.icon = new File('/c/t.png');
              if ( m == 'mouseout' ) win.image.icon = new File('/c/k.png');
         }
         catch (e) {
         }
    }
    
  • How to set the position and size of the façade using the FPRunTimePosRunCustom method in a c# application?

    How to set the position and size of the façade using the FPRunTimePosRunCustom method in a c# application?

    I found a solution! -Set the size and position of the façade with the help of the

    File > VI properties > window running Position (in category list) > custom (in position of menu drop-down).

    then just accept the current position and size (leave the boxes checked) or set values you want directly (uncheck the boxes and fill in the numbers), or physically position and size the façade and use, the "set to current location" button and press "set size" current All that is easier for you.

    OK so it does not make use of the method VI Methods (Active X) FPRunTimePosRunCustom ([Position], [Size]) but if labview want to make him difficult to use then other means must be found.

  • I don't know how to use the method (PDDrawPageOrCosObjectToBuffer) in the Mac environment.

    Use the method of PDDrawPageOrCosObjectToBuffer of Acrobat SDK from DC () in the Mac environment,

    I want to get a screenshot of the PDF in the bitmap to the screen.

    A description of PDDrawPageOrCosObjectToBuffer () in Acrobat DC SDK API references, but I do not understand how to use the method.

    Please tell me this use.

    If there is a code example using PDDrawPageOrCosObjectToBuffer (), I'm happy.

    Hello

    My code is finally working with PDDrawPageOrCosObjectToBuffer. I hope it helps someone:

    void releaseBufferForCG (void * / * info * /, const void * data, size_t / * size * /)

    {

    Free ((void*) Data);

    }

    CGImageRef CAcrobatBitmapCreator::ConvertToBitmap (const PDPage & i_rPDPage,

    ASFixedMatrix & i_rTransform,

    int & i_rBitmapWidth,

    int & i_rBitmapHeight)

    {

    Get the rect in user-space coordinates update

    ASRealRect updateRectReal = {0,0,0,0};

    ASFixedRect boxFixed;

    PDPageGetBBox (i_rPDPage & boxFixed);

    updateRectReal.top = ASFixedToFloat (boxFixed.top);

    updateRectReal.left = ASFixedToFloat (boxFixed.left);

    updateRectReal.right = ASFixedToFloat (boxFixed.right);

    updateRectReal.bottom = ASFixedToFloat (boxFixed.bottom);

    Convert the fixed transformation matrix to real

    ASRealMatrix transformReal = {0, 0, 0, 0, 0, 0};

    transformReal.a = ASFixedToFloat (i_rTransform.a);

    transformReal.b = ASFixedToFloat (i_rTransform.b);

    transformReal.c = ASFixedToFloat (i_rTransform.c);

    transformReal.d = ASFixedToFloat (i_rTransform.d);

    transformReal.tx = ASFixedToFloat (i_rTransform.h);

    transformReal.ty = ASFixedToFloat (i_rTransform.v);

    ASRealRect destRectReal = {0, i_rBitmapHeight, i_rBitmapWidth, 0}; l, r, t, b

    Prepare the buffer for drawing https://forums.adobe.com/thread/1850089

    This first call to PDDrawPageOrCosObjectToBuffer is only used to get the size of the buffer.

    ASCab flags = ASCabNew();

    ASInt32 bitsPerChannel = 8;

    ASUns32 bufferSize = PDDrawPageOrCosObjectToBuffer (i_rPDPage,

    CosNewNull(),

    ASAtomFromString ("DeviceRGB"),

    NULL,

    NULL,

    bitsPerChannel,

    flags,

    9,

    NULL,

    & transformReal,

    & destRectReal,

    & updateRectReal,

    NULL,

    0,

    (NULL);

    char buffer = (char *) malloc (bufferSize);

    Memset (buffer, 0xff, bufferSize);

    Draw in the buffer

    ASCabPutBool (flags, kPDPageUseAnnotFacesStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothTextStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothLineArtStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothImageStr, true);

    bufferSize = PDDrawPageOrCosObjectToBuffer (i_rPDPage,

    CosNewNull(),

    ASAtomFromString ("DeviceRGB"),

    NULL,

    NULL,

    bitsPerChannel,

    flags,

    9,

    NULL,

    & transformReal,

    & destRectReal,

    & updateRectReal,

    buffer,

    bufferSize,

    (NULL);

    Convert buffer CGImage

    // 1. Remove the 4 bytes of padding at the end, in a new buffer.

    size_t bytesPerRow = (i_rBitmapWidth * 3);

    bytesPerRow = (bytesPerRow % 4 == 0? bytesPerRow: bytesPerRow + (4-(bytesPerRow % 4)));

    size_t bytesPerRowForGC = i_rBitmapWidth * 3;

    size_t bufferCGSize = bytesPerRowForGC * i_rBitmapHeight;

    char * bufferForGC = (char *) malloc (bufferCGSize);

    Memset (bufferForGC, 0xff, bufferCGSize);

    for (int lineIndex = 0; lineIndex)< i_rbitmapheight;="">

    {

    char * destGCPtr = bufferForGC + (lineIndex * bytesPerRowForGC);

    char * srcPtr = buffer + (lineIndex * bytesPerRow);

    If ((srcPtr + bytesPerRowForGC)<= (buffer="" +="" buffersize)="" &&="" (destgcptr="" +="" bytesperrowforgc)=""><= (bufferforgc="" +="" buffercgsize)="">

    {

    memcpy (destGCPtr, srcPtr, bytesPerRowForGC);

    }

    on the other

    {

    break;

    }

    }

    // 2. Create a CGImage using the new buffer.

    CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,

    bufferForGC,

    bufferCGSize,

    releaseBufferForCG); Buffer are ions released this reminder

    Space color CGColorSpaceRef = CGColorSpaceCreateDeviceRGB();

    CGImageRef finalImage = CGImageCreate (i_rBitmapWidth,

    i_rBitmapHeight,

    bitsPerChannel,

    bitsPerChannel * 3.

    bytesPerRowForGC,

    color, space

    kCGImageAlphaNone,

    provider,

    NULL, / / decode (of remapping the colors)

    true, / / interpolate (pixel smoothing)

    kCGRenderingIntentDefault);

    CGColorSpaceRelease (colorspace);

    CGDataProviderRelease (provider);

    Free (buffer);

    FinalImage return;

    }

    David

  • How to use the PrintJob.addPage method print movieclips on frame?

    Hello

    I am using Flash CS3, AS2.

    I try to print the movieclips placed on different images in the main timeline.

    First of all, I have to print the movieclip placed on the 172 chassis, and then print a movieclip on the 179 chassis and so on...

    I applied the code below to the event (release) on a button named btnPrint:

    var my_pj:PrintJob = new PrintJob();

    If (my_pj.start ()) {}

    var pageAdded:Boolean = false;

    pageAdded = my_pj.addPage (0, {xMin:394, xMax:1033, yMin:46, yMax:953}, null, 172);

    If {(pageAdded)

    my_pj. Send();
    }
    }

    I have 2 problems with the above code.

    First of all, when I click on btnPrint in my flash animation in the web browser, and then press the "print" button in the printer dialog, it can print the movieclip placed on the 172 but frame flash animation in my web browser goes to the framework 172 and stops there. I don't want my flash movie to actually go to the 172 section where the movieclip is placed, but I want to keep it at the current frame.

    The second problem is the flash movieclip placed on frame 172 a actionscript code in this document, which sets the text in the text box inside the movieclip to the value of the variable that was recovered using the loadVariablesNum() method. However, print them page shows the movieclip with no actionscript code executed - the text boxes are empty. I'm sure that codes in the movieclip actionscript is correct because movieclip exactly same spot on the current frame displays the text correctly area.

    Can someone explain to me how sove such problems?

    Thank you.

    do you see a problem in http://www.kglad.com/Files/forums/test4.html?

  • How to use the function @RETURN for poster messages Essbase in 11.1.2.1

    Hello

    I found the business support Essbase Hyperion Planning 11.1.2.1 @RETURN rule novelty.

    If I create a simple BR for planning app like below:
    "@RETURN ("test return message,"WARNING);
    Validation returns error and BR can not be deployed.

    One is how to use the function @RETURN br?

    Thank you!

    He probably should be in a calco for example block

    "Profit".
    (
    ....
    )

    It is more likely to be used with an IF ELSE command, you do not want to define the condition for the calculation, roughly what the feature is designed for output.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Hi all OneHow can you buy an IBook UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing.

    Hello world

    How can buy you an IBook of UK not available in Indian store a store; When you change the status of your country, your billing information and credit cards won't work; is there a solution for this using the same method of billing

    There is no solution, if it is not available in your area, you can't buy it.

  • How to use the Print Screen function?

    I've seen various descriptions of how to use the print screen function.

    It would be nice to actually tell one that works.  None have worked for me.

    [Fn] and Prt SCr does not work.

    CTRL and Prt SCr does not work.

    CTRL, Alt, and Prt SCr does not work.

    [Fn], Ctrl and Prt SCr does not work.

    If anyone knows the correct method to activate the screen capture function which would be a good thing.

    From the looks of things, HP has a big problem with this function.

    Here's a microsoft articleon the use of the screenshot function.

    This should answer your questions.

    Thanks for taking a peek.

  • How to use the recovery CD?

    Hello

    Ive lost the instructions to tell me how to use the recovery CD. I forgot, I need to press to access the disks when I reboot!

    Can anyone help please?
    St. Clare

    Hi clear, before using the recovery CD make you that all important data has been saved to the floppy or USB key because the procedure will erase the entire hard drive. The method for booting from a cΘdΘrom may vary according to the model number of your laptop, but it's something like hold the 'B' button for the Toshiba Startup logo. If this fails you can try to change the boot sequence or use the Toshiba from Windows or the BIOS configuration tool (ESC then F1 when prompted from a cold start) make CD-ROM the first device startup in the list.

    Richard S.

  • HOW TO USE THE FACES IN THE PHOTOS

    INSTRUCTIONS OR TUTORIAL ON HOW TO USE THE FACES IN THE MOST RECENT PROGRAM PHOTO ON MY MAC?

    I asked that your post be moved here:

    Photos for Mac

    See also:

    http://www.IMore.com/how-use-faces-photos-OS-x

Maybe you are looking for

  • Re [lacemant 'Master' IDE Slimline Optical drive Satellite Pro A120

    Hello I am looking for a replacement CD for a Toshiba Satellite Pro A120 (laptop) drive.Been reading about this for awhile as it does not work I tried all IDE slimline drive replacements. From my research, it requires a slimline IDE optical drive is

  • HP Photosmart C4180 printer and HP Solution Center

    Bought new HP 3500 Pro tour MT series to replace the old tower HP Windows XP.  To use the HP Photosmart C4180 printer that I used with the old tower and have available HP solutions Center.   Data has been transferred from the old disk to the new HP T

  • HP ProBook 450 G2: Replacement of the RAM HP Probook G2 450 x 64

    Is it possible to replace the RAM in my laptop HP ProBook 450 G2 4 GB to 16 GB? 4.00 GB (3.97 GB system) + 32 MB video Intel Core i3-4030U CPU @ 1.90 GHz

  • Error on ITunes, how to reinstall corefoundation.dll

    Original title: how to reinstall corefoundation.dll and is it safe? I get this error for my ITUNES APP... Help, please How to reinstall corefoundation.dll and is it safe? I get this error for my ITUNES APP... Help, please?

  • BlackBerry smartphones I am very stupid!

    So I got a blackberry. It's great, because he has a calendar and a notes function, and basically 37 places to keep a diary and a "to-do list". However, as I said above... I'm REALLY stupid. So I create a SMS text and basically Add Remove stuff from t