Package org.apache.cxf.jaxrs.model

Examples of org.apache.cxf.jaxrs.model.OperationResourceInfo


        Class[] argType = {CustomerGender.class};
        Method m = Customer.class.getMethod("testWrongType2", argType);
        MessageImpl messageImpl = new MessageImpl();
        messageImpl.put(Message.QUERY_STRING, "p1=3");
        try {
            JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null,
                                                           messageImpl);
            fail("CustomerGender have no instance with name 3");
        } catch (WebApplicationException ex) {
            assertEquals(404, ex.getResponse().getStatus());
View Full Code Here


        Class[] argType = {Customer.CustomerBean.class};
        Method m = Customer.class.getMethod("testXmlAdapter", argType);
        Message messageImpl = createMessage();
        messageImpl.put(Message.QUERY_STRING, "a=aValue");

        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null, messageImpl);
        assertEquals(1, params.size());
       
        Customer.CustomerBean bean = (Customer.CustomerBean)params.get(0);
        assertEquals("aValue", bean.getA());
View Full Code Here

        Class[] argType = {Customer.CustomerBean.class};
        Method m = Customer.class.getMethod("testXmlAdapter2", argType);
        Message messageImpl = createMessage();
        messageImpl.put(Message.QUERY_STRING, "a=aValue");

        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null, messageImpl);
        assertEquals(1, params.size());
       
        Customer.CustomerBean bean = (Customer.CustomerBean)params.get(0);
        assertEquals("aValue", bean.getA());
View Full Code Here

        Class[] argType = {Customer.CustomerBeanInterface.class};
        Method m = Customer.class.getMethod("testXmlAdapter3", argType);
        Message messageImpl = createMessage();
        messageImpl.put(Message.QUERY_STRING, "a=aValue");

        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null, messageImpl);
        assertEquals(1, params.size());
       
        Customer.CustomerBean bean = (Customer.CustomerBean)params.get(0);
        assertEquals("aValue", bean.getA());
View Full Code Here

        headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
        messageImpl.put(Message.PROTOCOL_HEADERS, headers);
        String body = "a=aValue&b=123&cb=true";
        messageImpl.setContent(InputStream.class, new ByteArrayInputStream(body.getBytes()));
       
        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null,
                                                           messageImpl);
        assertEquals("Bean should be created", 1, params.size());
        Customer.CustomerBean cb = (Customer.CustomerBean)params.get(0);
        assertNotNull(cb);
View Full Code Here

        MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
        headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
        messageImpl.put(Message.PROTOCOL_HEADERS, headers);
        String body = "g.b=1&g.b=2";
        messageImpl.setContent(InputStream.class, new ByteArrayInputStream(body.getBytes()));
        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           null,
                                                           messageImpl);
        assertEquals("Bean should be created", 1, params.size());
        Customer.CustomerBean cb = (Customer.CustomerBean)params.get(0);
        assertNotNull(cb);
View Full Code Here

        List<OperationResourceInfo> sortedOps = sortOperationsByPath(
            cri.getMethodDispatcher().getOperationResourceInfos());

        boolean resourceTagOpened = false;
        for (int i = 0; i < sortedOps.size(); i++) {
            OperationResourceInfo ori = sortedOps.get(i);

            if (ori.getHttpMethod() == null) {
                Class<?> cls = getMethod(ori).getReturnType();
                ClassResourceInfo subcri = cri.findResource(cls, cls);
                if (subcri != null && !visitedResources.contains(subcri)) {
                    startResourceTag(sb, subcri.getServiceClass(), ori.getURITemplate().getValue());
                    handleDocs(subcri.getServiceClass().getAnnotations(), sb, DocTarget.RESOURCE, true,
                            isJson);
                    handlePathAndMatrixParams(sb, ori, isJson);
                    handleResource(sb, jaxbTypes, qnameResolver, clsMap, subcri,
                                   visitedResources, isJson);
                    sb.append("</resource>");
                } else {
                    handleDynamicSubresource(sb, jaxbTypes, qnameResolver, clsMap, ori, subcri, isJson);
                }
                continue;
            }
            OperationResourceInfo nextOp = i + 1 < sortedOps.size() ? sortedOps.get(i + 1) : null;
            resourceTagOpened = handleOperation(sb, jaxbTypes, qnameResolver, clsMap, ori,
                                                classParams, nextOp, resourceTagOpened, isJson, i);
        }
    }
View Full Code Here

        if (!candidateList.isEmpty()) {
            Map.Entry<OperationResourceInfo, MultivaluedMap<String, String>> firstEntry =
                candidateList.entrySet().iterator().next();
            values.clear();
            values.putAll(firstEntry.getValue());
            OperationResourceInfo ori = firstEntry.getKey();
            if (headMethodPossible(ori.getHttpMethod(), httpMethod)) {
                LOG.info(new org.apache.cxf.common.i18n.Message("GET_INSTEAD_OF_HEAD",
                         BUNDLE, resource.getServiceClass().getName(),
                         ori.getMethodToInvoke().getName()).toString());
            }
            if (isFineLevelLoggable) {
                LOG.fine(new org.apache.cxf.common.i18n.Message("OPER_SELECTED",
                               BUNDLE, ori.getMethodToInvoke().getName(),
                               resource.getServiceClass().getName()).toString());
            }
            return ori;
        }
       
View Full Code Here

        for (Method m : cri.getServiceClass().getMethods()) {
            UserOperation op = ops.get(m.getName());
            if (op == null || op.getName() == null) {
                continue;
            }
            OperationResourceInfo ori =
                new OperationResourceInfo(m, cri, URITemplate.createTemplate(op.getPath()),
                                          op.getVerb(), op.getConsumes(), op.getProduces(),
                                          op.getParameters(),
                                          op.isOneway());
            String rClassName = m.getReturnType().getName();
            if (op.getVerb() == null) {
View Full Code Here

    }
   
   
    private static OperationResourceInfo createOperationInfo(Method m, Method annotatedMethod,
                                                      ClassResourceInfo cri, Path path, String httpMethod) {
        OperationResourceInfo ori = new OperationResourceInfo(m, annotatedMethod, cri);
        URITemplate t = URITemplate.createTemplate(path);
        ori.setURITemplate(t);
        ori.setHttpMethod(httpMethod);
        return ori;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.model.OperationResourceInfo

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.