Package org.apache.tomcat.core

Examples of org.apache.tomcat.core.Context$Attribute$WorkDir


  return context;
    }

    // -------------------- Public facade methods --------------------
    public ServletContext getContext(String path) {
        Context target=contextM.getContext(context, path);
  return (ServletContext)target.getFacade();
    }
View Full Code Here


  sendError(sc, "No detailed message");
    }

    public void sendError(int sc, String msg) throws IOException {
  if (isCommitted()) {
      Context ctx=response.getRequest().getContext();
      ctx.log( "Servlet API error: sendError with commited buffer ", new Throwable("Trace"));
      throw new IllegalStateException(sm.
              getString("hsrf.error.ise"));
  }

  //   if (sc != HttpServletResponse.SC_UNAUTHORIZED)  // CRM: FIXME
View Full Code Here

      if( dep!=null && ! dep.isExpired() ) {
    // if the jspfile is older than the class - we're ok
    return 0;
      }

      Context ctx=req.getContext();
     
      // Mangle the names - expensive operation, but nothing
      // compared with a compilation :-)
      JasperMangler mangler=
    new JasperMangler(ctx.getWorkDir().getAbsolutePath(),
             ctx.getAbsolutePath(),
             jspFile );


            // If unsafe path or JSP file doesn't exist, return "not found"
            // Avoids creating work directories for non-existent JSP files
            String path=mangler.getJspFilePath();
            if( path == null )
                return 404;
            File f = new File( path );
            if( !f.exists() )
                return 404;
      // register the handler as dependent on the jspfile
      if( dep==null ) {
    dep=setDependency( ctx, mangler, handler );
                // if dep is null then path is unsafe, return "not found"
                if( dep == null ) {
                    return 404;
                }
               
    // update the servlet class name
    handler.setServletClassName( mangler.getServletClassName() );

    // check again - maybe we just found a compiled class from
    // a previous run
    if( ! dep.isExpired() )
        return 0;
      }

      //      if( debug > 3)
      ctx.log( "Compiling: " + jspFile + " to " +
         mangler.getServletClassName());
     
      //XXX old servlet -  destroy();
     
      // jump version number - the file needs to be recompiled
      // reset the handler error, un-initialize the servlet
      handler.setErrorException( null );
      handler.setState( Handler.STATE_ADDED );
     
      // Move to the next class name
      mangler.nextVersion();

      // record time of attempted translate-and-compile
      // if the compilation fails, we'll not try again
      // until the jsp file changes
      dep.setLastModified( System.currentTimeMillis() );

      // Update the class name in wrapper
      if( debug> 1 )
    log.log( "Update class Name " + mangler.getServletClassName());
      handler.setServletClassName( mangler.getServletClassName() );

      // May be called from include, we need to set the context class
            // loader
      // for jaxp1.1 to work using the container class loader
            //Extra test/warnings for tools.jar

            ClassLoader savedContextCL= containerCCL( ctx.getContextManager()
                                                  .getContainerLoader() );

            if( useWebAppCL ) {
                try {
                    ctx.getClassLoader().loadClass( "sun.tools.javac.Main" );
                    if(debug>0) log.log( "Found javac using context loader");
                } catch( ClassNotFoundException ex ) {
                    if(debug>0) log.log( "javac not found using context loader");
                }

                try {
                    ctx.getContextManager().getContainerLoader().
                        loadClass( "sun.tools.javac.Main" );
                    if( debug > 0 )
                        log.log( "Found javac using container loader");
                } catch( ClassNotFoundException ex ) {
                    if( debug > 0 )
                        log.log( "javac not found using container loader");
                }
            }

      try {
    Options options=new JasperOptionsImpl(args);
    JspCompilationContext ctxt=createCompilationContext(req,
                    jspFile,
                    options,
                    mangler);
    jsp2java( mangler, ctxt );

    javac( req, options, ctxt, mangler );
     
    if(debug>0)log.log( "Generated " +
            mangler.getClassFileName() );
            } catch ( java.io.FileNotFoundException fnfex ){
    containerCCL( savedContextCL );
    return 404;
      } catch( Exception ex ) {
    if( ctx!=null )
        ctx.log("compile error: req="+req, ex);
    else
        log.log("compile error: req="+req, ex);
    handler.setErrorException(ex);
    handler.setState(Handler.STATE_DISABLED);
    // until the jsp cahnges, when it'll be enabled again
View Full Code Here

      xh.addRule("web-app/servlet", new XmlAction() {
         public void end( SaxContext xctx)
             throws Exception {
             ServletInfo sw=(ServletInfo)
           xctx.currentObject();
             Context cctx=(Context)xctx.previousObject();
             sw.addServlet(cctx, wxr);
         }
           }
       );
      // remove it from stack when done
View Full Code Here

    }
    public void end( SaxContext ctx) throws Exception {
  Stack st=ctx.getObjectStack();
  String tag=ctx.getTag(ctx.getTagCount()-1);
  SecurityConstraint sc=(SecurityConstraint)st.pop();
  Context context=(Context)st.peek();

  st.push( sc ); // restore stack
  // add all patterns that will need security

  String roles[]=sc.getRoles();
  String transport=sc.getTransport();
  Enumeration en=sc.getResourceCollections();
  while( en.hasMoreElements()) {
      ResourceCollection rc=(ResourceCollection)en.nextElement();
      String paths[]=rc.getPatterns();
      String meths[]=rc.getMethods();
      context.addSecurityConstraintpaths, meths ,
              roles, transport);
  }
    }
View Full Code Here

  return s;
    }

    public String addContext() {
  if ((addContextPath != null) && (addContextDocBase != null)) {
            Context context = new Context();
            context.setContextManager(cm);
            context.setPath(addContextPath);
            context.setDocBase(addContextDocBase);

      try {
                cm.addContext(context);
                cm.initContext(context);
      }
View Full Code Here

  return s;
    }

    public String addContext() {
  if ((addContextPath != null) && (addContextDocBase != null)) {
            Context context = new Context();
            context.setContextManager(cm);
            context.setPath(addContextPath);
            context.setDocBase(addContextDocBase);

      try {
                cm.addContext(context);
                cm.initContext(context);
      }
View Full Code Here

    this.handleQCInformation();

    this.ncFile.addAttribute( null, qcFlagsAtt );

    // Add some general metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "title",
                                                   new StringBuffer("NGDC archived ")
                                                   .append( datasetIdAtt.getStringValue())
                                                   .append( " data with start time ")
                                                   .append( startDateAtt.getStringValue())
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "Convention", _Coordinate.Convention));

    // Add some THREDDS specific metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "thredds_creator", "DOD/USAF/SMC > Space and Missile Systems Center (SMC), U.S. Air Force, U.S. Department of Defense"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor_role", "archive"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_url", "http://dmsp.ngdc.noaa.gov/"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_email", "ngdc.dmsp@noaa.gov"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_summary",
                                                   new StringBuffer("This dataset contains data from the DMSP ").append( spacecraftIdAtt.getStringValue())
                                                   .append( " satellite OLS instrument and includes both visible smooth and thermal smooth imagery with 2.7km resolution.")
                                                   .append( " The start time for this data is ").append( startDateAtt.getStringValue())
                                                   .append( " and the northerly equatorial crossing longitude is ").append( startLongitudeAtt.getNumericValue())
                                                   .append( ".  The DMSP satellite is a polar-orbiting satellite crossing the equator, depending on the satellite, at either dawn/dusk or noon/midnight.")
                                                   .append( " This data is in the NOAA/NGDC DMSP archive format.")
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_history", ""));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_start", startDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_end", endDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_geospatialCoverage",
                                                   new StringBuffer("Polar orbit with northerly equatorial crossing at longitude ")
                                                   .append( ascendingNodeAtt.getNumericValue()).append( ".")
                                                   .toString()));

View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleFileInformation()
          throws IOException
  {
    fileIdAtt = new Attribute( this.fileIdAttName,
                               (String) headerInfo.get( HeaderInfoTitle.FILE_ID.toString() ) );
    datasetIdAtt = new Attribute( this.datasetIdAttName,
                                  (String) headerInfo.get( HeaderInfoTitle.DATA_SET_ID.toString() ) );
    recordSizeInBytes = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.RECORD_BYTES.toString() ) );
    numRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_RECORDS.toString() ) );
    numHeaderRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_HEADER_RECORDS.toString() ) );
    numDataRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_DATA_RECORDS.toString() ) );
View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleProcessingInformation()
          throws IOException
  {
    suborbitHistoryAtt = new Attribute( this.suborbitHistoryAttName,
                                        (String) headerInfo.get( HeaderInfoTitle.SUBORBIT_HISTORY.toString() ) );
    processingSystemAtt = new Attribute( this.processingSystemAttName,
                                         (String) headerInfo.get( HeaderInfoTitle.PROCESSING_SYSTEM.toString() ) );
    String processingDateString = (String) headerInfo.get( HeaderInfoTitle.PROCESSING_DATE.toString() );
    try
    {
      processingDate = DateFormatHandler.ALT_DATE_TIME.getDateFromDateTimeString( processingDateString );
    }
    catch ( ParseException e )
    {
      throw new IOException( "Invalid DMSP file: processing date string <" + processingDateString + "> not parseable: " + e.getMessage() );
    }
    processingDateAtt = new Attribute(
            this.processingDateAttName,
            DateFormatHandler.ISO_DATE_TIME.getDateTimeStringFromDate( processingDate ) );
  }
View Full Code Here

TOP

Related Classes of org.apache.tomcat.core.Context$Attribute$WorkDir

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.