Examples of ServletContext


Examples of javax.servlet.ServletContext

                nonOverridableParams.add(appParams[i].getName());
            }
        }

        List initParams = new ArrayList();
        ServletContext servletCtx = context.getServletContext();
        for (Enumeration e = servletCtx.getInitParameterNames(); e.hasMoreElements(); ) {
            String paramName = (String) e.nextElement();

            ApplicationParam param = new ApplicationParam();
            param.setName(paramName);
            param.setValue(servletCtx.getInitParameter(paramName));
            // if the parameter is declared in a deployment descriptor
            // and it is not declared in a context descriptor with override=false,
            // the value comes from the deployment descriptor
            param.setFromDeplDescr(context.findParameter(paramName) != null && ! nonOverridableParams.contains(paramName));
            initParams.add(param);
View Full Code Here

Examples of javax.servlet.ServletContext

        }

        String xmlPath;

        if (TARGET_WEB_XML.equals(downloadTarget)) {
            ServletContext sctx = context.getServletContext();
            xmlPath = sctx.getRealPath("/WEB-INF/web.xml");
        } else if (TARGET_CONTEXT_XML.equals(downloadTarget)) {
            xmlPath = context.getConfigFile();
        } else {
            throw new RuntimeException("Unknown download target " + getDownloadTarget());
        }
View Full Code Here

Examples of javax.servlet.ServletContext

        String xmlPath;
        File xmlFile = null;
        ModelAndView mv = new ModelAndView(getViewName());

        if (TARGET_WEB_XML.equals(displayTarget)) {
            ServletContext sctx = context.getServletContext();
            xmlPath = sctx.getRealPath("/WEB-INF/web.xml");
            xmlFile = new File(xmlPath);
            mv.addObject("fileDesc", getMessageSourceAccessor().getMessage("probe.src.app.viewxmlconf.webxml.desc"));
        } else if (TARGET_CONTEXT_XML.equals(displayTarget)) {
            xmlFile = getContainerWrapper().getTomcatContainer().getConfigFile(context);
            if (xmlFile != null) {
View Full Code Here

Examples of javax.servlet.ServletContext

    this.beanName = beanName;
  }

  public Object createBean(ActionContext context)
  {
    ServletContext servletContext = context.getContext();
    WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

    synchronized (this)
    {
      if (!checkNotSingleton)
View Full Code Here

Examples of javax.servlet.ServletContext

   * This service method will read in the image pointed to by the SiteInfo object
   * set the mime type on the output stream and stream out the image.
   */
  protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  {
    ServletContext servlet = super.getServletContext();
    SiteInfo siteInfo = Settings.getInstance().getSiteInfo(CVUtility.getHostName(servlet));
    File customerLogo = siteInfo.getCustomerLogo();
    byte[] buffer = null;
    // if size is still zero later, we will write out a hardcoded image.
    int size = 0;
View Full Code Here

Examples of javax.servlet.ServletContext

      if (event instanceof WebAppLifeCycleEvent)
      {
         WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
         if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
         {
            ServletContext scontext = null;
            try
            {
               scontext = event.getWebApp().getServletContext();

               InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
               if (is == null)
                  return;
               try
               {
                  is.close();
               }
               catch (Exception ex)
               {
                  // ignore me
               }
               final PortalContainerPostInitTask task = new PortalContainerPostInitTask()
               {

                  public void execute(ServletContext scontext, PortalContainer portalContainer)
                  {
                     register(scontext, portalContainer);
                  }
               };
               PortalContainer.addInitTask(scontext, task, portalContainerName);
            }
            catch (Exception ex)
            {
               LOG.error("An error occurs while registering 'Javascript in gatein-resources.xml' from the context '"
                  + (scontext == null ? "unknown" : scontext.getServletContextName()) + "'", ex);
            }
         }
      }
   }
View Full Code Here

Examples of javax.servlet.ServletContext

  /**
   * Globals.WEBAPP_PATH����ֵ��ʹ��access���ݿ���˵�dz���Ҫ���漰һ�����·��������
   */
  public void init() throws ServletException {
    ServletContext context = getServletContext();
    if (Globals.WEBAPP_PATH == null)
      Globals.WEBAPP_PATH = context.getRealPath("");
    //��ʼ��ϵͳ��ȫ����
    try {
      DLOGSecurityManager.init(context);
    } catch (IOException e) {
      throw new ServletException(e);
View Full Code Here

Examples of javax.servlet.ServletContext

   * ������ݵ�ģ��
   * @return
   * @throws IOException
   */
  protected String getTemplate(String tmp) throws IOException{
    ServletContext sc = getServlet().getServletContext();
    InputStream in = sc.getResourceAsStream(tmp);
    StringBuffer template = new StringBuffer(512);
    BufferedReader reader = null;
    try{
      reader = new BufferedReader(new InputStreamReader(in));
      do{
View Full Code Here

Examples of javax.servlet.ServletContext

   
    @Test
    public void testMultipartRequest() throws IOException, ServletException
    {
        MultipartFilter filter = new MultipartFilter();
        ServletContext context = new MockServletContext();
        HttpSession session = new MockHttpSession(context);
        MockHttpServletRequest request = new MockHttpServletRequest(session, "Pete", new HashSet<String>(), new Cookie[0], "post")
        {
           
            private final InputStream is = Resources.getResourceAsStream("/META-INF/seam.properties", null);
View Full Code Here

Examples of javax.servlet.ServletContext

 
  @SuppressWarnings("unchecked")
  @Override
  public void init() throws ServletException {
    super.init();
    ServletContext context = getServletContext();

    if ( ( template = (String)getServletContext().getAttribute( "template" ) ) == null &&
        ( template = getInitParameter( "template" ) ) == null ) template = DEFAULT_TEMPLATE;

    queryEngine = (QueryEngine)context.getAttribute( "queryEngine" );
    documentCollection = (DocumentCollection)context.getAttribute( "collection" );
    titleList = (List<CharSequence>)context.getAttribute( "titleList" );
    indexMap = queryEngine.indexMap;
    try {
      urlEncodedMimeType = URLEncoder.encode( (String)context.getAttribute( "mimeType" ), "UTF-8" );
    }
    catch ( UnsupportedEncodingException cantHappen ) {
      throw new RuntimeException( cantHappen );
    }
    useUri = context.getAttribute( "uri" ) == Boolean.TRUE;
    derelativise = context.getAttribute( "derelativise" ) == Boolean.TRUE;

    if ( documentCollection != null ) {
      sortedIndex = new Index[ indexMap.size() ];
      indexMap.values().toArray( sortedIndex );
      Arrays.sort( sortedIndex, new Comparator<Index>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.