Examples of RequestException


Examples of ch.aonyx.broker.ib.api.RequestException

        return builder;
    }

    private void checkMarketDataTypeRequest() {
        if (!Feature.MARKET_DATA_TYPE.isSupportedByVersion(getServerCurrentVersion())) {
            throw new RequestException(ClientMessageCode.UPDATE_TWS, "It does not support marketDataType requests.",
                    this);
        }
    }
View Full Code Here

Examples of com.app55.error.RequestException

  @SuppressWarnings("unchecked")
  private T processRequest(HttpResponse response)
  {
    if (response.getStatusCode() != 200)
      throw new RequestException("Http Error " + response.getStatusCode(), (long) response.getStatusCode(), null);

    Map<String, Object> ht = JsonUtil.map(response.getContent());
    if (ht.containsKey("error"))
      throw ApiException.createException((Map<String, Object>) ht.get("error"));
View Full Code Here

Examples of com.dbxml.labrador.exceptions.RequestException

      if ( methodName == null || methodName.length() == 0 ) {
         Object val = instance.getProperty(DEFAULT_METHOD);
         if ( val instanceof String )
            methodName = (String)val;
         else
            throw new RequestException("No method name was set");
      }
      instance.setMethodName(methodName);

      BrokerContext context = Broker.getInstance().getBrokerContext();
      Discovery disc = context.getDiscovery();
      String[] paramNames = disc.listParams(methodName);
      boolean postUsed = false;

      for ( int i = 0; paramNames != null && i < paramNames.length; i++ ) {
         boolean array = disc.isParamArray(methodName, i);
         String[] vals = request.getValues(paramNames[i]);

         if ( vals != null ) {
            if ( array )
               instance.setParameter(i, vals);
            else
               instance.setParameter(i, vals[0]);
         }
         else if ( !postUsed && request.hasContent() ) {
            // If there is POST data, and this parameter is a String, Document,
            // or byte array, then let us assume that the POST data is intended
            // for this one.
            try {
               InputStream is = request.getInputStream();
               ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE);

               byte[] buffer = new byte[BUFFER_SIZE];
               int size;
               do {
                  size = is.read(buffer);
                  if ( size > 0 )
                     bos.write(buffer, 0, size);
               }
               while ( size != -1 );

               instance.setParameter(i, bos.toByteArray());
               postUsed = true;
            }
            catch ( IOException e ) {
               /** @todo Hmmm */
            }
         }
         else
            instance.setParameter(i, null);
      }

      // Initially set the MIME type in case we get an HTTP 403 Exception
      ID id = context.getId();

      String contentType = getMimeType(id);
      if ( contentType != null )
         response.setHeader(HTTP.HEADER_CONTENT_TYPE, contentType);

      Object o = instance.invoke();

      Object type = context.getProperty(CONTENT_TYPE);
      if ( type == null )
         type = instance.getProperty(CONTENT_TYPE+'_'+methodName);

      if ( type instanceof String ) {
         contentType = (String)type;
         response.setHeader(HTTP.HEADER_CONTENT_TYPE, contentType);
      }

      if ( contentType == null ) {
         if ( o instanceof Node || o instanceof Element )
            contentType = Headers.TYPE_TEXT_XML;
         else
            contentType = Headers.TYPE_TEXT_PLAIN;
         response.setHeader(HTTP.HEADER_CONTENT_TYPE, contentType);
      }

      try {
         OutputStream os = response.getOutputStream();
         writeValue(os, o);
         os.flush(); // Is this needed?
         os.close(); // Is this needed?
         response.close();
      }
      catch ( IOException e ) {
         throw new RequestException(e.getMessage());
      }
   }
View Full Code Here

Examples of com.eclipsesource.jaxrs.consumer.RequestException

  private void validateResponse( RequestConfigurer configurer, Response response, String method ) {
    Family family = response.getStatusInfo().getFamily();
    if( family == SERVER_ERROR || family == CLIENT_ERROR ) {
      RequestError requestError = new RequestError( configurer, response, method );
      throw new RequestException( requestError );
    }
  }
View Full Code Here

Examples of com.gadglet.core.RequestException

    pm.currentTransaction().begin();
    try {
      item = (PersonalNotesData) helper.getSingleItemByKeyForAction(pm, request, PersonalNotesData.class);

      if (item == null)
        throw new RequestException(ReqErrorTypes.ITEM_NOT_FOUND);
     
      sharing =   item.getSharedItemReff();
     
      for(SharedItemReff share: sharing)
      {
        // in case not the owner (shared item)
        if(share.getSharedWithId().equals(request.getCurrentUserId()) && !share.getSharingType().equals(SharingType.OWNER))
          sharing.remove(share);
     
      }

      pm.makePersistent(item);
      pm.currentTransaction().commit();
    } catch (Exception e) {
      log.warning(e.getMessage());
      throw new RequestException(ReqErrorTypes.REQUEST_FAILED);
    } finally {
      if (pm.currentTransaction().isActive())
        pm.currentTransaction().rollback();
      pm.close();
    }
View Full Code Here

Examples of com.gadglet.core.RequestException

 
 

  @Override
  public void doAdd(GadgletRequestWrapper request, GadgletResponse response)throws RequestException{
    throw new RequestException(ReqErrorTypes.UNRECOGNIZED_ACTION);
  }
View Full Code Here

Examples of com.gadglet.core.RequestException

  }

  @Override
  public void doUpdate(GadgletRequestWrapper request, GadgletResponse response)
      throws RequestException {
    throw new RequestException(ReqErrorTypes.UNRECOGNIZED_ACTION);
  }
View Full Code Here

Examples of com.gadglet.core.RequestException


  @Override
  public void doView(GadgletRequestWrapper request, GadgletResponse response)
      throws RequestException {
    throw new RequestException(ReqErrorTypes.UNRECOGNIZED_ACTION);
  }
View Full Code Here

Examples of com.gadglet.core.RequestException

    DiscussionsList item = (DiscussionsList) helper
        .getSingleItemByKey(request, DiscussionsList.class);

    if (!item.isOwnedByMe(request))
      throw new RequestException(ReqErrorTypes.UNAUTHORIZED_OPERATION);

    item.getDomainFriendsSharing(request, res);

  }
View Full Code Here

Examples of com.gadglet.core.RequestException

    PersonalNotesAppsData item = (PersonalNotesAppsData) helper
        .getSingleItemByKey(request, PersonalNotesAppsData.class);

    if (!item.isOwnedByMe(request))
      throw new RequestException(ReqErrorTypes.UNAUTHORIZED_OPERATION);

    item.getDomainFriendsSharing(request, res);

  }
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.