Get the file size of a file on the server.

okay.. for my download manager i need to get the file size. I tried using the available method of inputstream, and the getContentLength() of URLConnection, which worked but only for webpages. so does anyone know how to do this? Sun does it in SDM, but i dont think the source is included. ill download it again and check.
thanks.

content-length is not guaranteed to be anythingi dont think so. correct me if i am wrong..
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#s
c4.4 states -
" When a Content-Length is given in a message where a
message-body is allowed, its field value MUST exactly
match the number of OCTETs in the message-body.
HTTP/1.1 user agents MUST notify the user when an
invalid length is received and detected."
this sort of guarantees that if a file is being
downloaded the content-length gives the size of the
file. i am able to confirm this by sniffing the
traffic of my download manager.This is only guaranteed if the content length field is present. :-)
However, looking two paragraphs up:
'All HTTP/1.1 applications that receive entities MUST accept the "chunked" transfer-coding (section 3.6), thus allowing this mechanism to be used for messages when the message length cannot be determined in advance.'
There is mechanism built in for cases where the size cannot be determined.
Regards,
Bhaveet

Similar Messages

  • Is there any way to get the server app other that through the app store. We do not have our system conneted to a network. I typical downloaded items on a non-apple system.

    is there any way to get the server app other than through the app store. The system that I need it on are not connected to the internet.
    We run a closed-loop network of apple systems and I tipically downloaded updates on a non-apple system that was on the internet.
    Any ideas?

    I did buy the server app, went to the app store to download it. This system I'm using for downloads is Snow Leopard 10.6.8, it shows that I can download it but only as an Install which says I need 10.8. I can't seem to find a way for it to just download as a package or .dmg file so that I can copy it to DVD/CD or flash drive.

  • How to get the Server Name in Crystal

    Hi All,
    We created a Crystal Report that pulls images from a File Location at the run time and this File Location is different for each environment (D-Q-P). We are trying to automate the file location by the server name. Is there any function in Crystal Reports that we can get the server name so we know if it is D-Q or P system?
    Thank you,

    Hi,
    There is no function in CR that can fetch the Server Name. That is something you need to provide to the formula.
    If you're loading images from a location on the Server, you can always use a Relative Path. For eg: if the images would be stored in a folder called Images, then you can write a formula on the 'Graphic Location' for the OLE object as:
    "/Images/Crystal.jpg"
    This will load the image from the folder when it is run on D, Q or P.
    Hope this helps!
    -Abhilash

  • Error getting the server-side naming service functionality

    Hi all,
    we are currently setting up the CTS+ activity based transport scenario. Everything seems to be working fine, however, we have to import each transport twice...
    Before I go into detail in the error we get I will first describe our landscape. All the configuration we did was done in debate with SAP.
    We use the SAP Solution manager (ehp1 SP 4) as the CTS+ server as recommended by SAP and have an NWDI system of which we only use the components DTR and CBS (since CMS is not used anymore in the activity based transport). We have defined three logical ports/RFCs. CTSCONFIG points to the NWDI system. CTSDEPLOY is running on the java stack of the solution manager and is only used for portal content (=epa) transports. CTSDEPLOY_DI is pointing to the NWDI system and is used for all NWDI (=dip) changes. The NWDI is running ehp1 SP3.
    In STMS I defined all the non-abap systems (and configured them to use CTSDEPLOY_DI) and created the following transport route:
    upload system (IMP) -> DEV -> ACC -> QAS -> PRD
    I first attached the used dependencies in a transport request (SAP_BUILDT, EP_BUILDT, etc) these imported just fine. Then I did the SCA files which contain our custom code. I extracted these from the assemble step on our current NWDI system which will be removed as soon as we switch to the new CTS+ environment.
    When we import the transport into the runtime systems then we see the DTR and CBS be filled sucesfully for this specific system. However, the transport request itself always fails with errorcode 12 and the error is:
    Error during export service registration: Error getting the server-side naming service functionality during getInitialContext opera
    tion. com.sap.engine.services.jndi.persistent.exceptions.NamingException: Error getting the server-side naming service functionality during getInitialContext operation.
    Error in execution of Web services CTSDEPLOY_DI , exception is cx_cts_file_import_failed
    File import canceled
    When we then reimport the same transport it will go the second time fine. This is no problem during the setup but will not be workable when we go live ofcourse. Is there anyone who had this issue before as well and have a solution for it?
    Kind Regards,
    Nico van der Linden...

    Hello Nico,
    I would need the java trace files to get more info on this issue, but you can start troubleshooting this error with these notes:
    #1172252: CTS+, 'attach file': Troubleshooting Guide;
    #1003674: Enhancement for non-ABAP systems in CTS;
    #1155884: CTS+, configuration 'close coupling': Troubleshooting guide;
    Pay special attention to parameter  NON_ABAP_WBO_CLIENT, whether it's correctly set on your CTS+ system(s).
    Note #1003674 is a must for any CTS+ systems to work properly, as well as having an updated version of the transport programs (tp and R3trans).
    Lastly, note #1155884 goes through some JCoException exceptions that commonly take place during CTS+ transports. But again, you need to check the underlying trace files to find the root cause of your issue.
    I hope this information helps.
    Best regards,
    Tomas Black

  • Using IClusterInformation Interface to get the server node.

    Hi ,
       I have created a portal application which contains an Abstract Portal Component to display the server node the user logs on.
    I have written the following code :
    IClusterInformation clusterContext =
    (IClusterInformation) PortalRuntime.getRuntimeResources().getService( IClusterInformation.KEY);
    I too added the Sharing Reference , "com.sap.portal.runtime.system.clusterinformation" to Application Config property in Portalapp.xml file.
    But still am getting an error "IClusterInformation cannot be resolved".
    Do I need to add some external JAR File to the Java Build Path of my portal Application. If so , Which JAR file I need to add?
    Regards,
    Eben Joyson.

    I use this to get the server - node:
    String node = "";
    Enumeration props = System.getProperties().keys();
    while (props.hasMoreElements()) {
      String thisProp = props.nextElement().toString();
      if (thisProp.startsWith("dsr.") && thisProp.endsWith(".buffersize")) {
        node = thisProp.substring(5 + thisProp.indexOf("_" + SID + "_"), thisProp.indexOf(".buffersize"));
          if (node != null) {
            String cluster = node.substring(0, 6) + "00";
            node = node.substring(0, 8);
    Hope it helps
    Johannes

  • When ever i try logging into FaceTime or iMessage on my Macpro i get The server encountered an error processing registration. Please try again later. what could be the problem..N.B I'm located in trinidad in the caribbean message

    When ever i try logging into FaceTime or iMessage on my Macpro i get The server encountered an error processing registration. Please try again later. what could be the problem..N.B I'm located in trinidad in the caribbean message

    Hi,
    As the Other threads suggests I would check the Date and Time settings on the Mac and compare that with the settings in the router.
    Messages (and iChat before that) send Time stamped info to Login and to send IMs.
    Obviously most people set their Macs to their Time Zone and nearest city/town.
    What people sometimes forget is that their Router/Modem device(s) have to be set correctly as well.
    EDIT
    Also Add a Public DNS server to your System Preferences> Network > Advanced Button > DNS  tab
    A Google one such as 8.8.4.4 or 8.8.8.8 seem to work well for most people
    10:15 PM      Saturday; March 17, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously
    Message was edited by: Ralph Johns (UK)

  • Not getting the server pool in the list of server pool

    We are facing following issue. Can you please help on this. Or how can we get help on this. I would be thankful for this.
    We have created a server pool which consists of two vm servers. Two vm servers we created manually.
    We are using following steps to create third virtual server.
    1. Click "next" on "create virtual machine" screen.
    2. Click "next" on "installation media" screen
    3. It asks to select a server pool from the list but we are not getting the server pool in the list of server pool which we created earlier.
    We did this exercise before and we got the server pool name in the list which allowed us to create virtual machine. Now when we reinstalled the vm servers machine and also vm manager, we are not able to do this once again.

    Hi,
    please check the status in Server Pools ( it need to be in Active). then check in the Servers the status need to be in active in VM Manager.

  • SDK : how to get the server adress and port ?

    Almost everything is in the title, I'm look for code to get the server URL and port where the ME is running ;o)
    There should be some standard API I guess.
    Thanks
    Regards

    Hi,
    In the code that I write I usually have access to the HTTP Request Object.
    String serverName = request.getServerName();
    String serverPort = request.getServerPort();
    Then I just do a compare on the returned value to see if I am on our Test or Production server.
    if(request.getServerName().indexOf("prodservername") >= 0)
      // PRODUCTION CODE HERE
    else
      // TEST CODE HERE
    Hope this helps,
    Mike

  • How come, when I add myYahoo! email account to MAIL, after verifying, I always get the "server unavailable. please try again later"

    How come, when I add myYahoo! email account to MAIL, after verifying, I always get the "server unavailable. please try again later"

    THANKS! this worked !!!
    I hit "DELETE THIS ACCOUNT" on my iphone (this is the Yahoo I tried to set up by "picking" it from the list that the iphone5 gives you) and then confirmed to delete everything.
    THEN: while in Mail (still in the Settings Section) I tapped on "ADD ACCOUNT..." but this time tapped on "OTHER" and manually put in my yahoo ID and password and I did not even have to go to the   SMTP or IMAP incomming/outgoing stuff at all. But I checked it out under the "ADVANCE" tab and it was already correct for yahoo. (ALMOST SEEMED TOO EASY)
    Went to my home screen and tapped on MAIL and my yahoo email loaded up just right!
    Now, I have no idea if I have any other issues like if I delete mail on the iphone; does it delete properly on my ipad...etc..etc. but one problem at a time is getting fixed. THANKS!

  • How to get the server name/hostname on which JVM is running?

    How to get the server name/hostname on which JVM is running from the Servlet or normal class?

    InetAddress.getLocalHost()

  • XMII 12.x  Can you get the Server's Time Zone from a webservice call?

    Is there a MII / NW webservice call to get the server's time zone?

    After thinking about it a little my best approach was just a simple JSP page, because I really was more intersted in the servers GMT offset.
    <%@page import="java.util.*" %>          
    <%
    Calendar myCalendar = new GregorianCalendar();  
    int gmtOffset = (myCalendar.get(Calendar.ZONE_OFFSET) + myCalendar.get(Calendar.DST_OFFSET))/(1000 * 3600); 
    %>
    <%=gmtOffset %>

  • Exception while getting the server instance. Stateless bean problem

    Hi,
    New to OC4J, I'm moving an ear that was running ok under jboss.
    1- The wep app deploys. This is a piece of code inside the init() method of a struts plugin:
         System.out.println("0");
         AddressFacadeHome addressFacadeHome = HomeFactory.getAddressFacadeHome();
         System.out.println("1.0");
         AddressFacade addressFacade = addressFacadeHome.create();
         System.out.println("1.5");
    2- The code is run when the web app is initialized. This is the error message I get. system.out show that the error occurs on addressFacadeHome.create().
    AddressFacade is a remote/local stateless bean. HomeFactory returns the jndi lookup/narrow of the remote object.
    0
    1.0
    caught exception while getting the server instance null
    java.lang.NullPointerException
    com.evermind.security.User com.evermind.server.ThreadState.getCurrentUser()
    ThreadState.java:637
    com.evermind.security.User com.evermind.server.ThreadState.getUser()
    ThreadState.java:371
    fda.common.address.ejb.interfaces.AddressFacade AddressFacadeHome_StatelessSessionHomeWrapper7.create(
    AddressFacadeHome_StatelessSessionHomeWrapper7.java:66
    void fda.web.oaa.struts.plugin.ApplicationInit.init(org.apache.struts.action.ActionServlet, org.apache
    .struts.config.ModuleConfig)
    void org.apache.struts.action.ActionServlet.initModulePlugIns(org.apache.struts.config.ModuleConfig)
    ActionServlet.java:1105
    void org.apache.struts.action.ActionServlet.init()
    ActionServlet.java:468
    void javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
    GenericServlet.java:258
    com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.
    evermind.util.ByteString)
    HttpApplication.java:1956
    com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.
    evermind.util.ByteString)
    HttpApplication.java:4355
    void com.evermind.server.http.HttpApplication.initPreloadServlets()
    HttpApplication.java:4455
    void com.evermind.server.http.HttpApplication.initDynamic(com.evermind.server.http.HttpApplicationConf
    ig)
    HttpApplication.java:662
    void com.evermind.server.http.HttpApplication.<init>(com.evermind.server.Application, com.evermind.ser
    ver.http.HttpSite, com.evermind.server.http.HttpApplicationConfig, java.lang.String, java.lang.String, boolean
    My guess is that it's a jaas issue (because i see security and getCurrentUser), but at init time, no user is authenticated.
    Any clue would be very much appreciated. Let me know if I can provide anything else, such as deployment descriptors.
    Thanks,
    Christophe.

    After spending some time on this, I looked at the source code for com.evermind.server.ThreadState
    This is the code that throws the exception:
    if(applicationThread != null && applicationThread.httpHandler != null && applicationThread.servletInfo != null)
    try
    server = applicationThread.httpHandler.request.getApplication().getApplication().getServer();
    catch(Throwable t)
    System.out.println("caught exception while getting the server instance " + t.getMessage());
    t.printStackTrace(System.out);
    It looks like this method expects a httpRequest, and would find null because I'm in the servlet.init()
    (at least, that's my interpretation)
    I tested my code (the remoteFacade.create()) inside of a jsp, and it worked...
    So, the next logical question is:
    Can I make EJB calls from within the init method of a servlet? (or more specifically from a struts plugin, which I believe should be more or less the same thing)
    If so, do I need to take extra steps?
    Again, any experience/help on this will be much appreciated.
    Thanks,
    Christophe.

  • How to get the server URL?

    I am running WLS server on my machine to host a web app in ADF. How can I get the server name in my manged bean. I dont want to hardcode. The URL is something like this
    http://<my-machine-name>:<port>/epmos/faces/myapp/MyPage.jspx
    How can I retrieve the part
    http://<my-machine-name>:<port>

    In JSFUtils there is a getPageURL method. it will give the whole URL of your page. you can play with the URL string to get the part you need.
       * Method to create a redirect URL. The assumption is that the JSF servlet mapping is
       * "faces", which is the default
       * @param view the JSP or JSPX page to redirect to
       * @return a URL to redirect to
      public static String getPageURL(String view)
        FacesContext facesContext = getFacesContext();
        ExternalContext externalContext = facesContext.getExternalContext();
        String url =
          ((HttpServletRequest) externalContext.getRequest()).getRequestURL().toString();
        StringBuffer newUrlBuffer = new StringBuffer();
        newUrlBuffer.append(url.substring(0, url.lastIndexOf("faces/")));
        newUrlBuffer.append("faces");
        String targetPageUrl = view.startsWith("/")? view: "/" + view;
        newUrlBuffer.append(targetPageUrl);
        return newUrlBuffer.toString();
      }

  • I can't quit iCal on my imac. I keep getting  "the server responded with an error"

    I can't quit iCal on my imac. I keep getting  "the server responded with an error" and I  need to change my password but I can't even quit it to do it.

    Can you do a Force Quit?  Right click on it in the dock, then press the option/alt key, and Force Quit should come up in the sub menu.

  • How to get the server port and id from the Initialcontext

    hi
    i know that i can get the server port and id where the jndi service is listening from the InitialContext ( when i create InitialContext ic = new InitialContext(); from within a EJB. ). Does this work on any application server and where (at what position is for example the port) in the Enumeration at the ic are the different things put?

    I would usually just get the PROVIDER_URL property from the InitialContext and use that to determine the location of the naming service:
    String providerURL = (String)ic.getEnvironment().get(Context.PROVIDER_URL);You'll then need to parse that string to obtain the port and the server name. For example:
    // Assume that the provider URL is of form "protocol://server:port"
    int serverStartIndex = providerURL.indexOf("://" + 3);
    int serverEndIndex = providerURL.indexOf(:, serverStartIndex);
    String server = providerURL.substring(serverStartIndex, serverEndIndex);
    String port = providerURL.substring(serverEndIndex + 1);It's a fairly universal approach but there'll doubtlessly be some special cases (for example, the provider URL could be null and the InitialContextFactory class defaults it).
    You might have to adjust the server/port parsing stuff a bit as I just made that up and your URL might not conform to the pattern I described.
    Hope this helps.

  • How to get the Server Certificate Chain File?

    Hi all,
    I config the SSL for weblogic 6.0 on a Win2k Machine .I followed WebLogic
    documentation:
    Generate a private key file, then submit to Verisign, get the certificate
    file.
    Because I have only one WebLogic server. I clear the "Server Certificate
    Chain File" field.
    But I get error message after reboot WebLogic. Following is the error
    message:
    <2001-1-21 04:57:56 pm> <Alert> <WebLogicServer> <Inconsistent security con
    figuration, java.lang.Exception: Required file server-certchain.pem which is
    spe
    cified by ServerCertificateChainFileName, was not found>
    java.lang.Exception: Required file server-certchain.pem which is specified
    by Se
    rverCertificateChainFileName, was not found
    at
    weblogic.t3.srvr.SSLListenThread.resolvePropertyFromLocalFile(SSLList
    enThread.java:152)
    at
    weblogic.t3.srvr.SSLListenThread.resolvePropertyFromAdminServer(SSLLi
    stenThread.java:180)
    at weblogic.t3.srvr.SSLListenThread.<init>(SSLListenThread.java:425)
    at weblogic.t3.srvr.SSLListenThread.<init>(SSLListenThread.java:297)
    at weblogic.t3.srvr.T3Srvr.initializeListenThreads(T3Srvr.java:939)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:403)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:169)
    at weblogic.Server.main(Server.java:35)
    My question is: Should I input the rootCA certificate into the Server
    Certificate Chain File field? If yes, where can I get the rootCA certificate
    file?
    Thanks

    [sorry, deleted irrelevant wrong answer]

Maybe you are looking for

  • PS Cash Management

    Hi, I have the PS Cash Mgmt activated. When I run the payment transfer (TCODE CJFN) I entered  customer /vendor invoice ,transferred successfully and showing in report S_ALR_87100191 i think its getting refelected before the payment (Customer/vendor)

  • Max no. of Update SQL statements before a commit

    In Oracle 10.2 what is maximum number of UPDATE statements that I can execute before issuing commit. If maximum is there either by no. of SQL statements or size in KB, what will happen if I go above this number. Thanks in advance for your response. E

  • Max_luns in OEL 5.8, uek

    Trying to set max_luns parameter on OEL 5.8, uek. Added "options scsi_mod max_luns=4096" into /etc/modprobe.conf, run mkinitrd, reboot. But systool -v -m scsi_mod shows the same numbers. # systool -v -m scsi_mod Module = "scsi_mod" Parameters: defaul

  • J2EE Status info unavailable disp+work.exe

    Hi Experts, I have an critical error in our NW2004s. i installed a dualstack abapjava epcore and ep. the installation was succesfull. But till last week i have the error with the java part. It would not come up. message of dispwork.exe: running, mess

  • How to view pictures from a mac from another computer

    i just got a macbook. my friends and family always ask to send photos of me or my family to them because they always want an update. but they always end up saying that they can't open the photos(they have windows or dell).so how can they open them?