Package org.cspoker.server.xml.http.handler.exception

Examples of org.cspoker.server.xml.http.handler.exception.HttpExceptionImpl


      logger.trace("Returning response of length " + xml.toString().length()
          + ":\n" + xml);
      return xml.toString().getBytes();
    } catch (JAXBException e) {
      logger.debug(e);
      throw new HttpExceptionImpl(e, 400);
    } catch (LoginException e) {
      logger.debug(e);
      throw new HttpExceptionImpl(e, 401);
    }
  }
View Full Code Here


  public static Pair<String,String> getCredentials(Headers requestHeaders)
      throws HttpExceptionImpl {
    List<String> auth = requestHeaders.get("Authorization");
    if (auth == null || auth.size() != 1) {
      throw new HttpExceptionImpl(new IllegalArgumentException(
          "Incorrect Authorization"), 401);
    }
    String base64 = auth.get(0);
    try {
      String decoded = new String(Base64.decode(base64.split(" ")[1]));
      String[] parts = decoded.split(":");
      return new Pair<String, String>(parts[0],parts[1]);
    } catch (IOException e) {
      throw new HttpExceptionImpl(e, 401);
    }
  }
View Full Code Here

TOP

Related Classes of org.cspoker.server.xml.http.handler.exception.HttpExceptionImpl

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.