Package javax.ws.rs.core

Examples of javax.ws.rs.core.UriInfo


        if (!"GET".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
            return null;
        }

        UriInfo ui = new UriInfoImpl(m);
        if (!ui.getQueryParameters().containsKey(WADL_QUERY)) {
            if (!docLocationMap.isEmpty()) {
                String path = ui.getPath(false);
                if (path.startsWith("/") && path.length() > 0) {
                    path = path.substring(1);
                }
                if (docLocationMap.containsKey(path)) {
                    return getExistingResource(m, ui, path);
View Full Code Here


        // more to come
    }
   
    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
       
        UriInfo uriInfo = new UriInfoImpl(m, null);
        handleTypeQuery(m, uriInfo.getQueryParameters());
       
       
        return null;
    }
View Full Code Here

    }
   
    @Test
    public void testGetRequestURI() {
       
        UriInfo u = new UriInfoImpl(mockMessage("http://localhost:8080/baz", "/bar", "n=1%202"),
                            null);

        assertEquals("Wrong request uri", "http://localhost:8080/baz/bar?n=1%202",
                     u.getRequestUri().toString());
    }
View Full Code Here

        if (!"GET".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
            return null;
        }

        UriInfo ui = new UriInfoImpl(m);
        if (!ui.getQueryParameters().containsKey(WADL_QUERY)) {
            if (!schemaLocationMap.isEmpty()) {
                String path = ui.getPath(false);
                if (path.startsWith("/") && path.length() > 0) {
                    path = path.substring(1);
                }
                if (schemaLocationMap.containsKey(path)) {
                    return getExistingSchema(m, ui, path);
View Full Code Here

        }
       
        TemplatesImpl templ =  new TemplatesImpl(templates, uriResolver);
        MessageContext mc = getContext();
        if (mc != null) {
            UriInfo ui = mc.getUriInfo();
            MultivaluedMap<String, String> params = ui.getPathParameters();
            for (Map.Entry<String, List<String>> entry : params.entrySet()) {
                String value = entry.getValue().get(0);
                int ind = value.indexOf(";");
                if (ind > 0) {
                    value = value.substring(0, ind);
                }
                templ.setTransformerParameter(entry.getKey(), value);
            }
           
            List<PathSegment> segments = ui.getPathSegments();
            if (segments.size() > 0) {
                setTransformParameters(templ, segments.get(segments.size() - 1).getMatrixParameters());
            }
            setTransformParameters(templ, ui.getQueryParameters());
            templ.setTransformerParameter(ABSOLUTE_PATH_PARAMETER, ui.getAbsolutePath().toString());
            templ.setTransformerParameter(RELATIVE_PATH_PARAMETER, ui.getPath());
            templ.setTransformerParameter(BASE_PATH_PARAMETER, ui.getBaseUri().toString());
            if (configuredParams != null) {
                for (Map.Entry<String, Object> entry : configuredParams.entrySet()) {
                    templ.setTransformerParameter(entry.getKey(), entry.getValue());
                }
            }
View Full Code Here

        @Override
        public ResponseBuilder location(URI location) {
            if (location != null && !location.isAbsolute()) {
                RuntimeContext rtContext = RuntimeContextTLS.getRuntimeContext();
                if (rtContext != null) {
                    UriInfo info =
                        RuntimeContextTLS.getRuntimeContext().getAttribute(UriInfo.class);
                    if (info != null) {
                        location =
                            UriBuilder.fromUri(info.getBaseUri()).path(location.getPath())
                                .fragment(location.getFragment()).build();
                    }
                }
            }
View Full Code Here

                }
            }

            // for all other types and for cases where the default value should
            // be used
            UriInfo uriInfo = runtimeContext.getUriInfo();
            MultivaluedMap<String, String> variables = uriInfo.getPathParameters(false);
            List<String> values = variables.get(getName());
            if (values == null) {
                values = new LinkedList<String>();
            }
View Full Code Here

        @Override
        public Object getValue(RuntimeContext runtimeContext) throws IOException {
            if (runtimeContext == null) {
                return null;
            }
            UriInfo uriInfo = runtimeContext.getUriInfo();
            MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters(false);
            List<String> values = queryParameters.get(getName());
            if (values == null) {
                values = new LinkedList<String>();
            }
            if (values.size() == 0 && hasDefaultValue()) {
View Full Code Here

    }
   
    @Test
    public void testGetRequestURI() {
       
        UriInfo u = new UriInfoImpl(mockMessage("http://localhost:8080/baz/bar", "/baz/bar", "n=1%202"),
                            null);

        assertEquals("Wrong request uri", "http://localhost:8080/baz/bar?n=1%202",
                     u.getRequestUri().toString());
    }
View Full Code Here

   {
   }

   public BaseLink(String rel, String relativeLink)
   {
      UriInfo uriInfo = ResteasyProviderFactory.getContextData(UriInfo.class);
      if (uriInfo == null)
         throw new IllegalStateException("This constructor must be called in the context of a JAX-RS request");
      URI uri = uriInfo.getBaseUriBuilder().path(relativeLink).build();
      setHref(uri);
      setRel(rel);
   }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.UriInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.