> ServletContext.getResourceAsStream(String)
>
> Shouldn't this be able to throw IOException? What should
> this function do if it was not able to open a stream to the
> URL? Return null?
Return null.
> ServletContext.getAttribute(String, Object)
>
> I assume the intention is that existing attributes should be
> overwritten. If this is the case, this behavior should be
> specified.
Agreed, assuming you mean setAttribute.
> ServletContext.removeAttribute(String)
>
> What should this function do if the attribute is not there?
> As it stands there is no way for the caller to be notified.
> It could throw, or since it currently returns void, why not
> change it to return a boolean. true on success and false if
> not found. The caller could still ignore the return.
If it's not there, it should do nothing.
As for boolean, I'd prefer to return the Object being removed, or null
if there wasn't one. That's the Hashtable model. And setAttribute()
could return the Object replaced. I personally would vote against this
change because the behavior is not often needed, already possible today
via a sequence of two calls, would require a spec change, and gets into
the nasty realm of changing a method's return type which can cause odd
binary compatibility problems.
> ServletRequest.getReader()
>
> What if the request did not contain a body? Should this
> funtion return null? Or should it throw an exception?
> IllegalStateException doesn't seem to be the right thing.
Returns a reader that returns -1 to all reads.
> ServletRequest.setAttribute(String, Object)
>
> It seems that the obvious implementation is to use a
> Hashtable for the attributes. But Hashtables don't allow
> null values. What should happen if the value passed in is
> null? Does a conforming implemenation have to support it?
> Also, why is there no corresponding removeAttribute()
> method?
I say you do what you want. NullPointerEx is fine, as it's what you
get trying to put null into a hash. I forget the reasoning for no
removeAttribute().
> HttpServletRequest.getAuthType()
>
> What if there is not authentication scheme in the request?
> Should this function return null or an empty string or
> something else?
null. Spec could use tightening here.
> HttpServletResponse.sendError(...)
> HttpServletResponse.sendRedirect(...)
>
> The last sentence of the descriptions to each is:
>
> No further output should be made by the servlet after
> calling this method.
>
> What should a conforming servlet engine do if they try to
> send more output?
I recommend being forgiving and simply suppressing later content.
> HttpSession.setMaxInactiveInterval(int)
>
> The spec says it should return int, I believe this meant to
> say a void return.
The classes shipped by Sun have it return void. I'd chalk this up to a
spec bug. Copy/paste strikes again.
-jh-
--
Jason Hunter
[EMAIL PROTECTED]
Book: http://www.servlets.com/book
Article: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html