Package com.sun.grizzly.tcp

Examples of com.sun.grizzly.tcp.Adapter


     * @throws EndpointRegistrationException
     */
    public static GrizzlyAdapter exposeContext(Set classes, ServerContext sc)
            throws EndpointRegistrationException {

        Adapter adapter = null;

        ResourceConfig rc = new DefaultResourceConfig(classes);

        //Use common classloader. Jersey artifacts are not visible through
        //module classloader
View Full Code Here


        Object context = request.getMappingData().context;
        if (context instanceof ContextRootInfo) {
            // this block of code will be invoked when an AJP request is intended
            // for an Adapter other than the CoyoteAdapter
            final Adapter toInvoke = ((ContextRootInfo) context).getAdapter();
            // Ensure the Adapter isn't the ContainerMapper.  It could be there
            // is only one container/adapter currently active.  If this is the
            // case, it could cause recursion and blow the stack.
            if (!"com.sun.enterprise.v3.services.impl.ContainerMapper".equals(toInvoke.getClass().getName())) {
                toInvoke.service(req, res);
                toInvoke.afterService(req, res);
                return false;
            }
        }

        Context ctx = (Context) context;
View Full Code Here

    @Override
    public GrizzlyAdapter exposeContext(Set classes, ServerContext sc, Habitat habitat)
            throws EndpointRegistrationException {


        Adapter adapter = null;
        Reloader r = new Reloader();

        ResourceConfig rc = new DefaultResourceConfig(classes);
        rc.getMediaTypeMappings().put("xml", MediaType.APPLICATION_XML_TYPE);
        rc.getMediaTypeMappings().put("json", MediaType.APPLICATION_JSON_TYPE);
View Full Code Here

        Object context = request.getMappingData().context;
        if (context instanceof ContextRootInfo) {
            // this block of code will be invoked when an AJP request is intended
            // for an Adapter other than the CoyoteAdapter
            final Adapter toInvoke = ((ContextRootInfo) context).getAdapter();
            // Ensure the Adapter isn't the ContainerMapper.  It could be there
            // is only one container/adapter currently active.  If this is the
            // case, it could cause recursion and blow the stack.
            if (!"com.sun.enterprise.v3.services.impl.ContainerMapper".equals(toInvoke.getClass().getName())) {
                toInvoke.service(req, res);
                toInvoke.afterService(req, res);
                return false;
            }
        }

        Context ctx = (Context) context;
View Full Code Here

        GrizzlyTestContainer(URI baseUri, LowLevelAppDescriptor ad) {
            this.baseUri = UriBuilder.fromUri(baseUri).path(ad.getContextPath()).build();
           
            LOGGER.info("Creating low level grizzly container configured at the base URI " + this.baseUri);
            try {
                Adapter adapter = ContainerFactory.createContainer(Adapter.class,
                        ad.getResourceConfig());
                this.selectorThread = create(this.baseUri, adapter);
            } catch (Exception ex) {
                throw new TestContainerException(ex);
            }
View Full Code Here

    @Override
    public GrizzlyAdapter exposeContext(Set classes, ServerContext sc, Habitat habitat)
            throws EndpointRegistrationException {


        Adapter adapter = null;
        Reloader r = new Reloader();

        ResourceConfig rc = new DefaultResourceConfig(classes);
        rc.getMediaTypeMappings().put("xml", MediaType.APPLICATION_XML_TYPE);
        rc.getMediaTypeMappings().put("json", MediaType.APPLICATION_JSON_TYPE);
View Full Code Here

            // TODO: Not sure that will works with JRuby.
            if (!mapMultipleAdapter && mapper instanceof V3Mapper){
                // Remove the MappingData as we might delegate the request
                // to be serviced directly by the WebContainer
                req.setNote(MAPPING_DATA, null);
                Adapter a = ((V3Mapper)mapper).getAdapter();
                if (a != null){
                    req.setNote(MAPPED_ADAPTER, a);
                    a.service(req, res);
                    return;
                }
            }

            MessageBytes decodedURI = req.decodedURI();
            decodedURI.duplicate(req.requestURI());
            mappingData = (MappingData) req.getNote(MAPPING_DATA);
            if (mappingData == null) {
                mappingData = new MappingData();
                req.setNote(MAPPING_DATA, mappingData);
            }
            Adapter adapter = null;
           
            String uriEncoding = (String) grizzlyEmbeddedHttp.getProperty("uriEncoding");
            HttpRequestURIDecoder.decode(decodedURI, urlDecoder, uriEncoding, null);

            final CharChunk decodedURICC = decodedURI.getCharChunk();
            final int semicolon = decodedURICC.indexOf(';', 0);

            // Map the request without any trailling.
            adapter = mapUriWithSemicolon(req, decodedURI, semicolon, mappingData);
            if (adapter == null || adapter instanceof ContainerMapper) {
                String ext = decodedURI.toString();
                String type = "";
                if (ext.indexOf(".") > 0) {
                    ext = "*" + ext.substring(ext.lastIndexOf("."));
                    type = ext.substring(ext.lastIndexOf(".") + 1);
                }

                if (!MimeType.contains(type) && !ext.equals("/")){
                    initializeFileURLPattern(ext);
                    mappingData.recycle();
                    adapter = mapUriWithSemicolon(req, decodedURI, semicolon, mappingData);
                } else {
                    super.service(req, res);
                    return;
                }
            }

            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "Request: {0} was mapped to Adapter: {1}",
                        new Object[]{decodedURI.toString(), adapter});
            }

            // The Adapter used for servicing static pages doesn't decode the
            // request by default, hence do not pass the undecoded request.
            if (adapter == null || adapter instanceof ContainerMapper) {
                super.service(req, res);
            } else {
                req.setNote(MAPPED_ADAPTER, adapter);

                ContextRootInfo contextRootInfo = null;
                if (mappingData.context != null && mappingData.context instanceof ContextRootInfo) {
                    contextRootInfo = (ContextRootInfo) mappingData.context;
                }

                if (contextRootInfo == null){
                    adapter.service(req, res);
                } else {
                    ClassLoader cl = null;
                    if (contextRootInfo.getContainer() instanceof ApplicationContainer){
                        cl = ((ApplicationContainer)contextRootInfo.getContainer()).getClassLoader();
                    }
View Full Code Here

                        match = true;
                        break;
                    }
                }
               
                Adapter adapter = this;
                if (match) {
                    adapter = grizzlyService.habitat.getComponent(SnifferAdapter.class);
                    ((SnifferAdapter)adapter).initialize(sniffer, this);
                    ContextRootInfo c= new ContextRootInfo(adapter, null);
  
View Full Code Here

     */
    @Override
    public void afterService(Request req, Response res) throws Exception {
        MappingData mappingData = (MappingData) req.getNote(MAPPING_DATA);
        try {
            Adapter adapter = (Adapter) req.getNote(MAPPED_ADAPTER);
            if (adapter != null) {
                adapter.afterService(req, res);
            }
            super.afterService(req, res);
        } finally {
            req.setNote(MAPPED_ADAPTER, null);
            if (mappingData != null){
View Full Code Here

TOP

Related Classes of com.sun.grizzly.tcp.Adapter

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.