Package com.ibm.sbt.services.endpoints

Examples of com.ibm.sbt.services.endpoints.Endpoint


    private static final String APPLICATION_JSON        = "application/json";
 
  @Override
  public void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
    String pathInfo = request.getPathInfo();
      Endpoint endpoint = EndpointFactory.getEndpoint(getEndpointName(pathInfo))//remove hardcoded name ..get second token from path info
      PrintWriter writer = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "utf-8"));
    JsonObject jsonResponse = new JsonJavaObject();
      if(getAuthAction(pathInfo).equals(LOG_OUT)){
        boolean logoutSuccessful = true;
        try {
        endpoint.logout();
      } catch (AuthenticationException e) {
        logoutSuccessful = false;
      }
      try {
        if(endpoint.isAuthenticated()){
          logoutSuccessful = false;
        }
      } catch (ClientServicesException e) {
        logoutSuccessful = false;
      }
      if(logoutSuccessful){
        jsonResponse.putJsonProperty("success", true);
        jsonResponse.putJsonProperty("status", 200);
      }else{
        jsonResponse.putJsonProperty("success", false);
        jsonResponse.putJsonProperty("status", 500);
      }
      }
      if(getAuthAction(pathInfo).equals(IS_AUTHENTICATED)){
        try {
          jsonResponse.putJsonProperty("result", endpoint.isAuthenticated());
          jsonResponse.putJsonProperty("status", 200);
        } catch (ClientServicesException e) {
          jsonResponse.putJsonProperty("result", false);
          jsonResponse.putJsonProperty("status", 500);
        }
      }
      if(getAuthAction(pathInfo).equals(IS_AUTHENTICATION_VALID)){
      try {
        jsonResponse.putJsonProperty("result", endpoint.isAuthenticationValid());
        jsonResponse.putJsonProperty("status", 200);
      } catch (ClientServicesException e) {
        jsonResponse.putJsonProperty("result", false);
        jsonResponse.putJsonProperty("status", 500);
      }
View Full Code Here


   
 
  @Override
  public void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
    String pathInfo = request.getPathInfo();
      Endpoint endpoint = EndpointFactory.getEndpoint(getEndpointName(pathInfo))//remove hardcoded name ..get second token from path info
      BasicEndpoint basicendpoint = null;
     
      if(endpoint instanceof BasicEndpoint )
      {
        basicendpoint = (BasicEndpoint)endpoint;
View Full Code Here

    // Retrieve the entity data(handler), service and endpoint name
    Map<String, Object> changedfields = (Map<String, Object>) inputStream.readObject();
    DataHandler<?> dataHandler = (DataHandler<?>) inputStream.readObject();
    String endpointName = inputStream.readUTF();
    BaseService service = (BaseService) inputStream.readObject();
    Endpoint endPoint = EndpointFactory.getEndpoint(endpointName);

    fields = changedfields;
    setDataHandler(dataHandler);
    service.setEndpoint(endPoint);
    setService(service);
View Full Code Here

    else
      return parameters;
  }

  protected boolean isV5OrHigher() {
    Endpoint endpoint = getEndpoint();
    String apiVersion = endpoint.getApiVersion();
    if (StringUtil.isNotEmpty(apiVersion)) {
      Version version = Version.parse(apiVersion);
      return (version.getMajor() >= 5);
    }
    return false;
View Full Code Here

    }
   
    protected void createNotification() throws Exception {
     
      //TODO move endpoint for secondary user to test environment
      Endpoint ep = EndpointFactory.getEndpoint("connections");
      assertTrue("Only basic endpoint supported for this test ",ep instanceof BasicEndpoint || ep instanceof MockEndpoint);
     
      try {
     
      ((BasicEndpoint)ep).setUser(getEnvironment().getSecondaryUsername());
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.endpoints.Endpoint

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.