Announcement Announcement Module
Collapse
No announcement yet.
providing login page to spring-batch-admin Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • providing login page to spring-batch-admin

    Hi, i am breaking my head from past week. I am trying to give login page for spring-batch-admin which checks the credentials from spring-security file and authorizes the user and redirects him to spring-batch-admin page but that was not happening with me, login page was successfully created but after login admin page is not displayed..i will give the config files.

    security.xml file:
    ----------------------
    <code>

    <beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- <beans:import resource="/dispatcher-servlet.xml" /> -->

    <http auto-config="true">
    <intercept-url pattern="/welcome" access="ROLE_USER" />
    <form-login login-page="/login" default-target-url="" />
    <logout logout-success-url="/logout" />

    </http>

    <authentication-manager>
    <authentication-provider>
    <user-service>
    <user name="admin" password="TsssEbates" authorities="ROLE_USER" />
    </user-service>
    </authentication-provider>
    </authentication-manager>

    </beans:beans>
    ======
    </code>

    now i provide my dispatcher serlvet file:

    <code>
    ===========
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">



    <context:component-scan base-package="com.batchadmin.controllers" />
    <bean
    class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="prefix">
    <value>/WEB-INF/pages/</value>
    </property>
    <property name="suffix">
    <value>.jsp</value>
    </property>
    </bean>


    </beans>
    ==========
    </code>

    now web.xml file

    <code>
    =======
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml
    /WEB-INF/dispatcher-servlet.xml
    /WEB-INF/spring-security.xml
    <!-- classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml -->
    </param-value>
    </context-param>

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    <filter>
    <filter-name>shallowEtagHeaderFilter</filter-name>
    <filter-class>org.springframework.web.filter.ShallowEtagHe aderFilter</filter-class>
    </filter>

    <filter>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMet hodFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>shallowEtagHeaderFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>


    <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml

    <!-- classpath*:META-INF/spring/batch/jobs/application-context.xml --></param-value>

    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>
    ===========
    </code>


    In web.xml the servlet-context file is taken from classpath directly at runtime and from that file admin page is displayed, when i keep this i dont get login form page, when i remove this i get login page and i dont get admin page after login..please do provide me some solution please..any one..i would be thankful to them.

  • #2
    hi, i have set everything and it is working fine except a problem which i am not able to fix, i have given 'resourceService' value as /batch/ and in web.xml for dispatcher servlet given url as /batch/* and in index.jsp page given as "<jsp:forward page="/batch/home" />", here is code

    servlet-config.xml

    <code>
    ...........

    <bean id="resourceService"
    class="org.springframework.batch.admin.web.resourc es.DefaultResourceService">
    <property name="servletPath" value="/batch/" />
    </bean>

    ............
    </code>


    web.xml

    <code>
    ............

    <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/servlet-config.xml
    <!-- classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml -->

    </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/batch/*</url-pattern>
    </servlet-mapping>


    ............
    </code>


    Now here when i hit url localhost:8080/spring-batch-admin/ is displaying same page as localhost:8080/spring-batch-admin/batch/...... but i want to display admin only with when i hit the second url as localhost:8080/spring-batch-admin/batch/. Please help me out i am breaking my head here.

    And aslo please let me know how to modify standard.ftl in my application.
    Last edited by tsss_girish; Jun 9th, 2013, 11:42 PM.

    Comment

    Working...
    X