2016-08-18 1 views
0

WildFly 10의 JRE 8에서 MoJarra 2.2.13과 함께 rewrite-config-prettyfaces 3.4.0.Final을 사용 중입니다. 그 설정 (일부 세부 사항은 아래 참조)은 모두 잘 작동합니다 . 이제 pretty-config.xml 파일을 삭제하고 RewriteConfiguration 기반 규칙으로 전환하고 싶습니다. 일단 내가 이것을 만들고 pretty-config url-mapping을 규칙에 매핑하면 내 응용 프로그램이 정상적으로 작동하는 것처럼 보입니다. 그러나, 나는 h : commandLink 액션이 결코 더 이상 호출되지 않는다는 것을 알아 차렸다. pretty-config.xml로 다시 전환하면 다시 작동합니다. urgs. 이것이 RewriteConfiguration에서 작동하지 않는 이유가 무엇입니까?commandLink 재 작성 RewriteRule이 활성화되지 않았습니다.

  • 는 재 - 서블릿 3.4.0.Final.jar는
  • 재 - 설정 - prettyfaces-3.4.0.Final.jar (그러나 이것은 삭제 :

    내 클래스 경로는 다음 다시 쓰기 단지를 포함 작동하지 않는 설정에서)

아래 코드는 일부 발췌 문장입니다.

고맙습니다.

내 꽤-설정이 구성

<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces 
         http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd"> 

    <url-mapping id="start"> 
     <pattern value="/#{lang}"/> 
     <view-id value="/dashboard.jsf"/> 
    </url-mapping> 
    <url-mapping id="download"> 
     <pattern value="/#{lang}/downloadReport.html"/> 
     <view-id value="/downloadReport.jsf"/> 
    </url-mapping> 
    <url-mapping id="catalog"> 
     <pattern value="/#{lang}/catalogue/#{catalogName}"/> 
     <view-id value="/catalogDashboard.jsf"/> 
    </url-mapping> 
    <url-mapping id="violations"> 
     <pattern value="/#{lang}/catalogue/#{catalogName}/violations"/> 
     <view-id value="/violations.jsf"/> 
    </url-mapping> 
    <url-mapping id="distributions"> 
     <pattern value="/#{lang}/catalogue/#{catalogName}/distributions"/> 
     <view-id value="/distributions.jsf"/> 
    </url-mapping> 

</pretty-config> 

내 RewriteConfiguration 파일이

내 단순화 dummy.xhtml 파일은 다음과 같습니다
@RewriteConfiguration 
public class ApplicationNavigationConfigurationProvider extends HttpConfigurationProvider { 

    @Override 
    public Configuration getConfiguration(ServletContext servletContext) { 
     return ConfigurationBuilder.begin() 
       .addRule(TrailingSlash.remove()) 
       .addRule(Join.path("/{lang}").to("/dashboard.jsf")) 
       .addRule(Join.path("/{lang}/downloadReport.html").to("/downloadReport.jsf")) 
       .addRule(Join.path("/{lang}/catalogue/{catalogName}").to("/catalogDashboard.jsf")) 
       .addRule(Join.path("/{lang}/catalogue/{catalogName}/violations").to("/violations.jsf")) 
       .addRule(Join.path("/{lang}/catalogue/{catalogName}/distributions").to("/distributions.jsf")); 
    } 

    @Override 
    public int priority() { 
     return 0; 
    } 
} 

:

참고 : commandLink의 관련 섹션은 실제로 catalogDashboard.jsf의 일부입니다. 누락 된 더미 다시 쓰기 규칙을 현재로 간주하십시오.

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" 
     xmlns:f="http://xmlns.jcp.org/jsf/core"> 

<f:view> 
    <h:body> 
     <h:outputText value="#{harvesterBean.currentRepository.name}"/> 
     <h:form> 
      <h:commandLink action="#{harvesterBean.updateAttachment(1)}" value="Test action invocation"> 
       <f:param name="catalogName" value="#{request.getParameter('catalogName')}"/> 
      </h:commandLink> 
     </h:form> 
    </h:body> 
</f:view> 
</html> 

CommandLink는 액션을 통해 호출하는 방법에 내 콩이

@ViewScoped 
@Named 
public class HarvesterBean implements Serializable { // updated: implements Serializable 

    @Inject 
    private HarvesterClientActionImpl harvesterClientAction; 

    @Inject 
    private CurrentCatalogBean currentCatalogBean; 

    private Repository currentRepository; 
    private Harvester currentHarvester; 
    private Run currentRun; 
    private List<RunLog> logs; 
    private String selectedAttachment; 

    @PostConstruct 
    public void init() { 
     currentRepository = harvesterClientAction.retrieveRepository(currentCatalogBean.getCurrentCatalog().getTitle()); 
     currentHarvester = harvesterClientAction.retrieveHarvester(currentRepository.getSourceHarvester()); 
     currentRun = harvesterClientAction.retrieveLastRun(currentHarvester.getId()); 
     logs = harvesterClientAction.retrieveRunLogs(currentHarvester.getId(), currentRun.getId()); 

    } 

    // This method is not invoked when using the RewriteConfiguration instead of pretty-config.xml 
    public void updateAttachment(long logId) { 
     selectedAttachment = harvesterClientAction.retrieveAttachment(currentHarvester.getId(), currentRun.getId(), logId); 
    } 
// getter and setter 
} 
+0

클래스 경로에있는 재 작성 JAR 파일을 포함시킬 수 있습니까? – chkal

+0

@chkal 게시물을 업데이트했습니다. 그것은 단지 rewrite-servlet-3.4.0.Final.jar입니다. – cpoeth

답변

1

당신이 당신의 의존성에 JSF 통합 모듈을 다시 작성 포함되어 있는지 확인하십시오 :

<dependency> 
    <groupId>org.ocpsoft.rewrite</groupId> 
    <artifactId>rewrite-integration-faces</artifactId> 
    <version>3.4.0.Final</version> 
    </dependency> 

rewrite-config-prettyfaces 의존 이 모듈에서 3.4.0. 최종. 따라서 PrettyFaces 통합을 삭제하면 핵심 JSF 통합 모듈도 없어져 이런 식으로 이어질 수 있습니다.

+0

아, 맞아요. 나는 그것을 어떻게 할 것인지를 밝혀 내려고했지만, 그렇습니다. 이것이 문제가 될 수 있습니다. – Lincoln

+0

굉장! 그 트릭을 했어! 도와 줘서 고마워! Btw, 네 프레임 워크가 마음에 든다! :) – cpoeth

관련 문제