/** * Set the type for the content. This should match the pattern * ".* /.*" [Note, there is no space before the /, this has been added * to allow this text to be written in a Java comment.]. * * An example of the type is <code>application/zip</code>. * * @param type The specified type. * @throws InvalidMediaTypeException If the specified type is null or * it does not match the specified pattern. */ public void setType(String type) throws InvalidMediaTypeException { if (type == null || !type.matches(".*/.*")) { throw new InvalidMediaTypeException("Type: '" + type + "' does not match .*/.*"); } this.type = type; }
content.setType("application/zip"); } catch (InvalidMediaTypeException ex) { ex.printStackTrace();
content.setType("application/zip"); } catch (InvalidMediaTypeException ex) { ex.printStackTrace();
/** * Set the type for the content. This should match the pattern * ".* /.*" [Note, there is no space before the /, this has been added * to allow this text to be written in a Java comment.]. * * An example of the type is <code>application/zip</code>. * * @param type The specified type. * @throws InvalidMediaTypeException If the specified type is null or * it does not match the specified pattern. */ public void setType(String type) throws InvalidMediaTypeException { if( type == null || ! type.matches(".*/.*") ) { throw new InvalidMediaTypeException("Type: '" + type + "' does not match .*/.*"); } this.type = type; }
content.setType("application/zip"); } catch (InvalidMediaTypeException ex) { ex.printStackTrace();
/** * Set the type for the content. This should match the pattern * ".* /.*" [Note, there is no space before the /, this has been added * to allow this text to be written in a Java comment.]. * * An example of the type is <code>application/zip</code>. * * @param type The specified type. * @throws InvalidMediaTypeException If the specified type is null or * it does not match the specified pattern. */ public void setType(String type) throws InvalidMediaTypeException { if( type == null || ! type.matches(".*/.*") ) { throw new InvalidMediaTypeException("Type: '" + type + "' does not match .*/.*"); } this.type = type; }