javax.servlet.Servlet.getServletConfig()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中javax.servlet.Servlet.getServletConfig()方法的一些代码示例,展示了Servlet.getServletConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Servlet.getServletConfig()方法的具体详情如下:
包路径:javax.servlet.Servlet
类名称:Servlet
方法名:getServletConfig

Servlet.getServletConfig介绍

[英]Returns a ServletConfig object, which contains initialization and startup parameters for this servlet. The ServletConfig object returned is the one passed to the init method.

Implementations of this interface are responsible for storing the ServletConfig object so that this method can return it. The GenericServlet class, which implements this interface, already does this.
[中]返回ServletConfig对象,该对象包含此servlet的初始化和启动参数。返回的ServletConfig对象是传递给init方法的对象。
此接口的实现负责存储ServletConfig对象,以便此方法可以返回它。实现这个接口的GenericServlet类已经完成了这项工作。

代码示例

代码示例来源:origin: jersey/jersey

@Override
public ServletConfig getServletConfig() {
  return wrappedServlet.getServletConfig();
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void servletHandlerAdapter() throws Exception {
  MockHttpServletRequest request = new MockHttpServletRequest(getServletContext(), "GET", "/servlet.do");
  MockHttpServletResponse response = new MockHttpServletResponse();
  complexDispatcherServlet.service(request, response);
  assertEquals("body", response.getContentAsString());
  Servlet myServlet = (Servlet) complexDispatcherServlet.getWebApplicationContext().getBean("myServlet");
  assertEquals("complex", myServlet.getServletConfig().getServletName());
  assertEquals(getServletContext(), myServlet.getServletConfig().getServletContext());
  complexDispatcherServlet.destroy();
  assertNull(myServlet.getServletConfig());
}

代码示例来源:origin: org.apache.commons/commons-configuration2

/**
 * Create a ServletConfiguration using the initialization parameter of
 * the specified servlet.
 *
 * @param servlet the servlet
 */
public ServletConfiguration(final Servlet servlet)
{
  this(servlet.getServletConfig());
}

代码示例来源:origin: org.apache.commons/commons-configuration2

/**
 * Create a ServletContextConfiguration using the context of
 * the specified servlet.
 *
 * @param servlet the servlet
 */
public ServletContextConfiguration(final Servlet servlet)
{
  this.context = servlet.getServletConfig().getServletContext();
}

代码示例来源:origin: webx/citrus

public void request(WebRequest webRequest) {
  try {
    invocationContext = client.newInvocation(webRequest);
    rawRequest = new MyHttpRequest(invocationContext.getRequest(), webRequest.getURL().toExternalForm());
    rawResponse = new MyHttpResponse(invocationContext.getResponse());
    servletContext = invocationContext.getServlet().getServletConfig().getServletContext();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  if (requestContexts != null) {
    requestContext = requestContexts.getRequestContext(servletContext, rawRequest, rawResponse);
  }
}

代码示例来源:origin: webx/citrus

public void request(WebRequest webRequest) {
  try {
    invocationContext = client.newInvocation(webRequest);
    rawRequest = new MyHttpRequest(invocationContext.getRequest(), webRequest.getURL().toExternalForm());
    rawResponse = new MyHttpResponse(invocationContext.getResponse());
    servletContext = invocationContext.getServlet().getServletConfig().getServletContext();
  } catch (RuntimeException e) {
    throw e;
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  if (requestContexts != null) {
    requestContext = requestContexts.getRequestContext(servletContext, rawRequest, rawResponse);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public ServletConfigurator(Servlet servlet) {
  super();
  this.servlet = servlet;
  this.config = servlet.getServletConfig();
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Create a ServletConfiguration using the initialization parameter of
 * the specified servlet.
 *
 * @param servlet the servlet
 */
public ServletConfiguration(Servlet servlet)
{
  this(servlet.getServletConfig());
}

代码示例来源:origin: com.github.almex/weblets-api

/**
 * Returns the configuration for this Servlet.
 * 
 * @return the configuration for this Servlet
 */
public ServletConfig getServletConfig() {
  return _delegate.getServletConfig();
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public ServletConfig getServletConfig()
{
  return displayChart.getServletConfig();
}

代码示例来源:origin: org.ops4j.pax.wicket/org.ops4j.pax.wicket.service

/**
 * <p>getServletConfig.</p>
 *
 * @return a {@link javax.servlet.ServletConfig} object.
 */
public ServletConfig getServletConfig() {
  return delegateServlet.getServletConfig();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration

/**
 * Create a ServletConfiguration using the initialization parameter of
 * the specified servlet.
 *
 * @param servlet the servlet
 */
public ServletConfiguration(Servlet servlet)
{
  this(servlet.getServletConfig());
}

代码示例来源:origin: com.sangupta/am

@Override
public void initialize(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws IOException, IllegalStateException, IllegalArgumentException {
  this.servletConfig = servlet.getServletConfig();
  this.servletContext = servlet.getServletConfig().getServletContext();
  this.request = request;
  this.response = response;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration

/**
 * Create a ServletContextConfiguration using the context of
 * the specified servlet.
 *
 * @param servlet the servlet
 */
public ServletContextConfiguration(Servlet servlet)
{
  this.context = servlet.getServletConfig().getServletContext();
}

代码示例来源:origin: com.mockrunner/mockrunner-servlet

public void initialize(Servlet servlet, ServletRequest request,
            ServletResponse response, String errorPageURL,
            boolean needsSession, int bufferSize,
            boolean autoFlush) 
{
  this.config = servlet.getServletConfig();
  this.request = request;
  this.response = response;
  jspWriter = new MockJspWriter();
  outStack = new Stack();
  attributes = new HashMap();
}

代码示例来源:origin: com.mockrunner/mockrunner-jdk1.3-j2ee1.3

public void initialize(Servlet servlet, ServletRequest request,
            ServletResponse response, String errorPageURL,
            boolean needsSession, int bufferSize,
            boolean autoFlush) 
{
  this.config = servlet.getServletConfig();
  this.request = request;
  this.response = response;
  jspWriter = new MockJspWriter();
  outStack = new Stack();
  attributes = new HashMap();
}

代码示例来源:origin: io.github.factoryfx/jettyFactory

public void update(Servlet servlet, Collection<BasicRequestHandler> basicRequestHandlers){
  try {
    servlet.init(this.servlet.getServletConfig());
  } catch (ServletException e) {
    throw new RuntimeException(e);
  }
  this.servlet=servlet;
  this.basicRequestHandler = basicRequestHandlers==null? Collections.emptyList():new ArrayList<>(basicRequestHandlers);
}

代码示例来源:origin: com.helger/ph-servlet

@Nonnull
@Nonempty
public String getServletName ()
{
 return m_aServlet.getServletConfig ().getServletName ();
}

代码示例来源:origin: org.apache.cocoon.monitoring/cocoon-monitoring

/**
 * Get Servlet-Services month path.
 *
 * @return month path
 */
@ManagedAttribute(description = "Returns list of registered Servlet-Services with their month paths")
public final String getServletServiceMountPaths() {
  ServletContext servletContext = this.servlet.getServletConfig().getServletContext();
  ServletServiceContext context = (ServletServiceContext) servletContext;
  return context.getMountPath();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.http.servlet

public HttpSession getSession() {
  HttpSession session = request.getSession();
  if (session != null) {
    return dispatchTargets.peek().getContextController().getSessionAdaptor(
      session, dispatchTargets.peek().getServletRegistration().getT().getServletConfig().getServletContext());
  }
  return null;
}

相关文章

微信公众号

最新文章

更多