Tabnine Logo
ServletContext.getAttribute
Code IndexAdd Tabnine to your IDE (free)

How to use
getAttribute
method
in
javax.servlet.ServletContext

Best Java code snippets using javax.servlet.ServletContext.getAttribute (Showing top 20 results out of 8,154)

Refine searchRefine arrow

  • ServletContext.setAttribute
  • ServletException.<init>
  • HttpServletRequest.getParameter
  • FilterConfig.getServletContext
origin: spring-projects/spring-framework

@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
  Object scopedObject = this.servletContext.getAttribute(name);
  if (scopedObject == null) {
    scopedObject = objectFactory.getObject();
    this.servletContext.setAttribute(name, scopedObject);
  }
  return scopedObject;
}
origin: Netflix/eureka

@Override
public void init(FilterConfig filterConfig) throws ServletException {
  if (serverConfig == null) {
    EurekaServerContext serverContext = (EurekaServerContext) filterConfig.getServletContext()
        .getAttribute(EurekaServerContext.class.getName());
    serverConfig = serverContext.getServerConfig();
  }
}
origin: apache/hbase

 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
  HRegionServer hrs = (HRegionServer)getServletContext().getAttribute(HRegionServer.REGIONSERVER);
  assert hrs != null : "No RS in context!";

  resp.setContentType("text/html");

  if (!hrs.isOnline()) {
   resp.getWriter().write("The RegionServer is initializing!");
   resp.getWriter().close();
   return;
  }

  RSStatusTmpl tmpl = new RSStatusTmpl();
  if (req.getParameter("format") != null)
   tmpl.setFormat(req.getParameter("format"));
  if (req.getParameter("filter") != null)
   tmpl.setFilter(req.getParameter("filter"));
  if (req.getParameter("bcn") != null)
   tmpl.setBcn(req.getParameter("bcn"));
  if (req.getParameter("bcv") != null)
   tmpl.setBcv(req.getParameter("bcv"));
  tmpl.render(resp.getWriter(), hrs);
 }
}
origin: apache/hbase

out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.print( request.getParameter("pageTitle"));
out.write("</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n\n    <link href=\"/static/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/hbase.css\" rel=\"stylesheet\">\n  </head>\n  <body>\n    <div class=\"navbar  navbar-fixed-top navbar-default\">\n      <div class=\"container-fluid\">\n        <div class=\"navbar-header\">\n          <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\"\n                  data-target=\".navbar-collapse\">\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n          <a class=\"navbar-brand\" href=\"/rs-status\">\n            <img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/>\n          </a>\n        </div>\n        <div class=\"collapse navbar-collapse\">\n          <ul class=\"nav navbar-nav\">\n            <li><a href=\"/rs-status\">Home</a></li>\n");
out.write("            <li><a href=\"/processRS.jsp\">Process Metrics</a></li>\n            <li><a href=\"/logs/\">Local Logs</a></li>\n            <li><a href=\"/logLevel\">Log Level</a></li>\n            <li><a href=\"/dump\">Debug Dump</a></li>\n            <li><a href=\"/jmx\">Metrics Dump</a></li>\n            ");
  out.clearBuffer();
 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
 else throw new ServletException(t);
origin: apache/hbase

out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
  out.clearBuffer();
 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
 else throw new ServletException(t);
origin: DeemOpen/zkui

logger.debug("Home Post Action!");
try {
  Properties globalProps = (Properties) this.getServletContext().getAttribute("globalProps");
  Dao dao = new Dao(globalProps);
  String zkServer = globalProps.getProperty("zkServer");
  String action = request.getParameter("action");
  String currentPath = request.getParameter("currentPath");
  String displayPath = request.getParameter("displayPath");
  String newProperty = request.getParameter("newProperty");
  String newValue = request.getParameter("newValue");
origin: nutzam/nutz

              .getAttribute(Loading.CONTEXT_NAME);
if (globalContext != null) {
  context.putAll((Context) globalContext);
for (Object o : Lang.enum2collection(req.getParameterNames(), new ArrayList<String>())) {
  String key = (String) o;
  String value = req.getParameter(key);
  p.put(key, value);
origin: com.liferay.portal/com.liferay.portal.kernel

@Override
protected void doPortalInit() throws Exception {
  if (_INVOKER_FILTER_CHAIN_ENABLED) {
    _filterChains = PortalCacheHelperUtil.getPortalCache(
      PortalCacheManagerNames.SINGLE_VM, _getPortalCacheName());
  }
  ServletContext servletContext = _filterConfig.getServletContext();
  InvokerFilterHelper invokerFilterHelper =
    (InvokerFilterHelper)servletContext.getAttribute(
      InvokerFilterHelper.class.getName());
  if (invokerFilterHelper == null) {
    invokerFilterHelper = new InvokerFilterHelper();
    servletContext.setAttribute(
      InvokerFilterHelper.class.getName(), invokerFilterHelper);
    invokerFilterHelper.init(_filterConfig);
  }
  _invokerFilterHelper = invokerFilterHelper;
  _invokerFilterHelper.addInvokerFilter(this);
  _dispatcher = Dispatcher.valueOf(
    _filterConfig.getInitParameter("dispatcher"));
}
origin: com.atlassian.refapp/atlassian-refapp-auth-plugin

public void init(FilterConfig filterConfig) throws ServletException {
  securityConfig = (SecurityConfig) filterConfig.getServletContext().getAttribute(SecurityConfig.STORAGE_KEY);
  if (securityConfig == null) {
    throw new ServletException("No SecurityConfig found in servlet context!");
  }
}
origin: pippo-java/pippo

ServletContext servletContext = filterConfig.getServletContext();
if (servletContext.getAttribute(WebServer.PIPPO_APPLICATION) == null) {
  servletContext.setAttribute(WebServer.PIPPO_APPLICATION, application);
  log.error(e.getMessage(), e);
  destroy();
  throw new ServletException(e);
origin: resteasy/Resteasy

ResteasyDeployment ctxDeployment = (ResteasyDeployment) servletContext.getAttribute(ResteasyDeployment.class.getName());
ResteasyProviderFactory globalFactory = (ResteasyProviderFactory) servletContext.getAttribute(ResteasyProviderFactory.class.getName());
if (globalFactory == null && ctxDeployment != null) {
  globalFactory = ctxDeployment.getProviderFactory();
Dispatcher globalDispatcher = (Dispatcher) servletContext.getAttribute(Dispatcher.class.getName());
if (globalDispatcher == null && ctxDeployment != null) {
  globalDispatcher = ctxDeployment.getDispatcher();
  if ((providerFactory != null && dispatcher == null) || (providerFactory == null && dispatcher != null))
   throw new ServletException(Messages.MESSAGES.unknownStateListener());
   deployment.start();
   servletContext.setAttribute(ResteasyProviderFactory.class.getName(), deployment.getProviderFactory());
   servletContext.setAttribute(Dispatcher.class.getName(), deployment.getDispatcher());
   servletContext.setAttribute(Registry.class.getName(), deployment.getRegistry());
origin: apache/hbase

  out = pageContext.getOut();
  _jspx_out = out;
  _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
  out.print( request.getParameter("pageTitle"));
  out.write("</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n\n    <link href=\"/static/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/hbase.css\" rel=\"stylesheet\">\n  </head>\n  <body>\n    <div class=\"navbar  navbar-fixed-top navbar-default\">\n      <div class=\"container-fluid\">\n        <div class=\"navbar-header\">\n          <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\"\n                  data-target=\".navbar-collapse\">\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n          <a class=\"navbar-brand\" href=\"/master-status\">\n            <img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/>\n          </a>\n        </div>\n        <div class=\"collapse navbar-collapse\">\n          <ul class=\"nav navbar-nav\">\n            <li><a href=\"/master-status\">Home</a></li>\n");
  out.write("            <li><a href=\"/tablesDetailed.jsp\">Table Details</a></li>\n            ");
    out.clearBuffer();
   if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
   else throw new ServletException(t);
origin: apache/hbase

out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
  out.clearBuffer();
 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
 else throw new ServletException(t);
origin: spring-projects/spring-framework

@Override
public void setServletContext(ServletContext servletContext) {
  if (this.attributes != null) {
    for (Map.Entry<String, Object> entry : this.attributes.entrySet()) {
      String attributeName = entry.getKey();
      if (logger.isDebugEnabled()) {
        if (servletContext.getAttribute(attributeName) != null) {
          logger.debug("Replacing existing ServletContext attribute with name '" + attributeName + "'");
        }
      }
      servletContext.setAttribute(attributeName, entry.getValue());
      if (logger.isTraceEnabled()) {
        logger.trace("Exported ServletContext attribute with name '" + attributeName + "'");
      }
    }
  }
}
origin: DeemOpen/zkui

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    logger.debug("Export Get Action!");
    try {
      Properties globalProps = (Properties) this.getServletContext().getAttribute("globalProps");
      String zkServer = globalProps.getProperty("zkServer");
      String[] zkServerLst = zkServer.split(",");

      String authRole = (String) request.getSession().getAttribute("authRole");
      if (authRole == null) {
        authRole = ZooKeeperUtil.ROLE_USER;
      }
      String zkPath = request.getParameter("zkPath");
      StringBuilder output = new StringBuilder();
      output.append("#App Config Dashboard (ACD) dump created on :").append(new Date()).append("\n");
      Set<LeafBean> leaves = ZooKeeperUtil.INSTANCE.exportTree(zkPath, ServletUtil.INSTANCE.getZookeeper(request, response, zkServerLst[0], globalProps), authRole);
      for (LeafBean leaf : leaves) {
        output.append(leaf.getPath()).append('=').append(leaf.getName()).append('=').append(ServletUtil.INSTANCE.externalizeNodeValue(leaf.getValue())).append('\n');
      }// for all leaves
      response.setContentType("text/plain;charset=UTF-8");
      try (PrintWriter out = response.getWriter()) {
        out.write(output.toString());
      }

    } catch (InterruptedException | KeeperException ex) {
      logger.error(Arrays.toString(ex.getStackTrace()));
      ServletUtil.INSTANCE.renderError(request, response, ex.getMessage());
    }
  }
}
origin: Netflix/eureka

@Override
public void init(FilterConfig filterConfig) throws ServletException {
  if (serverConfig == null) {
    EurekaServerContext serverContext = (EurekaServerContext) filterConfig.getServletContext()
        .getAttribute(EurekaServerContext.class.getName());
    serverConfig = serverContext.getServerConfig();
  }
}
origin: DeemOpen/zkui

ZooKeeper zk = null;
try {
  Properties globalProps = (Properties) this.getServletContext().getAttribute("globalProps");
  String zkServer = globalProps.getProperty("zkServer");
  String[] zkServerLst = zkServer.split(",");
  String clusterName = request.getParameter("cluster");
  String appName = request.getParameter("app");
  String hostName = request.getParameter("host");
  String[] propNames = request.getParameterValues("propNames");
  String propValue = "";
origin: com.vlkan.hrrs/hrrs-servlet-filter

@Override
public synchronized void init(FilterConfig filterConfig) throws ServletException {
  checkArgument(servletContext == null, "servlet context is already initialized");
  servletContext = filterConfig.getServletContext();
  Object prevAttribute = servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_KEY);
  checkArgument(prevAttribute == null, "servlet context attribute is already initialized");
  servletContext.setAttribute(SERVLET_CONTEXT_ATTRIBUTE_KEY, this);
  LOGGER.trace("initialized");
}
origin: org.seasar.cms.ymir/ymir

public void init(FilterConfig config) throws ServletException {
  context_ = config.getServletContext();
  ymir_ = (Ymir) context_.getAttribute(YmirListener.ATTR_YMIR);
  String dispatcher = config.getInitParameter("dispatcher");
  if (dispatcher == null) {
    throw new ServletException(
        "Init-param 'dispatcher' must be specified");
  }
  dispatcher_ = dispatcher.toUpperCase();
}
origin: apache/hbase

  out = pageContext.getOut();
  _jspx_out = out;
  _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
String storeFile = request.getParameter("name");
HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
Configuration conf = rs.getConfiguration();
pageContext.setAttribute("pageTitle", "HBase RegionServer: " + rs.getServerName());
    out.clearBuffer();
   if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
   else throw new ServletException(t);
javax.servletServletContextgetAttribute

Javadoc

Returns the servlet container attribute with the given name, or null if there is no attribute by that name. An attribute allows a servlet container to give the servlet additional information not already provided by this interface. See your server documentation for information about its attributes. A list of supported attributes can be retrieved using getAttributeNames.

The attribute is returned as a java.lang.Object or some subclass. Attribute names should follow the same convention as package names. The Java Servlet API specification reserves names matching java.*, javax.*, and sun.*.

Popular methods of ServletContext

  • setAttribute
    Binds an object to a given attribute name in this ServletContext. If the name specified is already u
  • getInitParameter
    Returns a String containing the value of the named context-wide initialization parameter, or null if
  • getRealPath
    Gets the real path corresponding to the givenvirtual path.For example, if path is equal to /index.ht
  • getContextPath
    Returns the context path of the web application.The context path is the portion of the request URI t
  • getResourceAsStream
    Returns the resource located at the named path as an InputStream object.The data in the InputStream
  • getResource
    Returns a URL to the resource that is mapped to the given path.The path must begin with a / and is i
  • log
    Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log f
  • getRequestDispatcher
    Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path
  • removeAttribute
    Removes the attribute with the given name from this ServletContext. After removal, subsequent calls
  • getInitParameterNames
    Returns the names of the context's initialization parameters as anEnumeration of String objects, or
  • getMimeType
    Returns the MIME type of the specified file, or null if the MIME type is not known. The MIME type is
  • getResourcePaths
    Returns a directory-like listing of all the paths to resources within the web application whose long
  • getMimeType,
  • getResourcePaths,
  • getAttributeNames,
  • addListener,
  • getServerInfo,
  • getServletContextName,
  • addServlet,
  • getMajorVersion,
  • addFilter

Popular in Java

  • Making http post requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now