Examples of Absolutizable


Examples of org.apache.cocoon.servletservice.Absolutizable

        } else {
            locationUri = new URI(url.getPath());
        }

        final String servletReference = locationUri.getScheme();
        final Absolutizable absolutizable = (Absolutizable) CallStackHelper.getCurrentServletContext();
        final String servletName;

        // find out the type of the reference and create a service name
        if (servletReference == null) {
            // self-reference
            if (absolutizable == null) {
                throw new NoCallingServletServiceRequestAvailableException(
                        "A self-reference requires an active servlet request.");
            }

            servletName = absolutizable.getServiceName();
        } else if (servletReference.endsWith(AbsoluteServletConnection.ABSOLUTE_SERVLET_SOURCE_POSTFIX)) {
            // absolute reference
            servletName = servletReference.substring(0, servletReference.length() - 1);
        } else {
            // relative reference
            if (absolutizable == null) {
                throw new NoCallingServletServiceRequestAvailableException(
                        "A relative servlet call requires an active servlet request.");
            }

            servletName = absolutizable.getServiceName(servletReference);
        }

        this.servletConnection = new AbsoluteServletConnection(servletName, locationUri.getRawPath(), locationUri
                .getRawQuery());
        this.servletConnection.setIfModifiedSince(0);
View Full Code Here

Examples of org.apache.cocoon.servletservice.Absolutizable

        } else {
            locationUri = new URI(url.getPath());
        }

        final String servletReference = locationUri.getScheme();
        final Absolutizable absolutizable = (Absolutizable) CallStackHelper.getCurrentServletContext();
        final String servletName;

        // find out the type of the reference and create a service name
        if (servletReference == null) {
            // self-reference
            if (absolutizable == null) {
                throw new NoCallingServletServiceRequestAvailableException(
                        "A self-reference requires an active servlet request.");
            }

            servletName = absolutizable.getServiceName();
        } else if (servletReference.endsWith(AbsoluteServletConnection.ABSOLUTE_SERVLET_SOURCE_POSTFIX)) {
            // absolute reference
            servletName = servletReference.substring(0, servletReference.length() - 1);
        } else {
            // relative reference
            if (absolutizable == null) {
                throw new NoCallingServletServiceRequestAvailableException(
                        "A relative servlet call requires an active servlet request.");
            }

            servletName = absolutizable.getServiceName(servletReference);
        }

        this.servletConnection = new AbsoluteServletConnection(servletName, locationUri.getRawPath(), locationUri
                .getRawQuery());
        this.servletConnection.setIfModifiedSince(0);
View Full Code Here

Examples of org.apache.cocoon.servletservice.Absolutizable

        String resultResourcePath = resourcePath;
        if (resultResourcePath.length() > 0 && !resultResourcePath.startsWith("/")) {
            resultResourcePath = "/" + resultResourcePath;
        }

        Absolutizable a;
        try {
            a = (Absolutizable) servlet.getServletConfig().getServletContext();
        } catch (ClassCastException cce) {
            throw new ServletServiceException("The passed servlet isn't a servlet service because it can't be cast to "
                    + Absolutizable.class.getName() + ".", cce);
        }

        AbsoluteServletConnection sc = new AbsoluteServletConnection(a.getServiceName(), resultResourcePath, query);
        try {
            return sc.getInputStream();
        } catch (IOException e) {
            throw new ServletServiceException(e);
        } catch (ServletException e) {
View Full Code Here

Examples of org.apache.cocoon.servletservice.Absolutizable

    public static InputStream getServletServiceResource(Servlet servlet, String resourcePath, String query) {
        if (resourcePath.length() > 0 && !resourcePath.startsWith("/")) {
            resourcePath = "/" + resourcePath;
        }

        Absolutizable a;
        try {
            a = (Absolutizable) servlet.getServletConfig().getServletContext();
        } catch (ClassCastException cce) {
            throw new ServletServiceException("The passed servlet isn't a servlet service because it can't be cast to "
                    + Absolutizable.class.getName() + ".", cce);
        }

        AbsoluteServletConnection sc = new AbsoluteServletConnection(a.getServiceName(), resourcePath, null);
        try {
            return sc.getInputStream();
        } catch (IOException e) {
            throw new ServletServiceException(e);
        } catch (ServletException e) {
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.