Package com.cuubez.core.exception

Examples of com.cuubez.core.exception.CuubezException


                }

            } else {

                log.error("unsupported request media type");
                throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
            }

            log.error("unsupported request media type");
            throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
        }
View Full Code Here


        int startIndexOf = uri.indexOf(applicationName);

        if(startIndexOf == -1) {
            log.error("Invalid request URI");
            throw new CuubezException(CuubezException.INVALID_URI);
        }

        String resourceURI = uri.substring(startIndexOf+applicationName.length());

        if (resourceURI.startsWith(PARAMETER_SEPARATOR) || resourceURI.isEmpty()) {
            log.error("Invalid request URI");
            throw new CuubezException(CuubezException.INVALID_URI);
        }
    }
View Full Code Here

                document = db.parse(httpServletRequest.getInputStream());
            }

        } catch (SAXException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.PARSING_EXCEPTION);
        } catch (IOException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.PARSING_EXCEPTION);
        }

        return document;
    }
View Full Code Here

        int startIndexOf = uri.indexOf(applicationName);

        if(startIndexOf == -1) {
            log.error("Invalid request URI");
            throw new CuubezException(CuubezException.INVALID_URI);
        }

        String resourceURI = uri.substring(startIndexOf+applicationName.length());

        if (resourceURI.startsWith(PARAMETER_SEPARATOR) || resourceURI.isEmpty()) {
            log.error("Invalid request URI");
            throw new CuubezException(CuubezException.INVALID_URI);
        }
    }
View Full Code Here

            }


        } catch (InvocationTargetException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.INVOCATION_EXCEPTION);
        } catch (InstantiationException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.INVOCATION_EXCEPTION);
        } catch (IllegalAccessException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.INVOCATION_EXCEPTION);
        } catch (SecurityException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.INVOCATION_EXCEPTION);
        } catch (IllegalArgumentException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.ILLEGAL_ARGUMENT_EXCEPTION);
        }

    }
View Full Code Here

                }
            }

        } else {
            log.error("unsupported response media type");
            throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
        }

        log.error("unsupported response media type");
        throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
    }
View Full Code Here

                content = XMLTransformerUtil.getDocumentAsString(document);
            }

        } catch (ParserConfigurationException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.PARSING_EXCEPTION);
        } catch (TransformerException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.PARSING_EXCEPTION);
        }

        if (content != null) {
            Class<?> inputObjectType = messageContext.getRequestContext().getSelectedResource().getSelectedMethodMetaData().getInputObjectType();
            String rootNode = XMLTransformerUtil.getRootNodeName(document);
View Full Code Here

        try {
            output = transformer.unMarshal(new InputStreamReader(messageContext.getRequestConfigurationContext().getRequest().getInputStream()), inputObjectType);
            setInputObjectToParameterArray(messageContext, output);
        } catch (IOException e) {
            log.error(e);
            throw new CuubezException(CuubezExceptionConstance.PARSING_EXCEPTION);
        }

    }
View Full Code Here

                }

            } else {

                log.error("unsupported request media type");
                throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
            }

            log.error("unsupported request media type");
            throw new CuubezException(CuubezExceptionConstance.UNSUPPORTED_MEDIA_TYPE);
        }
View Full Code Here

    public SelectedResourceMetaData findResource(String path, String httpMethod) throws CuubezException {

        if (rootResources == null || path == null || httpMethod == null) {
            log.trace("resource not found");
            throw new CuubezException(CuubezException.RESOURCE_NOT_FOUND);
        }

        for (RootResource rootResource : rootResources) {

            PathMetaData rootPathMetaData = rootResource.getUriTemplate().match(path);

            if (rootPathMetaData != null) {

                log.trace("root resource found");
                List<SubResource> subResources = rootResource.getSubResources();

                for (SubResource subResource : subResources) {

                    PathMetaData subPathMetaData = null;

                    if (subResource.getUriTemplate() != null) {
                        subPathMetaData = subResource.getUriTemplate().match(rootPathMetaData.getTail());
                    }

                    if(subPathMetaData != null) {


                        String subResourceHttpMethod = subResource.getMethodMetaData().getHttpMethod();

                        if (subResourceHttpMethod.equals(httpMethod)) {

                            SelectedResourceMetaData selectedResourceMetaData = new SelectedResourceMetaData();
                            selectedResourceMetaData.setSelectedMethodMetaData(subResource.getMethodMetaData());
                            selectedResourceMetaData.addPathVariableMetaData(rootPathMetaData.getPathVariables());
                            selectedResourceMetaData.addPathVariableMetaData(subPathMetaData.getPathVariables());

                            log.trace("sub resource found");
                            return selectedResourceMetaData;
                        }
                    }
                }

            }
        }

        log.trace("resource not found");
        throw new CuubezException(CuubezException.RESOURCE_NOT_FOUND);
    }
View Full Code Here

TOP

Related Classes of com.cuubez.core.exception.CuubezException

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.