Package org.openxri.resolve.exception

Examples of org.openxri.resolve.exception.XRIResolutionException


      conn = IO.getConnectionToURI(uri, "GET", requestProp,
          moSocketFactory, maxHttpRedirects, false);
     
      if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
        conn.disconnect();
        throw new XRIResolutionException(
            "Got bad response code from URI: " + uri.toString()
                + ", code = " + conn.getResponseCode());
      }
     
      // read the bytes
      int bufSize = 4096;
      byte[] buf = new byte[bufSize];
      int bufIndex = 0;
      in = conn.getInputStream();
     
      while (true) {
        int n = in.read();
        if (n == -1) // EOF
          break;

        if (maxBytesPerRequest >= 0 && bufIndex >= maxBytesPerRequest) {
          throw new XRIResolutionException(Status.LIMIT_EXCEEDED, "Maximum response size exceeded");
        }
       
        if (maxTotalBytes >= 0 && state.getNumBytesReceived() + bufIndex >= maxTotalBytes) {
          throw new XRIResolutionException(Status.LIMIT_EXCEEDED, "Maximum total received bytes exceeded");
        }

        if (bufIndex >= bufSize) {
          byte[] newBuf = new byte[bufSize*2];
          System.arraycopy(buf, 0, newBuf, 0, bufSize);
View Full Code Here


          // Populate the cache and store the Descriptors from the response
          xrds = new XRDS(element, true);
      }
      catch (IOException e)
      {
          throw new XRIResolutionException("IOException", e);
      }
      catch (SAXException e)
      {
          throw new XRIResolutionException("SAXException", e);
      }
      catch (URISyntaxException e)
      {
        throw new XRIResolutionException("URISyntaxException", e);
      } catch (ParseException e) {
        throw new XRIResolutionException("ParseException", e);
    }
      finally
      {
          try
          {
View Full Code Here

   */
  public String getStatusCode()
    throws XRIResolutionException
  {
    if (status == null)
      throw new XRIResolutionException("No status code"); // TODO should be 200 here
    return status.getCode();
  }
View Full Code Here

TOP

Related Classes of org.openxri.resolve.exception.XRIResolutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.