Coverage Report - com.jcabi.http.RequestURI
 
Classes in this File Line Coverage Branch Coverage Complexity
RequestURI
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright (c) 2011-2015, jcabi.com
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met: 1) Redistributions of source code must retain the above
 8  
  * copyright notice, this list of conditions and the following
 9  
  * disclaimer. 2) Redistributions in binary form must reproduce the above
 10  
  * copyright notice, this list of conditions and the following
 11  
  * disclaimer in the documentation and/or other materials provided
 12  
  * with the distribution. 3) Neither the name of the jcabi.com nor
 13  
  * the names of its contributors may be used to endorse or promote
 14  
  * products derived from this software without specific prior written
 15  
  * permission.
 16  
  *
 17  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 19  
  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 20  
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 21  
  * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 22  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23  
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 24  
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 26  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 27  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 28  
  * OF THE POSSIBILITY OF SUCH DAMAGE.
 29  
  */
 30  
 package com.jcabi.http;
 31  
 
 32  
 import com.jcabi.aspects.Immutable;
 33  
 import java.net.URI;
 34  
 import java.util.Map;
 35  
 
 36  
 /**
 37  
  * Request URI.
 38  
  *
 39  
  * <p>Instance of this interface is returned by {@link Request#uri()},
 40  
  * and can be modified using one of the methods below. When modification
 41  
  * is done, method {@code back()} returns a modified instance of
 42  
  * {@link Request}, for example:
 43  
  *
 44  
  * <pre> new JdkRequest("http://my.example.com")
 45  
  *   .header("Accept", "application/json")
 46  
  *   .uri()
 47  
  *   .path("/users")
 48  
  *   .queryParam("name", "Jeff Lebowski")
 49  
  *   .back() // returns a modified instance of Request
 50  
  *   .fetch()</pre>
 51  
  *
 52  
  * <p>Instances of this interface are immutable and thread-safe.
 53  
  *
 54  
  * @author Yegor Bugayenko (yegor@tpc2.com)
 55  
  * @version $Id: 02650b171ae7c306a211b7bca11bbee2b5c9934b $
 56  
  * @since 0.8
 57  
  */
 58  
 @Immutable
 59  
 public interface RequestURI {
 60  
 
 61  
     /**
 62  
      * Get back to the request it's related to.
 63  
      * @return The request we're in
 64  
      */
 65  
     Request back();
 66  
 
 67  
     /**
 68  
      * Get URI.
 69  
      * @return The destination it is currently pointing to
 70  
      */
 71  
     URI get();
 72  
 
 73  
     /**
 74  
      * Set URI.
 75  
      * @param uri URI to set
 76  
      * @return New alternated URI
 77  
      */
 78  
     RequestURI set(URI uri);
 79  
 
 80  
     /**
 81  
      * Add query param.
 82  
      * @param name Query param name
 83  
      * @param value Value of the query param to set
 84  
      * @return New alternated URI
 85  
      */
 86  
     RequestURI queryParam(String name, Object value);
 87  
 
 88  
     /**
 89  
      * Add query params.
 90  
      * @param map Map of params to add
 91  
      * @return New alternated URI
 92  
      */
 93  
     RequestURI queryParams(Map<String, String> map);
 94  
 
 95  
     /**
 96  
      * Add URI path.
 97  
      * @param segment Path segment to add
 98  
      * @return New alternated URI
 99  
      */
 100  
     RequestURI path(String segment);
 101  
 
 102  
     /**
 103  
      * Set user info.
 104  
      * @param info User info part to set
 105  
      * @return New alternated URI
 106  
      */
 107  
     RequestURI userInfo(String info);
 108  
 
 109  
     /**
 110  
      * Set port number.
 111  
      * @param num The port number to set
 112  
      * @return New altered URI
 113  
      */
 114  
     RequestURI port(int num);
 115  
 
 116  
 }