transformWsdlLocations & <url-pattern> - spring-ws

When I have in web.xml:
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
and
<servlet-mapping>
<servlet-name>personWS</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
auto-generated WSDL contains right URL:
<soap:address location="http://localhost:8888/MyWSApp/getPerson/"/>
So when I create new project based on wsdl in SoapUI, EndPoint is set to right url (http://localhost:8888/MyWSApp/getPerson/)
But when I change url-pattern to:
<url-pattern>/something/*</url-pattern>
auto generated wsdl still contains the same URL like before:
<soap:address location="http://localhost:8888/MyWSApp/getPerson/"/>
but it is wrong, the service is running now on:
<soap:address location="http://localhost:8888/MyWSApp/service/getPerson/"/>
I have also tried change my portTypeName in servlet definition, but without success:
<bean id="personService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="personServiceSchema"/>
<!-- <property name="portTypeName" value="getPerson"/> -->
<property name="portTypeName" value="something/getPerson"/>
<property name="locationUri" value="/getPerson/"/>
<property name="targetNamespace" value="http://www.geonis.com/geonis/delivery_site"/>
</bean>
Please, do you have idea how can I fix it?

The transformation only affects the server and port portion of the URL, so for other modifications, like adding to the path, you will have to update your WSDL manually.
Basically, the URL will only adapt to detected values in the square brackets:
http[s]://[domain]:[port]/path/in/your/wsdl

Related

How to configure Spring-sesssion Custom Cookie by xml

sorry for my poor english, my current config like this:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\\.(\\w+\\.[a-z]+)$"></property>
</bean>
i want to custom a domain,it is working well while i configured the domainName property.but when i configure the domainNamePattern as above,it just working on localhost and ip address,but no
www.example.com
test.example.com
tks.
It looks like you are not using a valid Regular Expression (the expression is escaped for Java String but you are using XML). The expression will not match any of the domains so it will always use the current domain. Try the following instead:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\.(\w+\.[a-z]+)$"></property>
</bean>

Need help related to shiro annotation

I used shiro annotations for example: #RequiresPermissions("module:books:list"). It is working fine with the permitted page.But if I try to access not permitted page it gives AuthorizationException. Can anyone tell me how to redirect to unauthorized page if AuthorizationException is caused?
Error 500: Internal Server Error
URI
/BookForAsia/authors/create
Class
org.apache.shiro.authz.AuthorizationException
Message
Not authorized to invoke method: public java.lang.Object org.ng.bookforasia.AuthorsController.create()
As I know there are two ways to achieve that.
1.define unauthorizedUrl in your shiro-Context.xml like this
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="/views/login.html" />
<property name="successUrl" value="/views/main.html" />
<property name="unauthorizedUrl" value="/views/unauthorized.html" />
</bean>
2.define error-page in your web.xml
<error-page>
<exception-type>org.apache.shiro.authz.UnauthorizedException</exception-type>
<location>/views/unauthorized.html</location>
</error-page>

how use primefaces and prettyfaces together?

Primefaces doesn't work when primefaces and pretty face use together.
I add flowing jar:
prettyfaces-jsf2-3.3.3.jar
primefaces-4.0-20130605.174828-3.jar
My web.xml code:
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
My pretty-config.xml code:
<rewrite match="^[^(/primefaces_resource/)|^(javascript)]" trailingSlash="append" toCase="lowercase" redirect="301"/>
<url-mapping id="home">
<pattern value="/" />
<view-id value="/" />
</url-mapping>
This image is whithou prittyface( jar and configure):
when I add pretty face jar .then flowing view:
I want to change the url.
example:
(http://localhost:8084/AntSchoolMS/faces/index.xhtml)
I want it to be changed as
(http://localhost:8084/AntSchoolMS/)
please help me .
I use primefaces 3.5 with pretty faces 3.3.3 and works ok. The configuration in your web.xml seems to be ok. Make sure you place pretty-config.xml also in WEB-INF.
About the pretty-config you posted: it doesn't make any sense to have a url-mapping where the pattern and the view-id are the same, so remove it.
Also I don't have that rewrite rule, I have several mappings like the folowing:
<url-mapping id="login">
<pattern value="/login/">
<view-id value="/login.jsf" />
</url-mapping>
Did you try removing that rewrite rule to see what happens?
I've been using these two for some time and they are working as expected. My project used the 3.5 version of primefaces and PrettyFaces 3.3.3.
In my web.xml I did not need to register any filter like you did.
I would also try to remove the rewrite rule as Damian suggests.
Additionally, I would recommend upgrading to the latest version of PrettyFaces - see http://ocpsoft.org/prettyfaces/

Spring.Net without App.config

I want to configure the spring.net in some other setting files like xml not through app.config.
Is it possible to configure the spring.net in xml not in app.config file.if yes how can i do it.
Yes, you can place your configuration in normal xml files. In the Spring.NET documentation, the following example is given:
services.xml:
<objects xmlns="http://www.springframework.net">
<object id="PetStore" type="PetStore.Services.PetStoreService, PetStore">
<property name="AccountDao" ref="AccountDao"/>
<property name="ItemDao" ref="ItemDao"/>
<!-- additional collaborators and configuration for this object go here -->
</object>
<!-- more object definitions for services go here -->
</objects>
The file daos.xml has a similar structure and contains definitions for ItemDao and AccountDao.
In code, you can create an instance of your container using the files services.xml and daos.xml as follows:
IApplicationContext context = new XmlApplicationContext("services.xml", "daos.xml")

Why is my (Spring Security) servlet filter getting called twice?

Any ideas about why doFilterHttp in my SpringSecurityFilter subclass is getting called twice on each request? I don't really know where to start looking. Feeling a little stumped.
I'm reverse engineering a vacationing co-worker's code. To the best I can figure it, here's the relevant configuration:
in web.xml:
<filter>
<filter-name>userSecurityFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>userSecurityFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>userSecurityFilter</filter-name>
<url-pattern>/json/*</url-pattern>
In spring-security.xml:
<!-- Create the filter chains for developers, users and services -->
<bean id="userSecurityFilter" class="org.springframework.security.util.FilterChainProxy">
<security:filter-chain-map path-type="ant">
<security:filter-chain pattern="/**/json/*" filters="AuthFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor"/>
<security:filter-chain pattern="/**/*.do" filters="AuthFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor"/>
<security:filter-chain pattern="/**" filters="anonymousProcessingFilter,logoutFilter,exceptionTranslationFilter,filterInvocationInterceptor"/>
</security:filter-chain-map>
</bean>
It looks like the /**/json/* urls are getting the filter chain applied twice, while others only get it once. I'm going to go back and check to make sure what I just said is really true.
Ok, fixed it I think.
<filter-mapping>
<filter-name>userSecurityFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>userSecurityFilter</filter-name>
<url-pattern>/json/*</url-pattern>
There are urls under /json/ that end in ".do", so those urls were getting all of the Spring Security stuff applied twice. Thanks for the responses! Even though it was a dumb problem and I answered it myself, working through the reponses led me to the answer. Much appreciated.
Not much to go on here, but it may be that servlet container is processing several dispatchers, look in web.xml for:
<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/*</url-pattern>
<!-- the following is optional, but some containers give the wrong default -->
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
Can you post the filter-mapping from your web.xml?
Spring Security filters are not configured in the web.xml like classic Servlet Filters. They are instead configured somewhere in the application-context.xml (or whatever .xml configuration files you import in your web.xml).
Look for beans with a tag like this :
<custom-filter position="LAST" />
adding that tag to a bean will add it to your Spring Security filter chain. My guess is that it's added to the chain properly and also added as a Servlet Filter as shown above. Hence it's actually configured twice.

Resources