/** * Creates a new AcceptHeader based on the newly supplied contentType and * contentSubType values. * * @param contentType The new string content type value. * @param contentSubType The new string content sub-type value. * @throws ParseException which signals that an error has been reached * unexpectedly while parsing the content type or content subtype value. * @return the newly created AcceptHeader object. */ public AcceptHeader createAcceptHeader( String contentType, String contentSubType) throws ParseException { if (contentType == null || contentSubType == null) throw new NullPointerException("contentType or subtype is null "); Accept accept = new Accept(); accept.setContentType(contentType); accept.setContentSubType(contentSubType); return accept; }
/** Encode the value of this header into cannonical form. *@return encoded value of the header as a string. */ protected String encodeBody() { return encodeBody(new StringBuilder()).toString(); }
/** * Get the q value. * @return float */ public float getQValue() { return getParameterAsFloat(ParameterNames.Q); }
headerName(TokenTypes.ACCEPT); Accept accept = new Accept(); accept.setHeaderName(SIPHeaderNames.ACCEPT); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); this.lexer.SPorHT(); accept = new Accept(); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); super.parse(accept);
headerName(TokenTypes.ACCEPT); Accept accept = new Accept(); accept.setHeaderName(SIPHeaderNames.ACCEPT); this.lexer.match(TokenTypes.ID); Token token = lexer.getNextToken(); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); super.parse(accept); this.lexer.SPorHT(); accept = new Accept(); if ( lexer.startsId() ) { this.lexer.match(TokenTypes.ID); Token token = lexer.getNextToken(); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); super.parse(accept);