Examples of ProxyException


Examples of org.openxri.proxy.ProxyException

    try {
      this.resolver.setAuthority("=", this.config.getEqualsAuthority());
      this.resolver.setAuthority("@", this.config.getAtAuthority());
      this.resolver.setAuthority("!", this.config.getBangAuthority());
    } catch (Exception ex) {
      throw new ProxyException("Cannot initialize Resolver. Check the =, @ and ! root authorities.", ex);
    }

    String[] supports = this.config.getSupportedResMediaTypes();
    if (supports != null) {
      for (int i = 0; i < supports.length; i++) {
View Full Code Here

Examples of org.openxri.proxy.ProxyException

    try {
      this.resolver.setAuthority("=", this.config.getEqualsAuthority());
      this.resolver.setAuthority("@", this.config.getAtAuthority());
      this.resolver.setAuthority("!", this.config.getBangAuthority());
    } catch (Exception ex) {
      throw new ProxyException("Cannot initialize Resolver. Check the =, @ and ! root authorities.", ex);
    }

    String[] supports = this.config.getSupportedResMediaTypes();
    if (supports != null) {
      for (int i = 0; i < supports.length; i++) {
View Full Code Here

Examples of org.openxri.proxy.ProxyException

      implementationClass = (Class<? extends Component>) classLoader.loadClass(implementationName);
    } catch (ClassNotFoundException ex) {

      log.error("Proxy implementation not found: " + implementationName, ex);
      throw new ProxyException("Proxy implementation not found: " + implementationName, ex);
    }

    // instantiate proxy implementation

    try {

      Class<?>[] constructorArgs = new Class<?>[] { ProxyConfig.class };
      Constructor<?> constructor = implementationClass.getConstructor(constructorArgs);
      this.moProxy = (Proxy) constructor.newInstance(new Object[] { this.proxyConfig });
    } catch (NoSuchMethodException ex) {

      log.error("Proxy " + implementationName + " does not have a constructor that takes a ProxyConfig object.", ex);
      throw new ProxyException("Proxy " + implementationName + " does not have a constructor that takes a ProxyConfig object.", ex);
    } catch (InstantiationException ex) {

      log.error("Cannot instantiate proxy " + implementationName + ".", ex);
      throw new ProxyException("Cannot instantiate proxy " + implementationName + ".", ex);
    } catch (IllegalAccessException ex) {

      log.error("Illegal access to constructor of proxy " + implementationName + ".", ex);
      throw new ProxyException("Illegal access to constructor of proxy " + implementationName + ".", ex);
    } catch (InvocationTargetException ex) {

      log.error("Cannot invoke constructor of proxy " + implementationName + ".", ex);
      throw new ProxyException("Cannot invoke constructor of proxy " + implementationName + ".", ex);
    } catch (Exception ex) {

      log.error("Cannot construct proxy " + implementationName + ".", ex);
      throw new ProxyException("Cannot construct proxy " + implementationName + ".", ex);
    }

    // init proxy

    this.moProxy.init();
View Full Code Here

Examples of org.openxri.proxy.ProxyException

      resolver.setAuthority("=", config.getEqualsAuthority());
      resolver.setAuthority("@", config.getAtAuthority());
      resolver.setAuthority("!", config.getBangAuthority());
    } catch (Exception ex) {

      throw new ProxyException("Cannot initialize Resolver. Check the =, @ and ! root authorities.", ex);
    }

    String[] supports = config.getSupportedResMediaTypes();
    if (supports != null) {
View Full Code Here

Examples of org.openxri.proxy.ProxyException

      resolver.setAuthority("=", config.getEqualsAuthority());
      resolver.setAuthority("@", config.getAtAuthority());
      resolver.setAuthority("!", config.getBangAuthority());
    } catch (Exception ex) {

      throw new ProxyException("Cannot initialize Resolver. Check the =, @ and ! root authorities.", ex);
    }

    String[] supports = config.getSupportedResMediaTypes();
    if (supports != null) {
View Full Code Here

Examples of org.openxri.proxy.ProxyException

    try {
      this.resolver.setAuthority("=", this.config.getEqualsAuthority());
      this.resolver.setAuthority("@", this.config.getAtAuthority());
      this.resolver.setAuthority("!", this.config.getBangAuthority());
    } catch (Exception ex) {
      throw new ProxyException("Cannot initialize Resolver. Check the =, @ and ! root authorities.", ex);
    }

    String[] supports = this.config.getSupportedResMediaTypes();
    if (supports != null) {
      for (int i = 0; i < supports.length; i++) {
View Full Code Here

Examples of pl.smsapi.exception.ProxyException

      uri = action.uri();
      file = action.file();

      if (uri == null) {
        throw new ProxyException("Invalid URI");
      }


      switch (requestMethod) {
        case POST:
          if (file != null) {
            query = uri.toASCIIString();
          } else {
            query = uri.getScheme() + "://" + uri.getHost() + uri.getPath();
          }


          if (getProtocol().equals("http")) {
            pHC = new ProxyHttpConnection((HttpURLConnection) new URL(query).openConnection(), file, uri.getQuery()).initPOST();
            response = pHC.outputResult();
            responseHead = pHC.getHeadItem();
          } else {
            pHC = new ProxyHttpConnection((HttpsURLConnection) new URL(query).openConnection(), file, uri.getQuery()).initPOST();
            response = pHC.outputResult();
            responseHead = pHC.getHeadItem();
          }
          break;

        case GET:
          query = uri.toASCIIString();
          if (getProtocol().equals("http")) {
            pHC = new ProxyHttpConnection((HttpURLConnection) new URL(query).openConnection(), null, null).initGET();
            response = pHC.outputResult();
            responseHead = pHC.getHeadItem();
          } else {
            pHC = new ProxyHttpConnection((HttpsURLConnection) new URL(query).openConnection(), null, null).initGET();
            response = pHC.outputResult();
            responseHead = pHC.getHeadItem();
          }
          break;
      }

      return response.toString();

    } catch (Exception ex) {
      Logger.getLogger(ProxyHttp.class.getName()).log(Level.SEVERE, null, ex);
      throw new ProxyException(ex.getMessage());
    } finally {
      if (pHC != null) {
        pHC.disconnect();
      }
View Full Code Here

Examples of pl.smsapi.exception.ProxyException

    }

    protected void checkConn() throws ProxyException {
      if (conn == null) {
        throw new ProxyException("http/https connection not exists");
      }

    }
View Full Code Here

Examples of pl.smsapi.exception.ProxyException

      List<String> it = (List<String>) conn.getHeaderFields().values().toArray()[0];
      String head = it.get(0);

      if (head == null) {
        throw new ProxyException("Problem with net - no exists head");
      }


      return head;
    }
View Full Code Here

Examples of pl.smsapi.exception.ProxyException

        List<String> it = (List<String>) list.toArray()[indexList];
        head = it.get(0);
      }

      if (head == null) {
        throw new ProxyException("Problem with net - no exists head");
      }


      return head;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.