Error: response does not start with HTTP

hi,
i am using a MIDP class to send a string to a java servlet which then returns a .gif image. the string is being successfully to the servlet, but an exception is being thrown when the image is being sent back.
java.io.IOException: response does not start with HTTP it starts with: GIF89aï4
at com.sun.midp.io.j2me.http.Protocol.readResponseMessage(Protocol.java:2166)
at com.sun.midp.io.j2me.http.Protocol.finishRequestGetResponseHeader(Protocol.java:1934)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(Protocol.java:1598)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(Protocol.java:1517)
at com.sun.midp.io.j2me.http.Protocol.openInputStream(Protocol.java:484)
my code is as follows in the midp class :
HttpConnection c = null;
InputStream is = null;
StringBuffer sb = new StringBuffer();
String url="http://localhost:8090/ProjectServer/createMap";
url=url+"?Source="+src+"&Destination="+dest;
try {
c = (HttpConnection)Connector.open(url,Connector.READ_WRITE, true);
c.setRequestMethod(HttpConnection.GET); //default
//is = c.openDataInputStream();
is = new DataInputStream(c.openInputStream()); //openInputStream(); // transition to connected!
Image im=null;
try
ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1)
bStrm.write(ch);
// Place into image array
byte imageData[] = bStrm.toByteArray();
// Create the image from the byte array
im = Image.createImage(imageData, 0, imageData.length);
finally
// Clean up
if (is != null)
is.close();
the code in the servlet is as follows :_
ServletContext sc = getServletContext();
// Get the MIME type of the image
String mimeType = sc.getMimeType("route.gif");
if (mimeType == null) {
sc.log("Could not get MIME type ");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
// Set content type
response.setContentType(mimeType);
// Set content size
response.setContentLength((int)file.length());
// Open the file and output streams
FileInputStream in = new FileInputStream(file);
OutputStream outstream = response.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count = 0;
while ((count = in.read(buf)) >= 0) {
outstream.write(buf, 0, count);
in.close();
outstream.close();
il be immensely grateful if some1 cud tell me whre i am gng wrong.
thnx,
nev

Hi, I�m trying to do the same as above, get MP3 from a Shoutcast server.
I got the same fault ("response does not start with HTTP it starts with: ICY") when I tried to open an HttpConnection as bellow:
============================================
HttpConnection conn = (HttpConnection) Connector.open("http://64.236.34.196/stream/1074");
Then I tried to open a socket connection as bellow:
======================================
SocketConnection conn = (SocketConnection) Connector.open("socket://64.236.34.196:80");
String get = "GET /stream/1074 HTTP/1.1";
DataOutputStream os = conn.openDataOutputStream();
os.writeUTF(get);
InputStream is = conn.openInputStream();
But then I got the following error:
=========================
java.lang.SecurityException: Target port denied to untrusted applications
Could someone help me to find out what is going on?
Thanks a lot!

Similar Messages

  • Attaching a URL which does not start with HTTP / HTTPS in SAP TM

    Dear Experts,
    I am trying to insert a new URL to a Attachments table in FWO / FRB application.
    My URL neither start with HTTP  nor HTTPS (Ex: Z3://searchsmartstart...). while I am trying to insert such URL, I am getting an error message 'URL not valid.Check if the URL contains the protocol (HTTP/HTTPS). Message ID - /SCMTMS/UI_MESSAGES and message number 088.
    After some analysis, I have understood that WebDynpro ABAP framework does not accept such URL.
    Could you please guide, is there any other way of doing it? The URL which I am trying to access is of SMART CLIENT.
    Thanks in advance for your reply.
    Thanks,
    Bharath.K

    Hi Bharath,
    Yes, you can achieve the same via URL redirection. Please follow the below steps.
    1.Create a service in SICF e.g. sap/bc/redirect_z3 in your SAP TM system and follow following steps.
    2. Create a class with interface IF_HTTP_EXTENSION e.g. ZCL_REDIRECT_URL
    3. Maintain  class created in step 2 into the Handler List of the service created in step 1.
    4. In class ZCL_REDIRECT_URL Method IF_HTTP_EXTENSION~HANDLE_REQUEST write below code
                        Data: lv_target type string.
                           lv_target = 'Z3://searchsmartstart.......'
                          server->response->redirect( url = lv_target ).
    5. You can also read the parameter from the source URL with below program code
    CALL METHOD server->request->get_form_data
        EXPORTING
          name = 'PAR1'
        CHANGING
          data = lv_par1.
    6. Now attach the URL of your service created in step 1(Which will be http/https URL) to Attachments table in FWO / FRB application with parameter you want.
    Now once you click this URL , Mehtod IF_HTTP_EXTENSION~HANDLE_REQUEST in Handler list class will execute here you can read the parameter as mentioned above and form a target URL and redirect to you intended target .
    Thanks, Pravin

  • Tomcat 5.0.16 does not start with https.

    I've just done an update to a tomcat that was otherwise working perfectly.
    The original tomcat was running https on 8443 and has done so without a problem for many weeks.
    Since the update (which had nothing to do with the keystore or any config files), the tomat now refuses to even start with https enabled.
    If I turn the https connector off, and run the same webapps under http, everything is fine, and the tomcat runs happily.
    What could have caused it to fail ? The SSL cert is not out of date.
    More over, if I clear the log files then attempt an https connector start, it recreates the catalina.out file, but without anything in it. Does this sound like a permissions issue.. ?
    I'm trying to figure out whats happened to the box, rather than the tomcat I think.

    try hitting the server with the https:// ip address and not the www.nameofserver.
    also try http://nameorip:443, http://nameorip:8443
    Catalina.out will only show you server started/stopped and or any System.out.println's you have.
    make sure you have something like this in your <context> tag.
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="newShop_log." suffix=".txt" timestamp="true" />
    If you do have a logger for your context, check its file for errors.
    The answer will be in your logs, you just have to find 'em.

  • ABAP WebDynpro - ArchiveLink - PDF Error: "File does not start with..."

    Hey community,
    I have a WebDynpro application in which I want to show a Archive document.
    I'm using FM 'ARCHIV_GET_TABLE' and then FM 'SCMS_BINARY_TO_XSTRING'.
    But I only get the error message: (see also attached)
    File does not open with "%PDF-".
    Local\EWH...
    Attachment two shows, how the data is stored in TOA03.
    Document type is FAX .
    I tried several FM and nothing worked.
    Does anyone have an idea?
    Thank you very much in advance.
    Florian

    Hi Florian,
    I don't think you need to use FM SCMS_BINARY_TO_XSTRING.
    Just try to make of your binary output table from ARCHIV_GET_TABLE an xstring by concatenating all lines into one xstring.
    Regards,
    Julien

  • "Layer 1 does not start with a new cell" replicator error

    Hi All,
    I recently sent a dual layer +R DVD off to our replication house and their system is returning a message that says: "Layer 1 of DVD-Video does not start with a new cell".
    I know from reading that the dual-layer breakpoint must be set to the end of a cell, but what does the word "cell" translate into for DVDSP4?
    I had the DVD DL+R set to Automatic and Non-Seamless for output for the break point. Should I just try setting the break point manually at the beginning or ending of a track that would be dubbed as just a little more than half the size of the content? (I know in OTP, the Layer 0 has to be bigger than Layer 1)
    Please Help!
    Cheers,
    Dusty

    Thanks both of you for your replies.
    Eric, I am currently exporting DDPs to send in to the replicator. I also emailed them asking if they accept this format for delivery. (Which I would hope they would, as it is, an answer to DLT of sorts) Thanks for bringing this up, DDP is new to me, as this is our first DL project for replication.
    Drew, to answer your reply, yes I have two viable markers (chapter markers) that show up in black, not grayed out, in the tab you mentioned under formatting. I chose manual break point selection for this last disc I burned and chose chapter 4 of that track. (chapter 4 and chapter 5 of track 6 are only options) I have to assume that the "automatic" setting was selecting chapter 5, as it had to see that as the last viable marker available to select, as described in the DVDSP4 manual.
    DVDSP4 says that all markers are considered cells- Or actually that tracks are cells and that the markers within them make up more cells. So my question, outside of DDP option, would be, "what truly constitutes a cell boundary in DVDSP4?" Is it the markers within the tracks or the beginning or ends of the tracks themselves?
    As a side note, I burned the disc that received the error, "Layer 1 doesn't start with a new cell" from an IMG i created from DVDSP4 through Disk Utility. Word is that IMG's somehow don't include breakpoint information.
    So at this point I don't know if it is the IMG or the fact that DVDSP4 wants the break at one of two possible chapter markers in track 6.
    (Some more background- this is a TV show season DVD, with thirteen tracks of video, each with 12-14 chapter markers a piece.)
    Any more thoughts to help clear the air on what constitutes a true new cell boundary?
    Thanks sooo much Eric and Drew, I know this a long read.
    Cheers,
    Dusty

  • Path login does not start with a "/" character

    I get a "java.lang.RuntimeException: Path login does not start with a "/" character" in my WebApplication.
    - Http Status 500
    - The server encountered an internal error () that prevented it from fulfilling this request.
    Instead I excepted the site for a Re-Login (timout after 10 min), What's wrong?
    The server I use is: Sun Java System Application Server Platform Edition 8.0 (build b57-fcs)
    Here is the full StackTrace:
    [#|2004-05-26T14:50:50.609+0200|SCHWERWIEGEND|sun-appserver-pe8.0|javax.enterprise.system.container.web|_ThreadID=17;|Standard
    WrapperValve[OwaFolderTree]: Servlet.service() for servlet OwaFolderTree threw exception
    java.lang.RuntimeException: Path login does not start with a "/" character
    at org.apache.catalina.core.ApplicationContextFacade.doPrivileged(ApplicationContextFacade.java:451)
    at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:255)
    at com.space2go.icafe.S2GHttpServlet.service(S2GHttpServlet.java:3260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
    at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:272)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
    at java.lang.Thread.run(Thread.java:534)

    It looks like you are getting this error when trying to use the RequestDispatcher. There are two different flavors of the RequestDispatcher :ServletRequest.getRequestDispatcher that will take a relative path and ServletContext.getRequestDispatcher that will only take absolute paths (ie start with a '/').
    If yoy are trying the use the second version of RequestDispatcher you'll need to adjust the path to an absolute path.
    http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html

  • PO PDF Error - File does not Begin with '%PDF-'

    Hi,
    I am working on Implementing PO PDF with XML data and RTF Template. I have created a new template in XML Publisher and followed the following set up steps
    Setup / Organizations / Purchasing Options / Control TAB / set 'PO Output Format' = 'PDF'
    setup / purchasing / document types / select "Standard Purchase Order" / Set the Document Type Layout to your new template.
    When I view the document from PO Summary > inquire > View Document, I get an adobe reader error
    'File does not begin with '%PDF-', how ever when I preview it from the template definition, it opens fine.
    I tried running PO Output for communication with my custom template but I don't see the parameter 'Purchase Order Layout'. The last parameter in the list is 'Include Blanket'.
    Am I missing any set up steps? However when I use the standard Purchase Order Layout in Document Types set up, the Inquire > View Document created a PDF output.
    Any help is greatly appreciated.
    Thanks,
    Sharmila

    I encountered same error in BPA Invoice Print. I remove a MLS function from the program definition and this error disappeared. Have not fully investigated but maybe this will help. Thanks.

  • Error:  File does not begin with '

    After changing two javascript "else if" statements to "if" in an Adobe LiveCycle v8 form, I received errors upon saving. Now the file seems to be corrupt because when I attempt to open it I get an error stating "File does not begin with '". Does anyone know what could be causing this AND MORE IMPORTANTLY if there is a way to salvage my form? Please help!

    Hi VetSrini,
    Thanks for the update. I was able to figure out what was wrong.
    Now there is another problem. When i try "View Output", the excel file is shown and the following options are also shown:
    1. As an XML List
    2. As a read-only workbook
    3. Use the XML Source Task Pane
    When I try the first option, I get the following error:
    An Invalid Character was found in text content
    When I try the third option, I get the following error:
    Cannot load the specified XML or schema source.
    when i press the details button, it gives me the following detailed error:
    An Invalid Character was found in text content
    When I try the second option, i get the same error, but with some xml tags
    Can anyone please help me and tell me why i am getting these errors.
    Thanks in Advance,
    Arun

  • My macbook pro 2.33 17 inch takes 9 minutes to start and does not start with lion

    my macbook pro 2.33 17 inch takes 9 minutes to start on Snow Leopard  and does not go beyond the apple log start up with lion.
    When I am using Snow Leopard after it has finished the starting process; everything works well..it is just the 9.10 minutes it takes to
    boot that I don't understand + I want to upgrade to lion, but it get stock in the apple logo and the little while just keeps on spinning eternally.
    I feel I am in purgatory...:-)
    Please help ...any suggestion will be appreciated;
    Thanks.

    See if this is of any assistance:
    http://support.apple.com/kb/TS2570
    Ciao.

  • Laptop does not start with a new hdd

    I apologize for my English, I communicate through an interpreter.
    on my laptop hard drive broke. exchange rate fell to a sad zero.
    decided to replace with a new Seagate st320lm010, but encountered a problem:
    with the new drive laptop refuses to run, although on a different model laptop this drive worked just fine.after starting the bottom of the screen displayed message "press the Esc for startup"
    I need advice on how to fix it.

    possible difficulties of translation ... I can not run the laptop with a new hard drive! generally. inclusion in the notebook is displayed inscription "Press the Esc for startup" and nothing else does not produce any action. he wont want to run or boot menu or bios

  • Nik Silver Efex 2 Pro does not start with final Adobe Lightroom 4

    I am not able to start the Plugin with Adobe Lightroom 4; -
    installed Lightroom 4 - upgraded catalog - deleted Lightroom 3  -now I still can
    see the menue in Lightroom 4 (edit in ...) but no plugin starts; downloaded
    newst patch SilverEfexPro2-la-ver2.004all.dmg which then found LR4 as
    host applciation, but still does not work. pls advice
    Strange as LR3 LR4 Beta was installed the plugin worked
    Karl

    Hi,
    Please see this thread .

  • [solved] Bash shell... does not start with user name, but used to...!

    when I start a console, logged in as user, it always used to start with
    user@hostname ~$
    Suddenly, and I cannot recall having done anything that could lead to the issue, konsole will always start as
    bash3.2$                                                     
    even after many reboots, this is still the case.
    whoami shows my user name. I can su to root, and from there to my username, but never directly from bash.
    Occasionally, starting a program like KDE partition manager fails with the error message the program su could not be found. but it is as I said occasional.
    I am quite a newbie to Linux, so I am clueless. Can someone help me..? I tried googling, but I seem to be the only one in the WWW that goofed up to such an extent..! and searches are quite unrevealing.
    I am installing Linux From scratch using arch linux as base system, but I am just following The Book to the letter and don't think that caused the problem.
    Last edited by jaydoc (2009-01-26 09:12:56)

    @weasel8...
    That is THE trouble. And I take back my words, it was during the linux from scratch install that I botched that file...! I was supposed to make a new bashrc file in the LFS directory, but I went wrong on the commands and I think I ended up removing the Arch Linux file...!
    If it is to be found, it should be in the etc directory, right..? I looked there and could not find it. Did I look in the right place...?
    What can I do...?
    Last edited by jaydoc (2009-01-26 07:33:14)

  • Elitebook works on battery and charges it - but does not start with it (only starting on AC)

    Hey,
    my 8460P only starts up when connected to AC power. Even with a fully charged battery it does not boot, i also have tested this with a replacement battery - but batteries are working on another Probook.
    Strange: If I unplug the AC directly after powering ON, the 8460p continues running on battery.
    What exactly happens:
    I have fully charged battery and no AC connected. I press the power button, the CPU fan makes noise (full throttle), LEDs are glowing: Wireless, Power and HDD. The DVD drive is initializing... and then after 3 seconds device shuts down - BUT the power LED keeps glowing.
    If I then press the Power button once again, nothing happens.
    But when I connect the AC back, the SCROLL LED glows for about 3-4 seconds and then turns off.
    What I did already: The well-known hard reset (disconnect everything, hitting power 30seconds): no success.
    Latest BIOS is installed. Factory defaults loaded... nothing. Played around with different BIOS settings (everything which sounds for "power" or "AC" tried...) nothing.
    This is not OS related - so updating any drivers or software does not make sense. 
    Further remarks:
    Also from the sleep modes (hibernate or S3) it will not wake up from battery... again only when connected to AC!
    Any solution/idea? please support. 
    Thanks a lot!
    regards,
    G

    @gambrinus 
    ‎Thank you for using HP Support Forum. I have brought your issue to the appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publicly post ( serial numbers and case details).
    If you are unfamiliar with the Forum's private messaging please click here to learn more.
    Thank you,
    Omar
    I Work for HP

  • Skype does NOT start with Windows Anymore (start S...

    My Skype NO LONGER starts with Windows anymore!!! I HAVE to manually open Skype!!! I cheked the options and "start Skype with Windows" IS checked!!! I tried unchecking the option and rechecking it, made no difference!!! how do I fix??

     Just because Skype isn't starting up automatically doesn't mean it isn't trying.  Other applications you have loading at startup could be slowing down Skype's ability to start.  You can run msconfig ( Start - Run  (Wink key + R) -  "msconfig".  Under the startup tab you can see if Skype is set to start or not.  You can also uncheck everything else but Skype and see if it comes up them.  If it does, using a process of elimination you should be able to determine the application causing the probelm.  If you do not see anything for Skype you can use the registry files provided to toggle that feature on/off just as the Skype program attempts to.
    Attachments:
    Start_Skype.zip ‏2 KB

  • Satellite A660-11M: Does not start with 8GB of RAM, but works with 6GB

    Satellite A660-11M:
    I upgraded my RAM from 4GB (2x2GB) to 8GB (2x4GB). When I start the computer I can see in the BIOS it reads the 8GB of RAM. However, when it boots up, it does not go past the blank DOS screen (just before starting Windows).
    If I remove one of the 4GB & replace with a 2GB (so I have 6GB in total) it starts ok.
    Does anyone know how can I get it to work with 8GB of RAM?

    Hey,
    To be honest I never heard about SanMax RAM modules...
    In my opinion the problems is related to your RAM modules Not compatible to your notebook or defective.
    Can you test it with high quality modules from Kingston or pretested modules from an authorized service provider?

Maybe you are looking for