org.apache.catalina.manager

Class HTMLManagerServlet

public final class HTMLManagerServlet extends ManagerServlet

Servlet that enables remote management of the web applications deployed within the same virtual host as this web application is. Normally, this functionality will be protected by a security constraint in the web application deployment descriptor. However, this requirement can be relaxed during testing.

The difference between the ManagerServlet and this Servlet is that this Servlet prints out a HTML interface which makes it easier to administrate.

However if you use a software that parses the output of ManagerServlet you won't be able to upgrade to this Servlet since the output are not in the same format ar from ManagerServlet

Version: $Revision: 895212 $, $Date: 2010-01-02 16:53:43 +0100 (Sat, 02 Jan 2010) $

Author: Bip Thelin Malcolm Edgar Glenn L. Nielsen

See Also: ManagerServlet

Field Summary
protected static StringAPPLICATION_ERROR
protected static StringAPPLICATION_MESSAGE
protected StringsessionDetailJspPath
protected StringsessionsListJspPath
protected static URLEncoderURL_ENCODER
Method Summary
protected StringdeployInternal(String config, String path, String war)
Deploy an application for the specified path from the specified web application archive.
protected voiddisplaySessionDetailPage(HttpServletRequest req, HttpServletResponse resp, String path, String sessionId)
protected voiddisplaySessionsListPage(String path, HttpServletRequest req, HttpServletResponse resp)
voiddoGet(HttpServletRequest request, HttpServletResponse response)
Process a GET request for the specified resource.
voiddoPost(HttpServletRequest request, HttpServletResponse response)
Process a POST request for the specified resource.
protected voiddoSessions(String path, HttpServletRequest req, HttpServletResponse resp)
protected StringexpireSessions(String path, HttpServletRequest req)
Extract the expiration request parameter
protected ComparatorgetComparator(String sortBy)
StringgetServletInfo()
protected SessiongetSessionForPathAndId(String path, String id)
protected Session[]getSessionsForPath(String path)
voidinit()
intinvalidateSessions(String path, String[] sessionIds)
Invalidate HttpSessions
voidlist(HttpServletRequest request, HttpServletResponse response, String message)
Render a HTML list of the currently active Contexts in our virtual host, and memory and server status information.
protected Stringreload(String path)
Reload the web application at the specified context path.
booleanremoveSessionAttribute(String path, String sessionId, String attributeName)
Removes an attribute from an HttpSession
Stringsessions(String path, int idle)
Display session information and invoke list.
Stringsessions(String path)
Display session information and invoke list.
intsetSessionMaxInactiveInterval(String path, String sessionId, int maxInactiveInterval)
Sets the maximum inactive interval (session timeout) an HttpSession
Stringstart(String path)
Start the web application at the specified context path.
protected Stringstop(String path)
Stop the web application at the specified context path.
protected Stringundeploy(String path)
Undeploy the web application at the specified context path.

Field Detail

APPLICATION_ERROR

protected static final String APPLICATION_ERROR

APPLICATION_MESSAGE

protected static final String APPLICATION_MESSAGE

sessionDetailJspPath

protected String sessionDetailJspPath

sessionsListJspPath

protected String sessionsListJspPath

URL_ENCODER

protected static final URLEncoder URL_ENCODER

Method Detail

deployInternal

protected String deployInternal(String config, String path, String war)
Deploy an application for the specified path from the specified web application archive.

Parameters: config URL of the context configuration file to be deployed path Context path of the application to be deployed war URL of the web application archive to be deployed

Returns: message String

displaySessionDetailPage

protected void displaySessionDetailPage(HttpServletRequest req, HttpServletResponse resp, String path, String sessionId)

Parameters: req resp

Throws: ServletException IOException

displaySessionsListPage

protected void displaySessionsListPage(String path, HttpServletRequest req, HttpServletResponse resp)

Parameters: req resp

Throws: ServletException IOException

doGet

public void doGet(HttpServletRequest request, HttpServletResponse response)
Process a GET request for the specified resource.

Parameters: request The servlet request we are processing response The servlet response we are creating

Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs

doPost

public void doPost(HttpServletRequest request, HttpServletResponse response)
Process a POST request for the specified resource.

Parameters: request The servlet request we are processing response The servlet response we are creating

Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs

doSessions

protected void doSessions(String path, HttpServletRequest req, HttpServletResponse resp)

Parameters: req resp

Throws: ServletException IOException

expireSessions

protected String expireSessions(String path, HttpServletRequest req)
Extract the expiration request parameter

Parameters: path req

getComparator

protected Comparator getComparator(String sortBy)

getServletInfo

public String getServletInfo()

See Also: javax.servlet.Servlet#getServletInfo()

getSessionForPathAndId

protected Session getSessionForPathAndId(String path, String id)

getSessionsForPath

protected Session[] getSessionsForPath(String path)

init

public void init()

See Also: javax.servlet.GenericServlet#init()

invalidateSessions

public int invalidateSessions(String path, String[] sessionIds)
Invalidate HttpSessions

Parameters: sessionIds

Returns: number of invalidated sessions

Throws: IOException

list

public void list(HttpServletRequest request, HttpServletResponse response, String message)
Render a HTML list of the currently active Contexts in our virtual host, and memory and server status information.

Parameters: request The request response The response message a message to display

reload

protected String reload(String path)
Reload the web application at the specified context path.

Parameters: path Context path of the application to be restarted

Returns: message String

See Also:

removeSessionAttribute

public boolean removeSessionAttribute(String path, String sessionId, String attributeName)
Removes an attribute from an HttpSession

Parameters: sessionId attributeName

Returns: true if there was an attribute removed, false otherwise

Throws: IOException

sessions

public String sessions(String path, int idle)
Display session information and invoke list.

Parameters: path Context path of the application to list session information idle Expire all sessions with idle time ≥ idle for this context

Returns: message String

See Also:

sessions

public String sessions(String path)
Display session information and invoke list.

Parameters: path Context path of the application to list session information

Returns: message String

See Also:

setSessionMaxInactiveInterval

public int setSessionMaxInactiveInterval(String path, String sessionId, int maxInactiveInterval)
Sets the maximum inactive interval (session timeout) an HttpSession

Parameters: sessionId maxInactiveInterval in seconds

Returns: old value for maxInactiveInterval

Throws: IOException

start

public String start(String path)
Start the web application at the specified context path.

Parameters: path Context path of the application to be started

Returns: message String

See Also:

stop

protected String stop(String path)
Stop the web application at the specified context path.

Parameters: path Context path of the application to be stopped

Returns: message String

See Also:

undeploy

protected String undeploy(String path)
Undeploy the web application at the specified context path.

Parameters: path Context path of the application to be undeployd

Returns: message String

See Also:

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.