/** * Returns the MIME type of the content of the request, or * <code>null</code> if the type is not known. Same as the value * of the CGI variable CONTENT_TYPE. **/ public String getContentType() { String result; result=_contentType; /** * suggested fix by bug report * [ 1509117 ] getContentType() * by Tom Parker */ result=this.getHeader( "Content-Type" ); return result; }
/** * Returns the MIME type of the content of the request, or * <code>null</code> if the type is not known. Same as the value * of the CGI variable CONTENT_TYPE. **/ public String getContentType() { String result; result=_contentType; /** * suggested fix by bug report * [ 1509117 ] getContentType() * by Tom Parker */ result=this.getHeader( "Content-Type" ); return result; }
/** * Returns the MIME type of the content of the request, or * <code>null</code> if the type is not known. Same as the value * of the CGI variable CONTENT_TYPE. **/ public String getContentType() { String result; result=_contentType; /** * suggested fix by bug report * [ 1509117 ] getContentType() * by Tom Parker */ result=this.getHeader( "Content-Type" ); return result; }
/** * Returns the value of the specified request header as an int. If the request does not have a header * of the specified name, this method returns -1. If the header cannot be converted to an integer, * this method throws a NumberFormatException. **/ public int getIntHeader( String name ) { return Integer.parseInt( getHeader( name ) ); }
/** * Returns the value of the specified request header as an int. If the request does not have a header * of the specified name, this method returns -1. If the header cannot be converted to an integer, * this method throws a NumberFormatException. **/ public int getIntHeader( String name ) { return Integer.parseInt( getHeader( name ) ); }
/** * Returns the value of the specified request header as an int. If the request does not have a header * of the specified name, this method returns -1. If the header cannot be converted to an integer, * this method throws a NumberFormatException. **/ public int getIntHeader( String name ) { return Integer.parseInt( getHeader( name ) ); }
/** * Returns the value of the specified request header as a long value that represents a Date object. * Use this method with headers that contain dates, such as If-Modified-Since. * <br> * The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive. * * If the request did not have a header of the specified name, this method returns -1. * If the header can't be converted to a date, the method throws an IllegalArgumentException. **/ public long getDateHeader( String name ) { try { String dateString=getHeader(name); Date headerDate=new Date(dateString); return headerDate.getTime(); } catch (Exception e) { return -1; } }
/** * Returns the value of the specified request header as a long value that represents a Date object. * Use this method with headers that contain dates, such as If-Modified-Since. * <br> * The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive. * * If the request did not have a header of the specified name, this method returns -1. * If the header can't be converted to a date, the method throws an IllegalArgumentException. **/ public long getDateHeader( String name ) { try { String dateString=getHeader(name); Date headerDate=new Date(dateString); return headerDate.getTime(); } catch (Exception e) { return -1; } }
/** * Returns the value of the specified request header as a long value that represents a Date object. * Use this method with headers that contain dates, such as If-Modified-Since. * <br> * The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive. * * If the request did not have a header of the specified name, this method returns -1. * If the header can't be converted to a date, the method throws an IllegalArgumentException. **/ public long getDateHeader( String name ) { try { String dateString=getHeader(name); Date headerDate=new Date(dateString); return headerDate.getTime(); } catch (Exception e) { return -1; } }
/** * Parses the accept-language header to obtain a vector of preferred locales * @return the preferred locales, sorted by qvalue */ private Vector getPreferredLocales() { if (_locales == null) { _locales = new Vector(); String languages = getHeader( "accept-language" ); if (languages == null) { _locales.add( Locale.getDefault() ); } else { StringTokenizer st = new StringTokenizer( languages, "," ); ArrayList al = new ArrayList(); while (st.hasMoreTokens()) { String token = st.nextToken(); al.add( new PrioritizedLocale( token ) ); } Collections.sort( al ); for (Iterator iterator = al.iterator(); iterator.hasNext();) { _locales.add( ((PrioritizedLocale) iterator.next()).getLocale() ); } } } return _locales; }
/** * Parses the accept-language header to obtain a vector of preferred locales * @return the preferred locales, sorted by qvalue */ private Vector getPreferredLocales() { if (_locales == null) { _locales = new Vector(); String languages = getHeader( "accept-language" ); if (languages == null) { _locales.add( Locale.getDefault() ); } else { StringTokenizer st = new StringTokenizer( languages, "," ); ArrayList al = new ArrayList(); while (st.hasMoreTokens()) { String token = st.nextToken(); al.add( new PrioritizedLocale( token ) ); } Collections.sort( al ); for (Iterator iterator = al.iterator(); iterator.hasNext();) { _locales.add( ((PrioritizedLocale) iterator.next()).getLocale() ); } } } return _locales; }
/** * Parses the accept-language header to obtain a vector of preferred locales * @return the preferred locales, sorted by qvalue */ private Vector getPreferredLocales() { if (_locales == null) { _locales = new Vector(); String languages = getHeader( "accept-language" ); if (languages == null) { _locales.add( Locale.getDefault() ); } else { StringTokenizer st = new StringTokenizer( languages, "," ); ArrayList al = new ArrayList(); while (st.hasMoreTokens()) { String token = st.nextToken(); al.add( new PrioritizedLocale( token ) ); } Collections.sort( al ); for (Iterator iterator = al.iterator(); iterator.hasNext();) { _locales.add( ((PrioritizedLocale) iterator.next()).getLocale() ); } } } return _locales; }