axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Shevland" <joe.shevl...@e-wise.com>
Subject RE: Altering default service page
Date Thu, 16 Jan 2003 23:12:52 GMT
Hi Steve,

Thanks for the advice (I should have thought of that) and it's worked
well - I've just subclassed AxisServlet at this stage and have
overridden the doGet() method. I'm checking for an empty or null query
string, and when found I'm redirecting to a URL based on the name of the
service being called (obtained from getRequestURI()).

Cheers,
Joe

PS. The code is trivial but in case someone needs it down the track:

    public void doGet(HttpServletRequest request, HttpServletResponse
response)
        throws IOException, ServletException {

        // Test for an empty query string, if found redirect the
user/app to
        // a documentation page, or forward the request on to the
superclass
        // for valid service requests.        
        String queryString = request.getQueryString();
        if (queryString == null || ("").equals(queryString)) {
            // Display documentation for the web service in question, by
obtaining
            // the context path, URI and service name.
            String contextPath =
                request.getContextPath();
            String requestURI =
                request.getRequestURI();
            String serviceName = requestURI.substring(
                requestURI.lastIndexOf("/")+1);
            response.sendRedirect(
 
request.getContextPath()+"/webdocs/"+serviceName+".jsp");
        } else {
            // Let the superclass handle anything other than an empty
GET request
            super.doGet(request,response);   
        }
    }

> > (Sorry if this is a duplicate, I don't think the original made it 
> > because of my sending address).
> >
> > Hi,
> >
> > I was wondering if it is possible to change the default page ('Hi 
> > there, this is an Axis service!') that is served when you access an 
> > Axis service endpoint w/o supplying parameters?
> >
> > I've searched the latest CVS source code for those words 
> but haven't 
> > managed to find them (odd, is it gone in HEAD?).
> 
> Its a string kept in resource.properties under axis.i18n.
> 
> > Ultimately I'd like to display some HTML documentation about the 
> > service when accessed with a simple HTTP GET.
> 
> I recommend
> (a) subclassing AxisServlet to redirect to an html/jsp page. 
> There are various reportXXX methods which report the various 
> things. * Use the latest CVS source, not older versions* as 
> things change.
> 
> or
> 
> (b) modifying Axis so that the current (or subclassed) 
> servlet can take an html_description property from a web 
> service and display that string.
> 
> Although it would seem 'better' to have axis redir every 
> variant on GET to a JSP page with the appropriate properties 
> set up, we dont want to rely on jsp support in the web 
> engine, hence the current hard coding



Mime
View raw message