Package com.cuubez.core.resource.metaData

Examples of com.cuubez.core.resource.metaData.SelectedResourceMetaData


    private static Log log = LogFactory.getLog(ResourceInvokeHandler.class);


    public void handleRequest(MessageContext messageContext) throws CuubezException {

        SelectedResourceMetaData selectedResourceMetaData = messageContext.getRequestContext().getSelectedResource();

        log.trace("resource invocation process started");
        try {

            Object[] arguments = getResourceArguments(selectedResourceMetaData);
            Class<?> cls = selectedResourceMetaData.getSelectedMethodMetaData().getClazz();
            Object obj = cls.newInstance();
            java.lang.reflect.Method selectedMethod = selectedResourceMetaData.getSelectedMethodMetaData().getReflectionMethod();
            validateArguments(selectedMethod, arguments);
            Object returnObject = selectedMethod.invoke(obj, arguments);

            if (selectedMethod.getReturnType().equals(Void.TYPE)) {

                messageContext.getResponseContext().setResponseCode(HttpServletResponse.SC_NO_CONTENT);

            } else if (returnObject != null) {
                messageContext.getResponseContext().setReturnObject(returnObject);
                messageContext.getResponseContext().setMediaType(populateResponseMediaType(selectedResourceMetaData.getSelectedMethodMetaData().getProduce(), messageContext.getRequestContext().getUrlContext().getMediaType()));
            }


        } catch (InvocationTargetException e) {
            log.error(e);
View Full Code Here


    private static Log log = LogFactory.getLog(ResourceInvokeHandler.class);


    public void handleRequest(MessageContext messageContext) throws CuubezException {

        SelectedResourceMetaData selectedResourceMetaData = messageContext.getRequestContext().getSelectedResource();

        log.trace("resource invocation process started");
        try {

            Object[] arguments = getResourceArguments(selectedResourceMetaData);
            Class<?> cls = selectedResourceMetaData.getSelectedMethodMetaData().getClazz();
            Object obj = cls.newInstance();
            java.lang.reflect.Method selectedMethod = selectedResourceMetaData.getSelectedMethodMetaData().getReflectionMethod();
            validateArguments(selectedMethod, arguments);
            Object returnObject = selectedMethod.invoke(obj, arguments);

            if (selectedMethod.getReturnType().equals(Void.TYPE)) {

                messageContext.getResponseContext().setResponseCode(HttpServletResponse.SC_NO_CONTENT);

            } else if (returnObject != null) {
                messageContext.getResponseContext().setReturnObject(returnObject);
                messageContext.getResponseContext().setMediaType(populateResponseMediaType(selectedResourceMetaData.getSelectedMethodMetaData().getProduce(), messageContext.getRequestContext().getUrlContext().getMediaType()));
            }


        } catch (InvocationTargetException e) {
            e.printStackTrace();
View Full Code Here

                        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;
                        }
                    }
View Full Code Here


    @Override
    public void handleRequest(MessageContext messageContext) throws CuubezException {

        SelectedResourceMetaData selectedResourceMetaData = messageContext.getRequestContext().getSelectedResource();

        log.trace("resource invocation process started");
        try {

            Object[] arguments = getResourceArguments(selectedResourceMetaData);
            Class<?> cls = selectedResourceMetaData.getSelectedMethodMetaData().getClazz();
            Object obj = cls.newInstance();
            java.lang.reflect.Method selectedMethod = selectedResourceMetaData.getSelectedMethodMetaData().getReflectionMethod();
            validateArguments(selectedMethod, arguments);
            Object returnObject = selectedMethod.invoke(obj, arguments);

            if (selectedMethod.getReturnType().equals(Void.TYPE)) {

                messageContext.getResponseContext().setResponseCode(HttpServletResponse.SC_NO_CONTENT);

            } else if (returnObject != null) {
                messageContext.getResponseContext().setReturnObject(returnObject);
                messageContext.getResponseContext().setMediaType(populateResponseMediaType(selectedResourceMetaData.getSelectedMethodMetaData().getProduce(), messageContext.getRequestContext().getUrlContext().getMediaType()));
            }


        } catch (InvocationTargetException e) {
            log.error(e);
View Full Code Here

                        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;
                        }
                    }
View Full Code Here

TOP

Related Classes of com.cuubez.core.resource.metaData.SelectedResourceMetaData

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.