Package org.grails.web.servlet.mvc

Examples of org.grails.web.servlet.mvc.GrailsWebRequest$DefaultEncodingStateRegistryLookup


     * @return prefix for cache key that contains current controller's context (currently plugin and namespace)
     */
    protected String resolveCurrentControllerKeyPrefixes() {
        String pluginContextPath = null;
        String namespace = null;
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        if(webRequest != null) {
            namespace = webRequest.getControllerNamespace();
            pluginContextPath = (webRequest.getAttributes() != null && webRequest.getCurrentRequest() != null) ? webRequest.getAttributes().getPluginContextPath(webRequest.getCurrentRequest()) : null;
            return (pluginContextPath != null ? pluginContextPath : "-") + "," + (namespace != null ? namespace : "-");
        } else {
            return null;
        }
    }
View Full Code Here


    protected View createGrailsView(String viewName) throws Exception {
        // try GSP if res is null

        GroovyObject controller = null;
       
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        if(webRequest != null) {
            HttpServletRequest request = webRequest.getCurrentRequest();
            controller = webRequest.getAttributes().getController(request);
        }
       
        GroovyPageScriptSource scriptSource;
        if (controller == null) {
            scriptSource = groovyPageLocator.findViewByPath(viewName);
View Full Code Here

    void initialize(final StreamCharBuffer buffer, final ServletResponse response,
            BoundedCharsAsEncodedBytesCounter bytesCounter) {
        DestinationFactory lazyTargetFactory = new DestinationFactory() {
            public Writer activateDestination() throws IOException {
                final GrailsWebRequest webRequest = GrailsWebRequest.lookup();
                encoder = webRequest != null ? webRequest.lookupFilteringEncoder() : null;
                if (encoder != null) {
                    return buffer.getWriterForEncoder(encoder, webRequest.getEncodingStateRegistry());
                }
                return buffer.getWriter();
            }
        };
View Full Code Here

                response.setContentLength(size);
            }
            flushResponse();
        }
        else if (!isTrouble()) {
            GrailsWebRequest webRequest = GrailsWebRequest.lookup();
            if (webRequest != null && webRequest.getCurrentRequest().getAttribute(RequestConstants.PAGE) != null) {
                // flush the response if its a layout
                flushResponse();
            }
        }
    }
View Full Code Here

    public static final String PATH_TO_VIEWS = GroovyPagesUriSupport.PATH_TO_VIEWS;

    private static GroovyPagesUriSupport getInstance() {
        try {
            GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes();
            return (GroovyPagesUriSupport)webRequest.getAttributes().getGroovyPagesUriService();
        }
        catch (IllegalStateException e) {
            // returning non cached version, just for backwards compatibility
            return new GroovyPagesUriSupport();
        }
View Full Code Here

        return null;
    }

    @Override
    public void sendError(int sc) throws IOException {
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();

        try {
            if (!redirectCalled && !isCommitted()) {
                super.sendError(sc);
            }
View Full Code Here

        }
    }

    @Override
    public void sendError(int sc, String msg) throws IOException {
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        try {
            if (!redirectCalled && !isCommitted()) {
                super.sendError(sc, msg);
            }
        }
View Full Code Here

    private void renderWithinGrailsWebRequest(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        boolean attributesChanged = false;
        try {
            GrailsWebRequest webRequest;
            if(!(requestAttributes instanceof GrailsWebRequest)) {
                webRequest = createGrailsWebRequest(request, response, request.getServletContext());
                attributesChanged = true;
                WebUtils.storeGrailsWebRequest(webRequest);
            } else {
View Full Code Here

     */
    abstract protected void renderTemplate(Map<String, Object> model, GrailsWebRequest webRequest, HttpServletRequest request, HttpServletResponse response) throws Exception;
   
    protected GrailsWebRequest createGrailsWebRequest(HttpServletRequest request, HttpServletResponse response,
            ServletContext servletContext) {
        return new GrailsWebRequest(request, response, servletContext);
    }   
View Full Code Here

        actionName = action;
    }

    public String createURL(Map parameterValues, String encoding) {
        if (parameterValues == null) parameterValues = Collections.EMPTY_MAP;
        GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.getRequestAttributes();
        return createURLWithWebRequest(parameterValues, webRequest, true);
    }
View Full Code Here

TOP

Related Classes of org.grails.web.servlet.mvc.GrailsWebRequest$DefaultEncodingStateRegistryLookup

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.