Package javax.ws.rs.core

Examples of javax.ws.rs.core.UriInfo


  public Marshaller decorate(Marshaller target, final AddLinks annotation,
      Class type, Annotation[] annotations, MediaType mediaType) {
    target.setListener(new Listener() {
      @Override
      public void beforeMarshal(Object entity) {
        UriInfo uriInfo = ResteasyProviderFactory.getContextData(UriInfo.class);
        ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyProviderFactory.getContextData(Registry.class);

        // find all rest service classes and scan them
        RESTUtils.addDiscovery(entity, uriInfo, registry);
      }
View Full Code Here


   public ResteasyRequestWrapper(HttpServletRequest request, String httpMethod, String prefix)
           throws ServletException, IOException
   {
      this.httpServletRequest = request;
      HttpHeaders headers = ServletUtil.extractHttpHeaders(request);
      UriInfo uriInfo = ServletUtil.extractUriInfo(request, prefix);
      // TODO: how are we supposed to get the response to create the
      // wrapper!!!!? The null response will only make it so that the
      // Asynchronous invocations won't work

      // HttpServletResponseWrapper theResponse = new
View Full Code Here

    }

    @Override
    public void filter(ContainerRequestContext containerRequestContext) throws IOException {
        serverTracer.clearCurrentSpan();
        UriInfo uriInfo = containerRequestContext.getUriInfo();
        submitEndpoint(uriInfo);

        TraceData traceData = getTraceDataFromHeaders(containerRequestContext);
        if (Boolean.FALSE.equals(traceData.shouldBeTraced())) {
            serverTracer.setStateNoTracing();
View Full Code Here

    @Before
    public void setUp() throws URISyntaxException {
        URI baseUri = new URI("http://" + LOCAL_ADDR + ":" + LOCAL_PORT + "/" + CONTEXT_PATH);

        UriInfo uriInfo = mock(UriInfo.class);
        when(uriInfo.getBaseUri()).thenReturn(baseUri);
        when(uriInfo.getAbsolutePath()).thenReturn(baseUri);

        when(containerRequestContext.getUriInfo()).thenReturn(uriInfo);
    }
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

                }
            }

            // 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

        baseUri(null);
        relativeTo = null;
    }

    private void initPaths() {
        UriInfo uriInfo = context.getUriInfo();
        resourcePath = null;
        subResourcePath = null;

        // we need to determine the path of the resource, and the path of the
        // sub-resource method
        // (if it exists)
        List<String> matchedURIs = uriInfo.getMatchedURIs(false);
        if (matchedURIs.size() == 1) {
            // if we have only one matched URI, it's a root resource without a
            // sub-resource method
            resourcePath = matchedURIs.get(0);
            subResourcePath = null;
        } else {
            // we have more than one matched URI. It means we went through at
            // least one sub-resource
            // (locator or method).
            // We compare the number of matched resources against the number of
            // matched URI's to
            // determine if the the invoked method is a resource method or a
            // sub-resource method.
            // If the number of matched URI's is the same as the number of
            // matched resources, then
            // we invoked a resource method.
            // If the number of matched URI's is greater than the number of
            // matched resources, then
            // we invoked a sub-resource method.
            List<Object> matchedResources = uriInfo.getMatchedResources();
            if (matchedURIs.size() == matchedResources.size()) {
                // the number of matched URI's is the same as the number of
                // matched resources - this
                // means we invoked a resource method
                resourcePath = matchedURIs.get(0);
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)) {
            return null;
        }
       
        if (isPrivate(m)) {
            return Response.status(401).build();
        }
       
        StringBuilder sbMain = new StringBuilder();
        sbMain.append("<application xmlns=\"").append(getNamespace())
              .append("\" xmlns:xs=\"").append(XmlSchemaConstants.XSD_NAMESPACE_URI).append("\"");
        StringBuilder sbGrammars = new StringBuilder();
        sbGrammars.append("<grammars>");
       
        StringBuilder sbResources = new StringBuilder();
        sbResources.append("<resources base=\"").append(ui.getBaseUri().toString()).append("\">");
       
        List<ClassResourceInfo> cris = getResourcesList(m, resource);
       
        Set<Class<?>> allTypes =
            ResourceUtils.getAllRequestResponseTypes(cris, useJaxbContextForQnames).keySet();
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

                }
            }

            // 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

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.