Examples of UrlMapping


Examples of es.internna.spring.annotations.UrlMapping

    }
   
    private void registerController(Object bean, String beanName)
    {
        Class<?> clazz = this.getClass(bean);
        UrlMapping mapping = clazz.getAnnotation(UrlMapping.class);
        if (mapping != null) registerHandler(mapping.value(), beanName);
        UrlMappings mappings = clazz.getAnnotation(UrlMappings.class);
        if (mappings != null)
            for (UrlMapping map : mappings.value())
                registerHandler(map.value(), beanName);
    }
View Full Code Here

Examples of es.internna.spring.annotations.UrlMapping

    }
   
    public final Set<String> getUrlMappings()
    {
        Set<String> combinedMappings = new HashSet<String>(urlMappings);
        UrlMapping urlMapping = ClassUtils.getAnnotation(UrlMapping.class, this);
        if ((urlMapping != null) && (urlMapping.value() != null)) combinedMappings.add(urlMapping.value());
        UrlMappings mappings = ClassUtils.getAnnotation(UrlMappings.class, this);
        if (mappings != null)
            for (UrlMapping map : mappings.value())
                if ((map != null) && (map.value() != null)) combinedMappings.add(map.value());
        return combinedMappings;
View Full Code Here

Examples of grails.web.mapping.UrlMapping

                                    mappingInfo.setHttpMethod(variables.get(UrlMapping.HTTP_METHOD).toString());
                                }
                            }

                            ConstrainedProperty[] constraints = currentConstraints.toArray(new ConstrainedProperty[currentConstraints.size()]);
                            UrlMapping urlMapping;
                            if (mappingInfo.getUri() != null) {
                                try {
                                    urlMapping = new RegexUrlMapping(urlData, new URI(mappingInfo.getUri().toString()), constraints, sc);
                                } catch (URISyntaxException e) {
                                    throw new UrlMappingException("Cannot map to invalid URI: " + e.getMessage(), e);
                                }
                            } else {
                                urlMapping = createURLMapping(urlData, isResponseCode, mappingInfo.getRedirectInfo(), mappingInfo.getController(), mappingInfo.getAction(), mappingInfo.getNamespace(), mappingInfo.getPlugin(), mappingInfo.getView(), mappingInfo.getHttpMethod(), null, constraints);
                            }
                           
                            if (binding != null) {
                                Map bindingVariables = variables;
                                Object parse = getParseRequest(Collections.EMPTY_MAP, bindingVariables);
                                if (parse instanceof Boolean) {
                                    urlMapping.setParseRequest((Boolean) parse);
                                }
                            }
                            configureUrlMapping(urlMapping);
                            return urlMapping;
                        }

                        if (args[0] instanceof Map) {
                            Map namedArguments = (Map) args[0];
                            String uri = mappedURI;
                            String version = null;

                            if (namedArguments.containsKey(UrlMapping.VERSION)) {
                                version = namedArguments.get(UrlMapping.VERSION).toString();
                            }
                            if (namedArguments.containsKey(UrlMapping.NAMESPACE)) {
                                mappingInfo.setNamespace(namedArguments.get(UrlMapping.NAMESPACE).toString());
                            }

                            if (namedArguments.containsKey(UrlMapping.PLUGIN)) {
                                mappingInfo.setPlugin(namedArguments.get(UrlMapping.PLUGIN).toString());
                            }
                           
                            UrlMappingData urlData = createUrlMappingData(uri, isResponseCode);

                            if (namedArguments.containsKey(RESOURCE)) {
                                Object controller = namedArguments.get(RESOURCE);
                                String controllerName = controller.toString();
                                mappingInfo.setController(controllerName);
                                parentResources.push(new ParentResource(controllerName, uri, true));
                                try {
                                    invokeLastArgumentIfClosure(args);
                                } finally {
                                    parentResources.pop();
                                }
                                if (controller != null) {

                                    createSingleResourceRestfulMappings(controllerName, mappingInfo.getPlugin(), mappingInfo.getNamespace(), version, urlData, currentConstraints, calculateIncludes(namedArguments, DEFAULT_RESOURCE_INCLUDES));
                                }
                            } else if (namedArguments.containsKey(RESOURCES)) {
                                Object controller = namedArguments.get(RESOURCES);
                                String controllerName = controller.toString();
                                mappingInfo.setController(controllerName);
                                parentResources.push(new ParentResource(controllerName, uri, false));
                                try {
                                    invokeLastArgumentIfClosure(args);
                                } finally {
                                    parentResources.pop();
                                }
                                if (controller != null) {
                                    createResourceRestfulMappings(controllerName, mappingInfo.getPlugin(), mappingInfo.getNamespace(), version,urlData, currentConstraints, calculateIncludes(namedArguments, DEFAULT_RESOURCES_INCLUDES));
                                }
                            } else {

                                invokeLastArgumentIfClosure(args);
                                UrlMapping urlMapping = getURLMappingForNamedArgs(namedArguments, urlData, mappedURI, isResponseCode, currentConstraints);
                                configureUrlMapping(urlMapping);
                                return urlMapping;
                            }
                        }
                        return null;
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

  @Test
  public void test_findURLMapping_match() throws JsonParseException, JsonMappingException, IOException {
    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();
   
    URLMapping mapping = dcc.findURLMapping(Scheme.HTTPS, "test/sample/123");
    assertNotNull(mapping);
    assertEquals("localhost", mapping.getHost());
    assertEquals("8080", mapping.getPort());
   
    mapping = dcc.findURLMapping(Scheme.HTTPS, "test/sample2/123abc/test2");
    assertNotNull(mapping);
    assertEquals("localhost", mapping.getHost());
    assertEquals("8080", mapping.getPort());
  }
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

  @Test
  public void test_findURLMapping_noMatch() throws JsonParseException, JsonMappingException, IOException {
    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();
   
    URLMapping mapping = dcc.findURLMapping(Scheme.HTTPS, "not/a/match");
    assertEquals(null, mapping);
  }
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();
   
    assertNotNull(DefaultChannelComponent.mappings);
   
    URLMapping mapping1 = new URLMapping();
    mapping1.setHost("localhost");
    mapping1.setPort("8080");
    mapping1.setUrlPattern("test/sample/.+");
   
    URLMapping mapping2 = new URLMapping();
    mapping2.setHost("localhost");
    mapping2.setPort("8080");
    mapping2.setUrlPattern("test/sample2/.+/test2");
   
    URLMapping mapping3 = new URLMapping();
    mapping3.setHost("localhost");
    mapping3.setPort("8080");
    mapping3.setUrlPattern("test/sample/protected");
    mapping3.setAuthType("basic");
    mapping3.setUsername("test");
    mapping3.setPassword("password");
   
    URLMapping mapping4 = new URLMapping();
    mapping4.setHost("localhost");
    mapping4.setPort("8080");
    mapping4.setUrlPattern("test/post");
   
    assertEquals(true, DefaultChannelComponent.mappings.contains(mapping1));
    assertEquals(true, DefaultChannelComponent.mappings.contains(mapping2));
  }
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

  @Test
  public void test_findUnsecureURLMapping_match() throws JsonParseException, JsonMappingException, IOException {
    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();

    URLMapping mapping = dcc.findURLMapping(Scheme.HTTP, "test/unsecure");
    assertNotNull(mapping);
    assertEquals("localhost", mapping.getHost());
    assertEquals("8080", mapping.getPort());

    URLMapping mapping2 = dcc.findURLMapping(Scheme.HTTP, "test/unsecure2");
    assertNotNull(mapping2);
    assertEquals("localhost", mapping2.getHost());
    assertEquals("8080", mapping2.getPort());
  }
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

  @Test
  public void test_shouldNotFindUnallowed() throws JsonParseException, JsonMappingException, IOException {
    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();

    URLMapping mapping = dcc.findURLMapping(Scheme.HTTP, "test/secure");
    assertEquals(null, mapping);

    //secure by default
    URLMapping mapping2 = dcc.findURLMapping(Scheme.HTTP, "test/sample/123");
    assertEquals(null, mapping2);
  }
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

 
  private void test_pathRedirection(String path, String targetPath) throws JsonParseException, JsonMappingException, IOException, DefaultChannelInvalidConfigException {
    DefaultChannelComponent dcc = new DefaultChannelComponent();
    dcc.readMappings();

    URLMapping mapping = dcc.findURLMapping(Scheme.HTTPS, path);
    MuleMessage mockMsg = mock(MuleMessage.class);
    RestfulHttpRequest req = new RestfulHttpRequest();
    req.setPath(path);
   
    dcc.setMessagePropertiesFromMapping(req, mockMsg, mapping);
View Full Code Here

Examples of org.jembi.openhim.DefaultChannelComponent.URLMapping

    //cannot specify both path and pathTransform
   
    try {
      DefaultChannelComponent dcc = new DefaultChannelComponent();
      MuleMessage mockMsg = mock(MuleMessage.class);
      URLMapping mapping = mock(URLMapping.class);

      when(mapping.getPath()).thenReturn("path");
      when(mapping.getPathTransform()).thenReturn("pathTransform");
      dcc.setMessagePropertiesFromMapping(new RestfulHttpRequest(), mockMsg, mapping);
      fail();
    } catch (DefaultChannelInvalidConfigException ex) {
      //expected
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.