Examples of ResourceRegistry


Examples of org.apache.wink.server.internal.registry.ResourceRegistry

            ofFactoryRegistry = new LifecycleManagersRegistry();
            ofFactoryRegistry.addFactoryFactory(new ScopeLifecycleManager<Object>());
        }
        ApplicationValidator applicationValidator = new ApplicationValidator();
        providersRegistry = new ProvidersRegistry(ofFactoryRegistry, applicationValidator);
        resourceRegistry = new ResourceRegistry(ofFactoryRegistry, applicationValidator);
    }
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

                Messages
                    .getMessage("exceptionOccurredDuringInvocation", t.getClass().getSimpleName(), t.getMessage(), requestMethod, requestString); //$NON-NLS-1$
        }
        if (logger.isDebugEnabled()) {
            logger.debug(messageFormat, t);
            ResourceRegistry rr = this.configuration.getResourceRegistry();
            List<ResourceRecord> resourceRecords = rr.getRecords();
            StringBuffer sb = new StringBuffer();
            String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
            for (ResourceRecord record : resourceRecords) {
                sb.append(newLine + "  " + record.toString()); //$NON-NLS-1$
            }
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

        SearchResult searchResult = context.getAttribute(SearchResult.class);
        if (searchResult.isError() && searchResult.getError().getResponse().getStatus() == HttpStatus.METHOD_NOT_ALLOWED
            .getCode()
            && context.getHttpMethod().equalsIgnoreCase(HttpMethodEx.OPTIONS)) {
            // get supported HTTP methods
            ResourceRegistry resourceRegistry = context.getAttribute(ResourceRegistry.class);
            Set<Class<?>> c = new HashSet<Class<?>>();
            Class<?> resourceClass = searchResult.getResource().getResourceClass();
            c.add(resourceClass);
            logger.trace("Found the resource classes {}", c);
            Application app = new WADLHandlerWADLGenerator().generate(context.getUriInfo().getBaseUri().toString(), c);
            if(context.getUriInfo().getMatchedResources().size() > 1) {
                // sub-resource locator so lets correct the path
                app.getResources().get(0).getResource().get(0).setPath(context.getUriInfo().getMatchedURIs().get(0));
            }

            Set<String> httpMethods = resourceRegistry.getOptions(searchResult.getResource());

            logger
                .trace("Invoking OPTIONS request handled by runtime with {} resource and {} HTTP methods", //$NON-NLS-1$
                       searchResult.getResource(),
                       httpMethods);
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

        // if the resource is an exact match to the uri, then this is the
        // handling resource,
        // and we need to find the dispatch method.
        // if no method is found then a RequestMatchingException exception is
        // thrown
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        ResourceInstance resource = result.getResource();

        MethodRecord method = null;
        try {
            // if no method is found then a RequestMatchingException exception
            // is thrown
            method = registry.findMethod(resource, context);
        } catch (WebApplicationException e) {
            // couldn't find a method
            result.setError(e);
            return;
        }
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

    private void handleSubResourceMethod(SubResourceInstance subResourceInstance,
                                         List<SubResourceInstance> subResources,
                                         MessageContext context,
                                         HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        ResourceInstance resource = result.getResource();
        SubResourceRecord subResourceRecord = subResourceInstance.getRecord();
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();
        String pattern = subResourceRecord.getTemplateProcessor().getPatternString();
        // dispatch to one of the sub-resource methods.
        SubResourceInstance method = null;
        try {
            // if no method is found then a RequestMatchingException exception
            // is thrown
            method = registry.findSubResourceMethod(pattern, subResources, resource, context);
        } catch (WebApplicationException e) {
            // couldn't find a method
            result.setError(e);
            return;
        }
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

    private void handleSubResourceLocator(SubResourceInstance subResourceInstance,
                                          List<SubResourceInstance> subResources,
                                          MessageContext context,
                                          HandlersChain chain) throws Throwable {
        ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
        SearchResult result = context.getAttribute(SearchResult.class);
        UriTemplateMatcher matcher = subResourceInstance.getMatcher();

        // // dispatch to the sub-resource locator.
        // result.setFound(true);
        // result.setMethod(subResourceInstance);
        // // save the matched template variables for UriInfo
        // matcher.storeVariables(result.getData().getMatchedVariables(),
        // false);
        // // save the matched uri for UriInfo
        // result.getData().addMatchedUri(matcher.getHead(false));
        saveFoundMethod(result, matcher, subResourceInstance, context);

        // continue the chain to invoke the locator
        if (logger.isTraceEnabled()) {
            MethodMetadata metadata =
                (subResourceInstance == null) ? null : subResourceInstance.getMetadata();
            logger.trace("Found subresource locator to invoke: {} ", metadata); //$NON-NLS-1$
        }
        chain.doChain(context);

        // the object returned from the locator is a sub-resource so we must
        // continue the search in it
        Object subResource = context.getResponseEntity();
        if (subResource == null) {
            logger.trace("Subresource returned was null so returning a 404 Not Found"); //$NON-NLS-1$
            result.setError(new WebApplicationException(Status.NOT_FOUND));
            return;
        }
        ResourceRecord record = registry.getRecord(subResource, false);
        ResourceInstance resourceInstance = new ResourceInstance(subResource, record, matcher);
        // save the resource for UriInfo
        result.getData().getMatchedResources().addFirst(resourceInstance);

        // call recursively to search in the sub-resource
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

        SearchResult searchResult = context.getAttribute(SearchResult.class);
        if (searchResult.isError() && searchResult.getError().getResponse().getStatus() == HttpStatus.METHOD_NOT_ALLOWED
            .getCode()
            && context.getHttpMethod().equalsIgnoreCase(HttpMethodEx.OPTIONS)) {
            // get supported HTTP methods
            ResourceRegistry resourceRegistry = context.getAttribute(ResourceRegistry.class);
            Set<String> httpMethods = resourceRegistry.getOptions(searchResult.getResource());

            logger
                .trace("Invoking OPTIONS request handled by runtime with {} resource and {} HTTP methods", //$NON-NLS-1$
                       searchResult.getResource(),
                       httpMethods);
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

    }

    public void testGoodAppStartupInfoLogOutput() throws Exception {
        WinkLogHandler.turnLoggingCaptureOn(WinkLogHandler.LEVEL.INFO);
        MockAppValidator mockAppValidator = new MockAppValidator();
        ResourceRegistry mockResourceRegistry =
            new ResourceRegistry(new LifecycleManagersRegistry(), mockAppValidator);
        ProvidersRegistry mockProvidersRegistry =
            new ProvidersRegistry(new LifecycleManagersRegistry(), mockAppValidator);
        ApplicationProcessor appProcessor =
            new ApplicationProcessor(new MyApp(), mockResourceRegistry, mockProvidersRegistry, false);
        appProcessor.process();
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

            ofFactoryRegistry = new LifecycleManagersRegistry();
            ofFactoryRegistry.addFactoryFactory(new ScopeLifecycleManager<Object>());
        }
        ApplicationValidator applicationValidator = new ApplicationValidator();
        providersRegistry = new ProvidersRegistry(ofFactoryRegistry, applicationValidator);
        resourceRegistry = new ResourceRegistry(ofFactoryRegistry, applicationValidator);
    }
View Full Code Here

Examples of org.apache.wink.server.internal.registry.ResourceRegistry

        RequestProcessor requestProcessor = getRequestProcessor();
        if (requestProcessor == null) {
            throw new ServletException(Messages
                .getMessage("adminServletRequestProcessorInitBeforeAdmin")); //$NON-NLS-1$
        }
        ResourceRegistry registry = requestProcessor.getConfiguration().getResourceRegistry();

        String[] parameterValues = request.getParameterValues(DOCUMENT_TYPE);
        if (parameterValues == null || parameterValues.length == 0) {
            buildAdminHome(response);
            return;
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.