Example usage for javax.servlet.http HttpServletRequest getAttribute

List of usage examples for javax.servlet.http HttpServletRequest getAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getAttribute.

Prototype

public Object getAttribute(String name);

Source Link

Document

Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

Usage

From source file:org.toobsframework.pres.url.mapping.strategy.DefaultDispatchStrategy.java

protected String resolveResouceId(HttpServletRequest request) {
    String resourceId = (String) request.getAttribute(DISPATCH_RESOURCE_ID_ATTRIBUTE);
    if (resourceId == null) {
        String urlPath = this.urlPathHelper.getLookupPathForRequest(request);
        resourceId = WebUtils.extractFilenameFromUrlPath(urlPath);
    }//ww  w .  j  av  a2s .c om
    return resourceId;
}

From source file:org.toobsframework.pres.url.mapping.strategy.DefaultDispatchStrategy.java

protected String resolveContentType(HttpServletRequest request) {
    String contentType = (String) request.getAttribute(DISPATCH_CONTENT_TYPE_ATTRIBUTE);
    if (contentType == null) {
        contentType = DEFAULT_CONTENT_TYPE;
    }//from   www  .  java  2 s . co  m
    return contentType;
}

From source file:it.infn.mw.iam.core.web.IamErrorController.java

private Exception getRequestException(HttpServletRequest httpRequest) {
    return (Exception) httpRequest.getAttribute("javax.servlet.error.exception");
}

From source file:marytts.http.controllers.MaryErrorController.java

private HttpStatus getStatus(HttpServletRequest request) {
    Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
    if (statusCode == null) {
        return HttpStatus.INTERNAL_SERVER_ERROR;
    }//from  ww w.jav  a2  s.  c  om
    return HttpStatus.valueOf(statusCode);
}

From source file:org.codehaus.groovy.grails.webflow.mvc.servlet.GrailsFlowHandlerMapping.java

@Override
protected Object getHandlerForControllerClass(GrailsControllerClass controllerClass,
        HttpServletRequest request) {
    final String actionName = (String) request.getAttribute(GrailsApplicationAttributes.ACTION_NAME_ATTRIBUTE);
    if (controllerClass != null && actionName != null) {
        if (controllerClass.isFlowAction(actionName)) {
            final String flowid = controllerClass.getLogicalPropertyName() + "/" + actionName;
            return new AbstractFlowHandler() {
                @Override//from   w w  w. j  a v a2s  .co  m
                public String getFlowId() {
                    return flowid;
                }
            };
        }
    }
    return null;
}

From source file:de.micromata.genome.gwiki.model.mpt.GWikiReqSessionMptIdSelector.java

public String getTenantId(GWikiServlet servlet, HttpServletRequest req) {
    String id = (String) req.getAttribute(MPT_KEY);
    if (StringUtils.isNotBlank(id) == true) {
        return id;
    }//www  .  j  av a  2 s . c om
    id = req.getParameter(MPT_KEY);
    if (id != null) {
        if (StringUtils.isBlank(id) == true) {
            req.getSession().removeAttribute(MPT_KEY);
            return null;
        } else {
            req.getSession().setAttribute(MPT_KEY, id);
            return id;
        }

    }
    return super.getTenantId(servlet, req);
}

From source file:fi.helsinki.opintoni.security.authorization.portfolio.PortfolioRequestResolver.java

@SuppressWarnings("unchecked")
private Map<String, String> getTemplateVariables(HttpServletRequest request) {
    return (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
}

From source file:edu.uiowa.icts.bluebutton.web.ErrorController.java

@RequestMapping(value = "{page}")
public String displayDefault(@PathVariable String page, ModelMap model, HttpServletRequest request) {
    log.error("Error URI: " + request.getAttribute("javax.servlet.error.request_uri"));
    Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception");
    if (exception != null) {
        log.error(request.getAttribute("javax.servlet.error.message"), exception);
        model.addAttribute("exception", exception);
    } else {/*from w w w.  java 2 s. c  om*/
        log.error(request.getAttribute("javax.servlet.error.message"));
    }
    model.addAttribute("pageTitle", "Error");
    return "/error/" + page;
}

From source file:jp.co.opentone.bsol.framework.web.filter.GZipFilter.java

private boolean isFiltered(HttpServletRequest request) {
    return request.getAttribute(FILTERED) != null;
}

From source file:am.ik.categolj2.api.link.LinkRestController.java

String getUrl(HttpServletRequest request) {
    return ((String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE))
            .replace("/api/" + ApiVersion.CURRENT_VERSION + "/links/", "");
}