Retrieving image using HTTP GET method?

I want to send a image to a client browser. My servlet's HTML response to the client browser contains the <img src="..."> tag. The client browser uses the HTTP GET method to call my servlet's DoGet method, and I must transfer the desired image to the client browser in this DoGet method at servlet. Now, the problem is that, what should be the source URL in the image(img) tag that is present in my servlet response to client?
For eg: the img tag should be like this
<img src="http://<hostname>:<portname>/<servletname>/...?[var1=value1]">
Now at the ellipsis that you see in the above source URI, I want to write the type of image file (something.jpg) ,so the browser knows what kind of image file it is.
To sum it up...how to get the image using DoGet method and <img src="...">
Regards,
Amit

To give you a better idea on what's happening, read the RFC:
(HTTP/1.0) http://ftp.ics.uci.edu/pub/ietf/http/rfc1945.html
(HTTP/1.1 - compressed data)
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
If you for example execute the command by telnetting to port 80 on a server:
GET http://somewhere.com/some.jpg HTTP/1.0<cr>
<cr>You will get this header:
Trying 217.22.64.73...
Connected to xxx.xxx.xxx
Escape character is '^]'.
HTTP/1.1 200 OK
Date: Fri, 01 Aug 2003 12:36:30 GMT
Server: Apache/1.3.27 (Unix) FrontPage/5.0.2.2510
Last-Modified: Tue, 15 Jul 2003 03:11:52 GMT
ETag: "268de8-2fc4-3f1370f8"
Accept-Ranges: bytes
Content-Length: 12228
Connection: close
Content-Type: image/jpegWatch the last part, that's what the setContentType does, normally the content-type defaults to text/html in a webserver.
A webserver usually maintains a list of file extensions by which it will determine the correct MIME type to emit, when a resource is retrieved.
The browser reads the header, and decides what to do with it, in combination with (X)HTML markup.
Greets.

Similar Messages

  • Is it possible to use HTTP GET navigation links?

    Hi,
    I'm learing JSF technology, I found it very powerful.
    But I'm not able to understand how generate navigation links that use HTTP GET method. Do anyone Help me?
    It seems impossilbe, but I don't want believe that it is true.
    Building a web site using only HTTP POST methods is out of the W3C for Web Site suggestions.
    A "good" serach engine for example dosen't take in cosideration HTTP POST Links.
    I hope that someone tell me how generate using JSF HTTP GET links for navigation.
    Bye

    Balusc, thanks for you help.
    The blog is very good!
    I make help classe (FacesUtils) who you show in blog, but not find the property on request context map, but I use the param variable on faces-config.xml and Request Managed Bean and all work fine.
    thanks.
    I'm wrong where I think the Request Managed Bean is create for each request on all pages, the Request Managed Bean is create only on requeste page reference its.
    Parte of my faces-config where I put the Request Managed Bean:
    <managed-bean>
              <managed-bean-name>uuidParamManager</managed-bean-name>
              <managed-bean-class>
                   br.srv.full.virtual.managers.request.UUIDParamManager
              </managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
                   <managed-property>
                   <property-name>loginManager</property-name>
                   <property-class>
                        br.srv.full.virtual.managers.LoginManager
                   </property-class>
                   <value>#{loginManager}</value>
              </managed-property>
              <managed-property>
                   <property-name>uuid</property-name>
                   <property-class>java.lang.String</property-class>
                   <value>#{param.UUID}</value>
              </managed-property>
         </managed-bean>Where UUIDParamManager is create on request its receive first the LoginManager Instance, and later its receive the UUID param.
    I put the prototype of project on virtual.full.srv.br.
    thanks.

  • Retrieve data from a non-peoplesoft application using HTTP Get

    I need to retrieve data from a non-peoplesoft application. They want us to submit a HTTP GET request to their URL with a series of parameters. I am thinking about using HTTP Targert connector to accomplish this. Does anyone have sample peoplecode?
    Currently we are on 8.51.10 Tools...
    If there is any better way .. please let me know ..

    I have used HTTP Get to get XML file from a government sanction list by hitting URL http://www.treasury.gov/ofac/downloads/sdn.xml
    There is a delivered PS program that does that for vendor sanctions. I had to get the online setup correctly by creating a new custom Node with HTTP Target Connector. The program name is BSP_IMPORT. The below code is responsible for the calling the node and retrieving the data. Play around with the code below see if you can get it to meet your needs.
    BSP_IMPORT_AET.BANKNODE.Value is just the custom external code that I created.
    PMT_FLAT_FILE_INBOUND message is just a none rowset based message to use the web service call.
    Local TR:FileUtilities:FTP &oFTPUtil = create TR:FileUtilities:FTP();
    +/* HTTP */+
    +/*******************************************************************************/+
    Local Message &msgHTTP;
    Local Message &msgResult;
    +&msgHTTP = CreateMessage(Message.PMT_FLAT_FILE_INBOUND);+
    +&oFTPUtil.PopulateFTPGetIBInfo(&msgHTTP, BSP_IMPORT_AET.BANKNODE.Value);+
    +&msgResult = %IntBroker.ConnectorRequest(&msgHTTP);+
    +/* check to see if the file is wrapped */+
    +&strAllLines = &msgResult.GenXMLString();+
    +&strAllLines = Substitute(&strAllLines, Char(26), " "); /* Added this line to remove invalid characters */+
    +/*******************************************************************************/+
    Edited by: Maher on Mar 20, 2012 3:28 PM

  • Example of sending the po request to my partner using https post method

    I need to send the po request to my partner using https post method.
    Is there any example for my scenario in oracle b2b?
    Usecase:
    mycompany
    othercompany
    mycompany -> Posts xml document with no namespace -> othercompany
    Protocol: https

    I need to send the po request to my partner using https post method.It is possible. FYI, by default HTTPS uses post method.
    Is there any example for my scenario in oracle b2b?Not exact sample is available but yes, similar samples are available here -
    http://www.oracle.com/technology/sample_code/products/b2b/index.html
    I would suggest you to go through below tutorial to have better understanding -
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU003_ebxml.pdf
    Namespace is not an issue. It's upto you whether you like to keep it or not. From XML technology point of view, it is always recommended to have a namespace to bind each and every node with it, but I have seem cases where people don't use them.
    Regards,
    Anuj

  • Authentication syntax for HTTP GET method using TCP functions in Labview on linux

    Hi,
    Currently, I am trying to communicate to web server. I have Labview installed on a Linux machine. The HTTP function blocks and other labview functions do not work. Hence, I am building a HTTP code string using TCP functions (port 80) to talk to the web server. I am successfully able to fetch a response from web sites (example www.ni.com) from my vi. However, when I try to communicate to my web server, it does not work. It requires an authentication. I am able to open http://ipaddress in my browser from my machine using username and password. Can someone help with Authentication string requirement for GET method?
    so far the string is:
    GET /index/ HTTP/1.1
    Host: http://xx.xx.xx.xx

    An easy option would be to try http://userassword@server syntax for the URL.
    Else I posted a Twitter fetcher once (won't work anymore since Twitter moved to Oauth authentication) at LAVA. Based on code from @cloew.
    The code is part of this LLB.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to get image using Http and how to save in Smulator

    Hi guys,
    Am working in black berry bold. i dont know how to get image using htp connection and one more thing i need to save this image in side simulator directory............. what are the specific API i should...
    Guide me.........

    If you want the input image size you need to pass it in as parameters.
    A discussion thread on this topic is:
    http://forums.adobe.com/thread/29948
    -- Daniel R. <[email protected]> http://danielr.neophi.com/

  • HTTP GET method error

    I've created a simple web page that contains a text box in which the user enters an URL. And also have a servlet to take this address and do something "useful" with it. The Servlet has a doPost method to get this address, and the web page also has the corresponding method
    (<FORM method="POST" ACTION="../fyp/AddressServlet" >).
    I'm using a j2ee server, which runs fine, as does the deploytool.
    However, when I attempt to open the web page in my browser, I get the following error,
    "HTTP Status 405-HTTP method GET is not supported by this URL"
    I don't know why I'm getting a GET method error, when it's a POST method I'm using.
    Any help would be appreciated,
    thanks,
    ahhfor

    Hi !
    You're using the POST method to call the servlet when you submit the HTML page. However, when you try to load your HTML page into the browser, this is done with GET !
    Check your server.xml file in the /conf directory and see if your application context is correctly defined. And then check the web.xml file in your application's WEB-INF directory. Finally, check your path to the servlet in your HTML file.

  • JAX-WS -- Force a wsimport generated ws client to use http POST method

    I've used wsimport to generate a JAX-WS client for a wsdl and xsd bindings that were provided to me.
    The basic implementation goes something like this.
    URL serviceUrl = ...url to the live web service's wsdl (this will change often and needs to be data driven)
    QName qname = new QName("thenamespace", "MyService")
    MyService myService = new MyService(serviceUrl, qname);
    At this point a http GET request is sent to the server which promptly spits back a "405: method not allowed" because it is only configured to accept the http POST method.
    Unfortunately i cannot change this behavior and need a way to get the web service client to generate http POST requests.
    Setting the following seemed to have no effect.
    System.setProperty("javax.xml.ws.http.request.method", "POST");
    Thanks!

    so, keep the wsdl as a local resource and use a url for the local resource. then the service will not request the remote wsdl.

  • ACE keep probing real servers using "https get 302"

    Hi all,
    I got one problem with cisco ACE in my company. Currently, two ACE appliances are working as HA redundancy. Previously I enabled some https and http probing using get 302 for some servers and services. But then I was told to remove all https or http probing, and instead use tcp port 443 and 80. After that, one of the serverfarm (server groups) is receiving https get 302 and I already checked in the monitoring and see whether there's any https probing regarding the respected real servers. But I could not find any. Even I disable all probing to that serverfarm, all the server members still receiving https get 302. Is this behavior a bug?
    The ACE version is A3(2.1). And the HA status is on standby cold. Can standby cold cause this kind of trouble?

    Hi Daniel,
    I just corrected the cert problem and made the state peer into standby hot. But still it still keep probing the get 302. And then I tried to restart both ACEs. The first step is to restart the second ACE (standby) and then switched over all context to the second one. The problem is that when I made the second one to be active, some services were not working, especially the ones with ssl terminated in ACE. I'm pretty sure that both ACEs were in sync.
    Any idea what is the problem?

  • Insert images using HTTP url

    Hi,
    I would like to know whether or not it is possible to place an image in a rectangle block using an http url to call the image? I have an xml file I want to layout automatically, it has
    elements with href attributes which contain the url's. The problem is when I use images on my local hard drive with href="file:///url" it works fine, but when I use images on a web server with href="http://www.domain.com/images-directory/image.jpg" it doesn't work.
    Can anybody help me with this?

    Sure!
    You can get one of these very recommendable books:
    http://foundationphp.com/egdwcs3/
    http://foundationphp.com/phpsolutions/
    Though if you don't want to pay try this, although not very
    easy to read:
    http://www.php.net/manual/en/
    Good luck!

  • Error 66 and error 18500 using HTTP GET control: SOLVED

    Hello, I'm new as a member and as a LabView user but I spent many hours trying to get the URL_Get_HTTP vi to play nicely with my code, and as a courtesy I thought I would post the problems I was having and the resolution(s).
    First of all, I was receiving an Error 66 every time I would attempt to make a connection.  This implies that the server terminated the connection, but I knew that this was not the case as I could connect just fine in other manners (browsers, PHP, etc)...
    1) I changed the "bytes to read" input of the "TCP Read" control residing in the middle of the "TCP Buffered Read.vi" from a constant of 1024 to 1.  I have not confirmed that this step is required and you may want to apply step #2 on its own. 
    2) I stripped the Error 66 from the "URL Get HTTP Document.vi" inbetween the "TCP Buffered Read" control and the "TCP Read Stream" control.  You can do this by disconnecting the wire, adding a "Clear Error" control on that wire, or perhaps least offensively using my attached control which selectively removes only Error 66.  You should review my control before using it, as I am a new LabView user!  If you think this is "bad form" to strip and ignore an error I would completely agree, but I'm going to classify this as a bug in the control itself, and would also point out that the 4th post of the following thread concluded the same thing.
    http://forums.ni.com/t5/LabVIEW/Can-t-read-page-containing-XML-using-GET-HTTP-Document/m-p/1191803#M... 
    3) To this point the Error 66 is no longer showing up, but now Error 18500 is, which is labeled as "undocumented" which was not very helpful.  Most people will probably not suffer from this problem, but ultimately the cause was that my URL string ended in a carriage return.  The HTTP control does not appreciate this in any way, and a simple Trim on the string before sending it resolved this issue.
    Anyway, good luck!
    Attachments:
    filter_error.vi ‏24 KB

    Try to send some valid data in COMP_CODE.
    It seems that SAP is returning some reply which is not fitting your response Schema.
    SAP Call is made and problem is in generating response document.
    Use the design console to test the view again. and try to see the XML resquest document and response document. Compare your request xml with that in design console.

  • Can i store and retrieve image using sql command?

    hi
    the following is what i enter to store image in table using sql*plus
    however i encounter some errors as shown below.
    i wondered if i actually can use sql to store image and retreive image
    or i need other developer beside sql to do.
    create table img_storage
    (id     number primary key,
    image     ORDSYS.ORDImage);
    CREATE or REPLACE procedure ADD_image (tmp_id number, file_name varchar2)
    as
         obj ORDSYS.ORDImage;
         ctx raw(4000) := null;
    begin
         INSERT INTO img_classifier (id, image) VALUES (tmp_id,
         ORDSYS.ORDImage (ORDSYS.ORDSOURCE(EMPTY_BLOB(),
         NULL,NULL,NULL,SYSDATE,NULL),
         NULL,NULL,NULL,NULL,NULL,NULL,NULL));
         COMMIT;
         SELECT image into obj FROM img_storage
         where id = tmp_id FOR UPDATE;
         obj.importFrom(ctx,'FILE','IMGDIR',file_name);
         obj.setproperties();
         UPDATE img_storage
         SET image = obj where id = tmp_id;
         COMMIT;
    end;
    show errors;
    create or replace directory imgdir as 'c:\image\';
    exec add_image(1,'argvseng.jpg');
    BEGIN add_image(1,'argvseng.jpg'); END;
    ERROR at line 1:
    ORA-00001: unique constraint (SYS.SYS_C002717) violated
    ORA-06512: at "SYS.ADD_IMAGE", line 7
    ORA-06512: at line 1
    how to reslove the error as shown above.
    or sql does not support ordsys.ordimage such command.
    hmm very confused ....
    what is the difference bet using blob for image and ordsys.ordimage?

    This has nothing to do with intereMedia.
    This is a basic SQL issue.
    A primary key cannot have duplicate entries in a table as the error message suggests.
    Before you call your peocedure you can delete the row with 1 as the primary key, or call the insert peocedure using a primary key that is not being used.

  • Recordsert not working using the GET method

    I'm trying to create a recordset that will retrieve a record from MSSQL.
    My recordset is like this:
    <%
    Dim rsAssets__MMColParam2
    rsAssets__MMColParam2 = "1"
    If (Request.QueryString("type") <> "") Then
      rsAssets__MMColParam2 = Request.QueryString("type")
    End If
    %>
    <%
    Dim rsAssets__MMColParam
    rsAssets__MMColParam = "1"
    If (Request.QueryString("number") <> "") Then
      rsAssets__MMColParam = Request.QueryString("number")
    End If
    %>
    <%
    Dim rsAssets
    Dim rsAssets_cmd
    Dim rsAssets_numRows
    Set rsAssets_cmd = Server.CreateObject ("ADODB.Command")
    rsAssets_cmd.ActiveConnection = MM_ezcaldatasource_STRING
    rsAssets_cmd.CommandText = "SELECT * FROM dbo.assets WHERE ? = ?"
    rsAssets_cmd.Prepared = true
    rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param1", 200, 1, 255, rsAssets__MMColParam2) ' adVarChar
    rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param2", 200, 1, 255, rsAssets__MMColParam) ' adVarChar
    Set rsAssets = rsAssets_cmd.Execute
    rsAssets_numRows = 0
    %>
    Thi s gives me a Server 500 error...if I just I only use 1 parameter, it works fine. Basically, MMColParam2 is a column in the database (either Asset or Serial) which comes from a field on my form.

    try this
    Dim rsAssets
    Dim  rsAssets_cmd
    Dim rsAssets_numRows
    Set rsAssets_cmd =  Server.CreateObject ("ADODB.Command")
    rsAssets_cmd.ActiveConnection =  MM_ezcaldatasource_STRING
    rsAssets_cmd.CommandText = "SELECT * FROM  dbo.assets WHERE '"&request.querystring("type")&"' = '"&request.querystring("number")&"'"
    rsAssets_cmd.Prepared = true
    im thinking it has to do with either there being a blank value passed... or.. the "content type" is wrong

  • Invokation of Oracle J2eeWeb Services using HTTP POST

    I have created Oracle J2ee web service from a Java Class in Oracle Jdeveoper 10g. I want to invoke web methods in the web service using HTTP POST method. Currently, these web methods can be invoked using HTTP GET method which is the default option. Please suggest any solution for this.
    bye

    Vivek,
    If you want to make a call to Web Services from .NET, you have to generate a client proxy in your language of choice: C#, VB.NET, J#, ...
    There are two ways of doing so. a) from the command line using a tool named WSDL.EXE. b) from Visual Studio 2003 using the 'Add Web Reference' command.
    In either case, you will have to point to the WSDL of your service to generate the client proxy. The URL for the WSDL is the same as the URL for the service, with the ?WSDL parameter.
    Hope this helps,
    Eric

  • Call Bpel process through HTTP get or post method

    I need to call BPEL process from Mobile.
    In mobile we are using HTTP get or post methods. so can anybody tell me how to invoke BPEL(how to pass input to BPEL) by using HTTP get or post method.
    Vivek garg
    Edited by: 809104 on Dec 24, 2010 2:36 AM

    I got the soluntion
    we just need to change the binding in WSDL file from Soap to HTTP.
    First of all add three namespaces in wsdl file
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    Then change the Request msg from element type to string type like below
    <message name="UserLoggOffRequestMessage">
    <part name="UserId" type="xsd:string"/> (add this one))
    <!--<part name="payload" element="client:UserLoggOffProcessRequest"/>-->(remove this one)
    </message>
    Then change the binding
    <binding name="UserLoggOffBinding" type="client:UserLoggOff">
    <http:binding verb="GET"/>
    <operation name="process">
    <http:operation location="/process"/>
    <http:urlEncoded/>
    <output>
    <mime:mimeString part="Body"/>
    </output>
    </operation>
    </binding>
    Then do some changes in service tag . we need to do the changes in location only.
    we need to remove orabpel from location and add httpbinding
    http://infva04718.vshodc.lntinfotech.com:8888/*orabpel*/MobileApplication/UserLoggOff/1.0
    http://infva04718.vshodc.lntinfotech.com:8888/*httpbinding*/MobileApplication/UserLoggOff/1.0
    do like following
    <service name="UserLoggOff">
    <port name="UserLoggOffPort" binding="client:UserLoggOffBinding">
    <http:address location="http://infva04718.vshodc.lntinfotech.com:8888/httpbinding/MobileApplication/UserLoggOff/1.0"/>
    </port>
    </service>
    Then deploy the process then u can invoke this
    http://infva04718.vshodc.lntinfotech.com:8888/httpbinding/MobileApplication/UserLoggOff/process?UserId=a1
    here process is name of process u want to invoke

Maybe you are looking for