Author: tyrell Date: Fri Jan 4 09:07:40 2008 New Revision: 11853 Log:
Adding server log reader. Added: trunk/mashup/java/modules/www/log_reader.jsp Modified: trunk/mashup/java/modules/www/stub_gen.jsp Added: trunk/mashup/java/modules/www/log_reader.jsp ============================================================================== --- (empty file) +++ trunk/mashup/java/modules/www/log_reader.jsp Fri Jan 4 09:07:40 2008 @@ -0,0 +1,94 @@ +<%-- + * Copyright 2006,2007 WSO2, Inc. http://www.wso2.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--%> +<%@ page errorPage="error.jsp" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %> +<%@ page import="org.wso2.registry.Registry" %> +<%@ page import="java.io.BufferedReader" %> +<%@ page import="java.io.FileReader" %> +<%@ page import="java.net.URLDecoder" %> +<%@ page import="org.wso2.wsas.ServerManager" %> +<%@ page import="org.apache.axis2.context.ConfigurationContext" %> +<% + + Registry registry = RegistryUtils.getRegistry(request); + String bounceback = request.getParameter("bounceback"); + + if (bounceback == null) { + bounceback = "index.jsp"; + } else { + bounceback = URLDecoder.decode(bounceback, "UTF-8"); + } + +%> +<html> +<head> + <title>Log Reader</title> + <!-- Required CSS --> + <link href="css/styles.css" rel="stylesheet" type="text/css"/> + <script language="javascript" src="js/common.js" type="text/javascript"></script> + <script language="javascript" + type="text/javascript">userLoggedOn = <%=RegistryUtils.isLoggedIn(registry) %>;</script> +</head> +<body> +<div id="page"> + <% String thisPage = "log_reader.jsp"; %> + <%@ include file="header.jsp" %> + <div id="search"></div> + <div id="welcome"> + </div> + <div id="content"> + <h1>Mashup Server Log Viewer</h1> + + <% + //Looks like isAdmin role is not getting set properly + boolean priviledged = false; + if (priviledged) { + + ServerManager serverManager = ServerManager.getInstance(); + ConfigurationContext configContext = serverManager.configContext; + + String logFilePath = + configContext.getRealPath(configContext.getContextRoot()) + + "/logs/mashup.out"; + + StringBuffer fileData = new StringBuffer(1000); + BufferedReader reader = new BufferedReader(new FileReader(logFilePath)); + char[] buf = new char[1024]; + int numRead = 0; + while ((numRead = reader.read(buf)) != -1) { + fileData.append(buf, 0, numRead); + } + reader.close(); + %> + + <textarea style="width:100%;height:70%"><%=fileData.toString()%> + </textarea> + + <% + } else { + %> + + <h2>Sorry. You are not authorized to view server logs.</h2> + + <% } + + %> + </div> + <%@ include file="footer.jsp" %> +</div> +</body> +</html> \ No newline at end of file Modified: trunk/mashup/java/modules/www/stub_gen.jsp ============================================================================== --- trunk/mashup/java/modules/www/stub_gen.jsp (original) +++ trunk/mashup/java/modules/www/stub_gen.jsp Fri Jan 4 09:07:40 2008 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. --%> -<%@ page isErrorPage="true" %> +<%@ page errorPage="error.jsp" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="com.sun.syndication.feed.synd.SyndContent" %> <%@ page import="com.sun.syndication.feed.synd.SyndContentImpl" %> _______________________________________________ Mashup-dev mailing list [email protected] http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
