Examples of HTTPException


Examples of http_parser.HTTPException

      ByteBuffer   buf = ByteBuffer.wrap(nothttp.getBytes());

      ParserSettings s = new ParserSettings();
                     s.on_error = new HTTPErrorCallback() {
        public void cb (HTTPParser p, String mes, ByteBuffer buf, int pos) {
          throw new HTTPException(mes);
        }         
                     }; // err callback
     

      HTTPParser     p = new HTTPParser();
View Full Code Here

Examples of info.jtrac.mylyn.exception.HttpException

    String response = null;
    int code;
    try {
      code = httpClient.executeMethod(get);
      if (code != HttpURLConnection.HTTP_OK) {
        throw new HttpException("HTTP Response Code: " + code);
      }
      response = get.getResponseBodyAsString();     
    } finally {
      get.releaseConnection();
    }
View Full Code Here

Examples of io.iron.ironmq.HTTPException

    @Override
    public void deleteMessage(String id) throws IOException {
        if (messages.containsKey(id)) {
            messages.remove(id);
        } else
            throw new HTTPException(404, "not found");
    }
View Full Code Here

Examples of javango.http.HttpException

    try {
      Template template = cfg.getTemplate(this.template);
      template.process(getContext(), writer);
    } catch (TemplateException e) {
      log.error(e,e);
      throw new HttpException(e);
    } catch (IOException e) {
      log.error(e,e);
      throw new HttpException(e);
    }
  }
View Full Code Here

Examples of javax.xml.ws.http.HTTPException

            throw ce;
        } catch (Exception e) {
            String message = "Cannot initalize Web Services service object [" + serviceKey + "]: " + e.getMessage();

            if (e instanceof HTTPException) {
                HTTPException he = (HTTPException) e;
                if (he.getStatusCode() == 401) {
                    throw new CmisUnauthorizedException(message, e);
                } else if (he.getStatusCode() == 407) {
                    throw new CmisProxyAuthenticationException(message, e);
                }
            }

            throw new CmisConnectionException(message, e);
View Full Code Here

Examples of javax.xml.ws.http.HTTPException

            }
            if (ex instanceof Fault && ex.getCause() instanceof IOException) {
                throw new WebServiceException(ex.getMessage(), ex.getCause());
            }
            if (getBinding() instanceof HTTPBinding) {
                HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
                exception.initCause(ex);
                throw exception;
            } else if (getBinding() instanceof SOAPBinding) {
                SOAPFault soapFault = createSoapFault((SOAPBinding)getBinding(), ex);
                if (soapFault == null) {
                    throw new WebServiceException(ex);
                }
                SOAPFaultException  exception = new SOAPFaultException(soapFault);
                if (ex instanceof Fault && ex.getCause() != null) {
                    exception.initCause(ex.getCause());
                } else {
                    exception.initCause(ex);
                }
                throw exception;               
            } else {
                throw new WebServiceException(ex);
            }
View Full Code Here

Examples of javax.xml.ws.http.HTTPException

                        throw new SOAPFaultException(soapFault);
                    } catch (SOAPException e) {
                        throw new WebServiceException(e);
                    }
                } else if (getBinding() instanceof HTTPBinding) {
                    HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
                    exception.initCause(exp);
                    throw exception;
                } else {
                    throw new WebServiceException(exp);
                }
            }
View Full Code Here

Examples of javax.xml.ws.http.HTTPException

                    throw ex.fillInStackTrace();
                }
            }
           
            if (getBinding() instanceof HTTPBinding) {
                HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
                exception.initCause(ex);
                throw exception;
            } else if (getBinding() instanceof SOAPBinding) {
                SOAPFault soapFault = createSoapFault(ex);
                if (soapFault == null) {
                    throw new WebServiceException(ex);
                }
               
                SOAPFaultException  exception = new SOAPFaultException(soapFault);
                exception.initCause(ex);
                throw exception;               
            } else {
                throw new WebServiceException(ex);
            }
        } finally {
View Full Code Here

Examples of jodd.http.HttpException

      while (true) {
        char c = (char) in.read();
        recv.append(c);
        if (recv.length() > 1024) {
          throw new HttpException(ProxyInfo.ProxyType.HTTP, "Received header longer then 1024 chars");
        }
        if (c == -1) {
          throw new HttpException(ProxyInfo.ProxyType.HTTP, "Invalid response");
        }
        if ((nlchars == 0 || nlchars == 2) && c == '\r') {
          nlchars++;
        } else if ((nlchars == 1 || nlchars == 3) && c == '\n') {
          nlchars++;
        } else {
          nlchars = 0;
        }
        if (nlchars == 4) {
          break;
        }
      }

      String recvStr = recv.toString();

      BufferedReader br = new BufferedReader(new StringReader(recvStr));
      String response = br.readLine();

      if (response == null) {
        throw new HttpException(ProxyInfo.ProxyType.HTTP, "Empty proxy response");
      }

      Matcher m = RESPONSE_PATTERN.matcher(response);
      if (!m.matches()) {
        throw new HttpException(ProxyInfo.ProxyType.HTTP, "Unexpected proxy response");
      }

      int code = Integer.parseInt(m.group(1));

      if (code != HttpURLConnection.HTTP_OK) {
        throw new HttpException(ProxyInfo.ProxyType.HTTP, "Invalid code");
      }

      return socket;
    } catch (RuntimeException rtex) {
      closeSocket(socket);
      throw rtex;
    } catch (Exception ex) {
      closeSocket(socket);
      throw new HttpException(ProxyInfo.ProxyType.HTTP, ex.toString(), ex);
    }

  }
View Full Code Here

Examples of net.matuschek.http.HttpException

          // ignore this URL
        }
        // handle other values
      } else if (doc.isNotFound()) {
        // the document was not found
        exceptionHandler.handleException(this, u, new HttpException("Document not found"));
      } else if (doc.isUnauthorized()) {
        // the document was not found
        exceptionHandler.handleException(
          this,
          u,
          new HttpException("No authorization for the document."));
      } else {
        // an other error occured.
        exceptionHandler.handleException(this, u, new HttpException("Unknown document error (Http return code "+doc.getHttpCode()+")."));
      }
    }
  }
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.