Package org.grails.web.servlet.mvc

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


    public String createURL(String controller, String action, String namespace, String pluginName, Map parameterValues, String encoding) {
        return createURLInternal(controller, action, parameterValues, true);
    }

    private String createURLInternal(String controller, String action, Map<String, String> parameterValues, boolean includeContextPath) {
        GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.getRequestAttributes();

        if (parameterValues == null) parameterValues = new HashMap<String, String>();
        boolean blankController = GrailsStringUtils.isBlank(controller);
        boolean blankAction = GrailsStringUtils.isBlank(action);
View Full Code Here


        sb.append(prefix);
        if (getConfiguredServerBaseURL()==null && isAbsolute(attrs)) {
            if (attrs.get(BASE) != null) {
                sb.append(attrs.get(BASE));
            } else {
                GrailsWebRequest webRequest = GrailsWebRequest.lookup();
            if(webRequest != null) {
                    sb.append(webRequest.getBaseUrl());
                }
            }
        }
        appendMapKey(sb, attrs);
        return sb.toString();
View Full Code Here

        super("ServletContext");
    }

    @Override
    protected ServletContext lookupSecondary() {
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        return webRequest == null ? null : webRequest.getServletContext();
    }
View Full Code Here

    }

    private String lookupFormat(String name) {
        String format = CACHED_DATE_FORMATS.get(name);
        if (format == null) {
            GrailsWebRequest webRequest = GrailsWebRequest.lookup(request);
            if (webRequest != null) {
                MessageSource messageSource = webRequest.getApplicationContext();
                if (messageSource != null) {
                    format = messageSource.getMessage("date." + name + ".format", EMPTY_ARGS, webRequest.getLocale());
                    if (format != null) {
                        CACHED_DATE_FORMATS.put(name, format);
                    }
                }
            }
View Full Code Here

    }

    @Override
    public void sendError(int sc) throws IOException {
        clearBuffer();
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        try {
            super.sendError(sc);
        }
        finally {
            if(webRequest != null)
View Full Code Here

    }

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

            }
        }
    }

    private void registerWithSessionIfNecessary() {
        GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes();
        HttpSession session = webRequest.getCurrentRequest().getSession(true);
        if (session.getAttribute(GrailsApplicationAttributes.FLASH_SCOPE) == null) {
            session.setAttribute(GrailsApplicationAttributes.FLASH_SCOPE, this);
        }
    }
View Full Code Here

        if (encoding == null) encoding = "utf-8";

        String contextPath = "";
        if (includeContextPath) {
            GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.getRequestAttributes();
            if (webRequest != null) {
                contextPath = webRequest.getAttributes().getApplicationUri(webRequest.getCurrentRequest());
            }
        }
        if (paramValues == null) paramValues = Collections.EMPTY_MAP;
        StringBuilder uri = new StringBuilder(contextPath);
        Set usedParams = new HashSet();
View Full Code Here

                return new Closure(this) {
                    private static final long serialVersionUID = -2404119898659287216L;

                    @Override
                    public Object call(Object... objects) {
                        GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes();
                        return webRequest.getParams().get(name);
                    }
                };
            }
        }
        return null;
View Full Code Here

    public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
        return getNoSuffixViewURI(getLogicalControllerName(controller), viewName);
    }

    public String getLogicalControllerName(GroovyObject controller) {
        GrailsWebRequest webRequest = GrailsWebRequest.lookup();
        String logicalName = webRequest != null ? webRequest.getControllerName() : null;
        if (logicalName == null) {
            logicalName = controller != null ? GrailsNameUtils.getLogicalPropertyName(controller.getClass().getName(), ControllerArtefactHandler.TYPE) : null;
        }
        return logicalName;
    }
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.