Examples of Table


Examples of org.modeshape.jcr.query.validate.Schemata.Table

    @Test
    public void shouldBuildSchemaForSingleTableWithDefaultTypeForColumns() {
        builder.addTable("t1", "c1", "c2", "c3");
        schemata = builder.build();
        Table table = schemata.getTable(selector("t1"));
        assertThat(table, is(notNullValue()));
        assertThat(table.getColumn("c1").getPropertyTypeName(), is(STRING_TYPE));
        assertThat(table.getColumn("c2").getPropertyTypeName(), is(STRING_TYPE));
        assertThat(table.getColumn("c3").getPropertyTypeName(), is(STRING_TYPE));
    }
View Full Code Here

Examples of org.nocrala.tools.texttablefmt.Table

        private void list() {
            List<ExchangeFarm.ExchangeInfo> exchanges = ExchangeFarm.getAllExchanges();
            myConsole.logResponse("%d exchanges%n", exchanges.size());
            if(exchanges.size() > 0) {
                Table tab = new Table(3);
                tab.addCell("Exchange");
                tab.addCell("Host");
                tab.addCell("Clients");
                for(ExchangeFarm.ExchangeInfo info: exchanges) {
                    tab.addCell(info.name);
                    tab.addCell(info.host);
                    tab.addCell(String.valueOf(info.refCount), numberStyle);
                }
                myConsole.logResponseNL(tab.render());
            }

            try {
                Table tab = new Table(3);
                tab.addCell("Exchange");
                tab.addCell("Config. Type");
                tab.addCell("Remark");
               
                List<String> fixed_ex = new ZNode(ZNODE_FIXED).getChildren();
                for(String name: fixed_ex) {
                    ZooKeeperInfo.Exchange.Builder builder = ZooKeeperInfo.Exchange.newBuilder();
                    TextFormat.merge(new String(new ZNode(ZNODE_FIXED + "/" + name).getContent()), builder);
                    tab.addCell("{queue,topic}:" + name);
                    tab.addCell("Fixed", new CellStyle(HorizontalAlign.center));
                    tab.addCell(builder.build().getHost());
                }
               
                List<String> drop_ex = new ZNode(ZNODE_DROP).getChildren();
                for(String name : drop_ex) {
                    ZooKeeperInfo.DropConfig.Builder drop_builder = ZooKeeperInfo.DropConfig.newBuilder();
                    TextFormat.merge(new String(new ZNode(ZNODE_DROP + "/" + name).getContent()), drop_builder);
                    tab.addCell(name);
                    tab.addCell("Drop Polocy", new CellStyle(HorizontalAlign.center));
                    tab.addCell(drop_builder.build().getPolicy() == DropConfig.Policy.NEWEST ? "newest": "oldest");
                }
               
                List<String> limit_ex = new ZNode(ZNODE_LIMIT).getChildren();
                for(String name : limit_ex) {
                    ZooKeeperInfo.TotalLimit.Builder limit_builder = ZooKeeperInfo.TotalLimit.newBuilder();
                    TextFormat.merge(new String(new ZNode(ZNODE_LIMIT + "/" + name).getContent()), limit_builder);
                    tab.addCell(name);
                    tab.addCell("Maximum limit", new CellStyle(HorizontalAlign.center));
                    ZooKeeperInfo.TotalLimit limit = limit_builder.build();
                    tab.addCell(String.format("%d bytes / %d messages", limit.getSizeBytes(), limit.getCount()));
                }

                List<String> alert_limit_ex = new ZNode(ZNODE_ALERT_LIMIT).getChildren();
                for(String name : alert_limit_ex) {
                    ZooKeeperInfo.AlertConfig.Builder alert_limit_builder = ZooKeeperInfo.AlertConfig.newBuilder();
                    TextFormat.merge(new ZNode(ZNODE_ALERT_LIMIT + "/" + name).getContentString(), alert_limit_builder);
                    ZooKeeperInfo.AlertConfig alertConfig = alert_limit_builder.build();
                    tab.addCell(name);
                    tab.addCell("Alert limit", new CellStyle(HorizontalAlign.center));
                    tab.addCell(String.format("%d messages to %s", alertConfig.getCount(), alertConfig.getReceiver()));
                }

                myConsole.logResponse("%d configured exchanges%n", fixed_ex.size() + drop_ex.size() + limit_ex.size());
                if(fixed_ex.size() + drop_ex.size() + limit_ex.size() > 0)
                    myConsole.logResponseNL(tab.render());
            }
            catch(Exception e) {
                myConsole.logResponseNL(e.getMessage());
            }
        }
View Full Code Here

Examples of org.nutz.dao.entity.annotation.Table

  private static final Log log = Logs.getLog(ConventionEntityMaker.class);
 
  public Entity<?> make(DatabaseMeta db, Connection conn, Class<?> type) {
    //先判断是否有注解
    String tableName=null;
    Table tableAnnotation=type.getAnnotation(Table.class);
    if(tableAnnotation==null){//如果有table标签
      tableName=this.getOrmRule().class2TableName(type.getSimpleName());
    }else{
      tableName=tableAnnotation.value();
    }
    String viewName=null;
    View viewAnnotation=type.getAnnotation(View.class);
    if(viewAnnotation==null&&tableAnnotation==null){//如果有view标签
      viewName=this.getOrmRule().class2TableName(type.getSimpleName());
    }else if(tableAnnotation!=null){
      viewName=tableAnnotation.value();
    }else{
      viewName=viewAnnotation.value();
    }
//    得到表结构
    MyTable table=CollectData.getTableByTableName(tableName, conn,false);
View Full Code Here

Examples of org.objectstyle.ashwood.dbutil.Table

        dbEntityToTableMap = new HashMap<DbEntity, Table>(64);
        reflexiveDbEntities = new HashMap<DbEntity, List<DbRelationship>>(32);

        for (DataMap map : dataMaps) {
            for (DbEntity entity : map.getDbEntities()) {
                Table table = new Table(entity.getCatalog(), entity.getSchema(), entity
                        .getName());
                fillInMetadata(table, entity);
                dbEntityToTableMap.put(entity, table);
                tables.add(table);
            }
View Full Code Here

Examples of org.odftoolkit.simple.table.Table

        return join(lines, System.getProperty("line.separator"));
    }

    private static Collection<String> parseTable(Node item) {
        ArrayList<String> lines = new ArrayList<String>();
        Table table = Table.getInstance((TableTableElement) item);
        for (Row row : table.getRowList()) {
            lines.add(parseTableRow(row));
        }
        return lines;
    }
View Full Code Here

Examples of org.ofbiz.sql.Table

                    "one"new FieldDef(new MathValue("||", list(new FieldValue("a", "partyId"), new StringValue("-"), new FieldValue("a", "partyTypeId"))), "one"),
                    "cnt1", new FieldDef(new AggregateFunction("COUNT", false, new FieldValue("a", "partyId")), "cnt1"),
                    "cnt2", new FieldDef(new AggregateFunction("COUNT", false, new FieldValue(null, "partyId")), "cnt2"),
                    "cnt3", new FieldDef(new AggregateFunction("COUNT", true, new FieldValue("a", "partyId")), "cnt3")
                ),
                new Table(
                    new TableName("Party", "a"),
                    new Joined(true, new TableName("Person", "b"), list(new KeyMap("partyId", "partyId")),
                        new Joined(true, new TableName("PartyGroup", "c"), list(new KeyMap("partyId", "partyId")),
                            new Joined(false, new TableName("PartyRole", "d"), list(new KeyMap("partyId", "partyId"), new KeyMap("partyId", "partyId")))
                        )
                    )
                ),
                GenericTestCaseBase.<String, Relation>map(
                    "MainAPerson", new Relation("one", "MainA", "Person", list(new KeyMap("partyId", "partyId"))),
                    "MainBPerson", new Relation(null, "MainB", "Person", list(new KeyMap("partyId", "partyId"))),
                    "Person", new Relation("one", null, "Person", list(new KeyMap("partyId", "partyId"))),
                    "PartyGroup", new Relation(null, null, "PartyGroup", list(new KeyMap("partyId", "partyId")))
                ),
                new ConditionList(
                    Joiner.OR,
                    GenericTestCaseBase.<Condition>list(
                        new ConditionList(
                            Joiner.AND,
                            list(
                                new BooleanCondition(new FieldValue("a", "partyTypeId"), "=", new StringValue("PERSON")),
                                new BooleanCondition(new FieldValue("b", "lastName"), "LIKE", new ParameterValue("lastName")),
                                new BetweenCondition(new FieldValue("b", "birthDate"), new StringValue("1974-12-01"), new StringValue("1974-12-31"))
                            )
                        ),
                        new ConditionList(
                            Joiner.AND,
                            list(
                                new ListCondition(new FieldValue("b", "partyId"), "IN", GenericTestCaseBase.<Value>list(
                                    new StringValue("1"),
                                    new StringValue("2"),
                                    new StringValue("3"),
                                    new StringValue("4")
                                )),
                                new BooleanCondition(new FieldValue("b", "gender"), "=", new StringValue("M"))
                            )
                        )
                    )
                ),
                new BooleanCondition(new FieldValue("b", "firstName"), "LIKE", new StringValue("%foo%")),
                null,
                list(
                    new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, new FunctionCall("LOWER", GenericTestCaseBase.<Value>list(new FieldValue(null, "lastName")))),
                    new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, new FieldValue(null, "firstName")),
                    new OrderByItem(OrderByItem.Order.DESCENDING, OrderByItem.Nulls.DEFAULT, new FieldValue(null, "birthDate"))
                ),
                5,
                10
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("firstSelect", select, stmt);
            assertEquals("firstSelect:parse", parser(select).SelectStatement(), parser(stmt).SelectStatement());
        }
        {
            SQLInsert insert = new SQLInsert(
                new TableName("Party", null),
                new InsertValues(
                    list(
                        new InsertRow(GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("PERSON"), new StringValue("PARTY_DISABLED"))),
                        new InsertRow(list(new NumberValue<Integer>(Integer.valueOf(5)), new StringValue("PARTY_GROUP"), new ParameterValue("name")))
                    )
                ),
                list("partyId", "partyTypeId", "statusId")
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("firstInsert", insert, stmt);
            assertEquals("firstInsert:parse", parser(insert).InsertStatement(), parser(stmt).InsertStatement());
        }
        {
            SQLInsert insert = new SQLInsert(
                new TableName("Person", null),
                new SQLSelect(
                    false,
                    null,
                    GenericTestCaseBase.<String, FieldDef>map(
                        "partyId", new FieldDef(new FieldValue(null, "partyId"), null),
                        "firstName"new FieldDef(new MathValue("||", list(new FieldValue(null, "partyId"), new StringValue("-auto"))), "firstName")
                    ),
                    new Table(new TableName("Party", null), null),
                    null,
                    new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b"))),
                    null,
                    null,
                    null,
                    -1,
                    -1
                ),
                list("partyId", "firstName")
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("secondInsert", insert, stmt);
            assertEquals("secondInsert:parse", parser(insert).InsertStatement(), parser(stmt).InsertStatement());
        }
        {
            SQLUpdate update = new SQLUpdate(
                new Table(new TableName("Person", null), null),
                list(
                    new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId"))))
                ),
                new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("firstUpdate", update, stmt);
            assertEquals("firstUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
        }
        {
            SQLUpdate update = new SQLUpdate(
                new Table(new TableName("Person", null), null),
                list(
                    new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId")))),
                    new SetField("height", new NumberValue<Integer>(Integer.valueOf(5))),
                    new SetField("width", new NumberValue<Integer>(Integer.valueOf(7)))
                ),
                new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("secondUpdate", update, stmt);
            assertEquals("secondUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
        }
        {
            SQLUpdate update = new SQLUpdate(
                new Table(new TableName("Person", null), null),
                list(
                    new SetField("lastName", new MathValue("||", list(new StringValue("auto-"), new FieldValue(null, "partyId")))),
                    new SetField("height", new NumberValue<Integer>(Integer.valueOf(6))),
                    new SetField("width", new NumberValue<Integer>(Integer.valueOf(5))),
                    new SetField("nickname", new StringValue("a"))
                ),
                new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("thirdUpdate", update, stmt);
            assertEquals("thirdUpdate:parse", parser(update).UpdateStatement(), parser(stmt).UpdateStatement());
        }
        {
            SQLDelete delete = new SQLDelete(
                new Table(new TableName("Person", null), null),
                new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("firstDelete", delete, stmt);
            assertEquals("firstDelete:parse", parser(delete).DeleteStatement(), parser(stmt).DeleteStatement());
        }
        {
            SQLDelete delete = new SQLDelete(
                new Table(new TableName("Party", null), null),
                new ListCondition(new FieldValue(null, "partyId"), "IN", GenericTestCaseBase.<Value>list(new StringValue("a"), new StringValue("b")))
            );
            SQLStatement<?> stmt = stmtIt.next();
            assertEquals("secondDelete", delete, stmt);
            assertEquals("secondDelete:parse", parser(delete).DeleteStatement(), parser(stmt).DeleteStatement());
        }
        {
            SQLView view = new SQLView(
                "viewOne",
                new SQLSelect(
                    false,
                    list(new FieldAll("a", Collections.<String>emptySet())),
                    null,
                    new Table(new TableName("Party", "a"), null),
                    null,
                    null,
                    null,
                    null,
                    null,
View Full Code Here

Examples of org.openbravo.model.ad.datamodel.Table

    String parentObjectId = vars.getStringParameter("parentObjectId");
    if (parentObjectId == null || parentObjectId.equals("")) {
      boolean adminMode = OBContext.getOBContext().setInAdministratorMode(true);
      try {
        Table table = OBDal.getInstance().get(Table.class, vars.getStringParameter("inpTableId"));
        List<Column> cols = table.getADColumnList();
        String keyCol = "";
        for (Column col : cols) {
          if (col.isKeyColumn()) {
            keyCol = col.getDBColumnName();
            break;
          }
        }
        parentObjectId = vars.getStringParameter("inp" + Sqlc.TransformaNombreColumna(keyCol));
      } finally {
        OBContext.getOBContext().setInAdministratorMode(adminMode);
      }
    }
    if (vars.commandIn("DEFAULT")) {

      printPageFrame(response, vars, imageID, tableId, columnName, parentObjectId);
    } else if (vars.commandIn("SAVE")) {
      final FileItem fi = vars.getMultiFile("inpFile");
      byte[] bytea = fi.get();

      // Using DAL to write the image data to the database
      Image image;
      if (imageID == null || imageID.equals("")) {
        image = OBProvider.getInstance().get(Image.class);
        image.setBindaryData(bytea);
        image.setActive(true);
        image.setName("Image");
        OBDal.getInstance().save(image);
        OBDal.getInstance().flush();

      } else {
        image = OBDal.getInstance().get(Image.class, imageID);
        image.setActive(true);
        image.setBindaryData(bytea);
        OBDal.getInstance().flush();
      }
      response.setContentType("text/html; charset=UTF-8");
      PrintWriter writer = response.getWriter();
      writeRedirect(writer, image.getId(), columnName);
    } else if (vars.commandIn("DELETE")) {
      if (imageID != null && !imageID.equals("")) {
        boolean adminMode = OBContext.getOBContext().setInAdministratorMode(true);
        try {
          Image image = OBDal.getInstance().get(Image.class, imageID);
          Table table = OBDal.getInstance().get(Table.class, tableId);
          String propertyName = ModelProvider.getInstance().getEntityByTableName(
              table.getDBTableName()).getPropertyByColumnName(columnName).getName();
          DataPackage dpackage = table.getDataPackage();
          try {
            Class tableClass = Class.forName(dpackage.getJavaPackage() + "."
                + table.getJavaClassName());
            BaseOBObject parentObject = (BaseOBObject) OBDal.getInstance().get(tableClass,
                parentObjectId);
            parentObject.set(propertyName, null);
            OBDal.getInstance().flush();
            OBDal.getInstance().remove(image);
View Full Code Here

Examples of org.opencustomer.framework.webapp.util.html.Table

    public void preOperation(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        PanelStack stack = Panel.getPanelStack(request);
        if(!stack.isEmpty()) {
            Panel lastPanel = Panel.getPanelStack(request).peek();
            if(lastPanel.getAttribute(ListAction.TABLE_KEY) != null) {
                Table table = (Table)lastPanel.getAttribute(ListAction.TABLE_KEY);
                ListConfigurationVO.Type type = null;
                for(ListConfigurationVO.Type existingType : ListConfigurationVO.Type.values()) {
                    if(existingType.getName().equals(table.getName())) {
                        type = existingType;
                        break;
                    }
                }
               
View Full Code Here

Examples of org.openengsb.core.edbi.jdbc.sql.Table

        if (exists(index)) {
            LOG.debug("Skipping schema creation for {}. Schema exists.", index.getName());
            return;
        }

        Table headTable = headTableEngine.create(index);
        Table histTable = historyTableEngine.create(index);

        index.setHeadTableName(headTable.getName());
        index.setHistoryTableName(histTable.getName());
    }
View Full Code Here

Examples of org.openqa.jetty.html.Table

        {
            page= new Page();
            page.title("Dump Servlet");

            page.add(new Heading(1, "Dump Servlet"));
            Table table= new Table(0).cellPadding(0).cellSpacing(0);
            page.add(table);
            table.newRow();
            table.addHeading("getMethod:&nbsp;").cell().right();
            table.addCell("" + request.getMethod());
            table.newRow();
            table.addHeading("getContentLength:&nbsp;").cell().right();
            table.addCell(Integer.toString(request.getContentLength()));
            table.newRow();
            table.addHeading("getContentType:&nbsp;").cell().right();
            table.addCell("" + request.getContentType());
            table.newRow();
            table.addHeading("getCharacterEncoding:&nbsp;").cell().right();
            table.addCell("" + request.getCharacterEncoding());
            table.newRow();
            table.addHeading("getRequestURI:&nbsp;").cell().right();
            table.addCell("" + request.getRequestURI());
            table.newRow();
            table.addHeading("getRequestURL:&nbsp;").cell().right();
            table.addCell("" + request.getRequestURL());
            table.newRow();
            table.addHeading("getContextPath:&nbsp;").cell().right();
            table.addCell("" + request.getContextPath());
            table.newRow();
            table.addHeading("getServletPath:&nbsp;").cell().right();
            table.addCell("" + request.getServletPath());
            table.newRow();
            table.addHeading("getPathInfo:&nbsp;").cell().right();
            table.addCell("" + request.getPathInfo());
            table.newRow();
            table.addHeading("getPathTranslated:&nbsp;").cell().right();
            table.addCell("" + request.getPathTranslated());
            table.newRow();
            table.addHeading("getQueryString:&nbsp;").cell().right();
            table.addCell("" + request.getQueryString());

            table.newRow();
            table.addHeading("getProtocol:&nbsp;").cell().right();
            table.addCell("" + request.getProtocol());
            table.newRow();
            table.addHeading("getScheme:&nbsp;").cell().right();
            table.addCell("" + request.getScheme());
            table.newRow();
            table.addHeading("getServerName:&nbsp;").cell().right();
            table.addCell("" + request.getServerName());
            table.newRow();
            table.addHeading("getServerPort:&nbsp;").cell().right();
            table.addCell("" + Integer.toString(request.getServerPort()));
            table.newRow();
            table.addHeading("getLocalName:&nbsp;").cell().right();
            table.addCell("" + request.getLocalName());
            table.newRow();
            table.addHeading("getLocalAddr:&nbsp;").cell().right();
            table.addCell("" + request.getLocalAddr());
            table.newRow();
            table.addHeading("getLocalPort:&nbsp;").cell().right();
            table.addCell("" + Integer.toString(request.getLocalPort()));
            table.newRow();
            table.addHeading("getRemoteUser:&nbsp;").cell().right();
            table.addCell("" + request.getRemoteUser());
            table.newRow();
            table.addHeading("getRemoteAddr:&nbsp;").cell().right();
            table.addCell("" + request.getRemoteAddr());
            table.newRow();
            table.addHeading("getRemoteHost:&nbsp;").cell().right();
            table.addCell("" + request.getRemoteHost());
            table.newRow();
            table.addHeading("getRemotePort:&nbsp;").cell().right();
            table.addCell("" + request.getRemotePort());
            table.newRow();
            table.addHeading("getRequestedSessionId:&nbsp;").cell().right();
            table.addCell("" + request.getRequestedSessionId());
            table.newRow();
            table.addHeading("isSecure():&nbsp;").cell().right();
            table.addCell("" + request.isSecure());

            table.newRow();
            table.addHeading("isUserInRole(admin):&nbsp;").cell().right();
            table.addCell("" + request.isUserInRole("admin"));

            table.newRow();
            table.addHeading("getLocale:&nbsp;").cell().right();
            table.addCell("" + request.getLocale());

            Enumeration locales= request.getLocales();
            while (locales.hasMoreElements())
            {
                table.newRow();
                table.addHeading("getLocales:&nbsp;").cell().right();
                table.addCell(locales.nextElement());
            }

            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Other HTTP Headers")
                .attribute("COLSPAN", "2")
                .left();
            Enumeration h= request.getHeaderNames();
            String name;
            while (h.hasMoreElements())
            {
                name= (String)h.nextElement();

                Enumeration h2= request.getHeaders(name);
                while (h2.hasMoreElements())
                {
                    String hv= (String)h2.nextElement();
                    table.newRow();
                    table.addHeading(name + ":&nbsp;").cell().right();
                    table.addCell(hv);
                }
            }

            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Request Parameters")
                .attribute("COLSPAN", "2")
                .left();
            h= request.getParameterNames();
            while (h.hasMoreElements())
            {
                name= (String)h.nextElement();
                table.newRow();
                table.addHeading(name + ":&nbsp;").cell().right();
                table.addCell(request.getParameter(name));
                String[] values= request.getParameterValues(name);
                if (values == null)
                {
                    table.newRow();
                    table.addHeading(name + " Values:&nbsp;").cell().right();
                    table.addCell("NULL!!!!!!!!!");
                }
                else
                    if (values.length > 1)
                    {
                        for (int i= 0; i < values.length; i++)
                        {
                            table.newRow();
                            table.addHeading(name + "[" + i + "]:&nbsp;").cell().right();
                            table.addCell(values[i]);
                        }
                    }
            }

            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Cookies")
                .attribute("COLSPAN", "2")
                .left();
            Cookie[] cookies = request.getCookies();
            for (int i=0; cookies!=null && i<cookies.length;i++)
            {
                Cookie cookie = cookies[i];

                table.newRow();
                table.addHeading(cookie.getName() + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                table.addCell(cookie.getValue());
            }
           
            /* ------------------------------------------------------------ */
            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Request Attributes")
                .attribute("COLSPAN", "2")
                .left();
            Enumeration a= request.getAttributeNames();
            while (a.hasMoreElements())
            {
                name= (String)a.nextElement();
                table.newRow();
                table.addHeading(name + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                table.addCell("<pre>" + toString(request.getAttribute(name)) + "</pre>");
            }           

            /* ------------------------------------------------------------ */
            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Servlet InitParameters")
                .attribute("COLSPAN", "2")
                .left();
            a= getInitParameterNames();
            while (a.hasMoreElements())
            {
                name= (String)a.nextElement();
                table.newRow();
                table.addHeading(name + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                table.addCell("<pre>" + toString(getInitParameter(name)) + "</pre>");
            }

            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Context InitParameters")
                .attribute("COLSPAN", "2")
                .left();
            a= getServletContext().getInitParameterNames();
            while (a.hasMoreElements())
            {
                name= (String)a.nextElement();
                table.newRow();
                table.addHeading(name + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                table.addCell("<pre>" + toString(getServletContext().getInitParameter(name)) + "</pre>");
            }

            table.newRow();
            table
                .newHeading()
                .cell()
                .nest(new Font(2, true))
                .add("<BR>Context Attributes")
                .attribute("COLSPAN", "2")
                .left();
            a= getServletContext().getAttributeNames();
            while (a.hasMoreElements())
            {
                name= (String)a.nextElement();
                table.newRow();
                table.addHeading(name + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                table.addCell("<pre>" + toString(getServletContext().getAttribute(name)) + "</pre>");
            }

            if (request.getContentType() != null
                && request.getContentType().startsWith("multipart/form-data")
                && request.getContentLength() < 1000000)
            {
                MultiPartRequest multi= new MultiPartRequest(request);
                String[] parts= multi.getPartNames();

                table.newRow();
                table
                    .newHeading()
                    .cell()
                    .nest(new Font(2, true))
                    .add("<BR>Multi-part content")
                    .attribute("COLSPAN", "2")
                    .left();
                for (int p= 0; p < parts.length; p++)
                {
                    name= parts[p];
                    table.newRow();
                    table.addHeading(name + ":&nbsp;").cell().attribute("VALIGN", "TOP").right();
                    table.addCell("<pre>" + multi.getString(parts[p]) + "</pre>");
                }
            }

            String res= request.getParameter("resource");
            if (res != null && res.length() > 0)
            {
                table.newRow();
                table
                    .newHeading()
                    .cell()
                    .nest(new Font(2, true))
                    .add("<BR>Get Resource: " + res)
                    .attribute("COLSPAN", "2")
                    .left();

                table.newRow();
                table.addHeading("this.getClass():&nbsp;").cell().right();
                table.addCell("" + this.getClass().getResource(res));

                table.newRow();
                table.addHeading("this.getClass().getClassLoader():&nbsp;").cell().right();
                table.addCell("" + this.getClass().getClassLoader().getResource(res));

                table.newRow();
                table.addHeading("Thread.currentThread().getContextClassLoader():&nbsp;").cell().right();
                table.addCell("" + Thread.currentThread().getContextClassLoader().getResource(res));

                table.newRow();
                table.addHeading("getServletContext():&nbsp;").cell().right();
                try{table.addCell("" + getServletContext().getResource(res));}
                catch(Exception e) {table.addCell("" +e);}
            }
           

            /* ------------------------------------------------------------ */
            page.add(Break.para);
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.