出了点问题,非常令人沮丧.我在velocity的主页上看到,当我运行webapp时,应该设置一些属性.而且我已经做到了,但无论我做什么,我都会遇到同样的错误.
这是我设置道具和使用速度的地方
public class ConfirmationMailGenerator implements MailGenerator {
    private BasicUser user;
    private String htmlTemplate = "HTMLConfirmationMailTemplate.vsl";
    private String plainTemplate = "PlainConfirmationMailTemplate.vsl";
    public ConfirmationMailGenerator(BasicUser user) {
        this.user = user;
    }
    public StringWriter generateHTML() throws Exception {
        Properties props = new Properties();
        props.setProperty("resource.loader", "wepapp");
        props.setProperty("webapp.resource.loader.class", "org.apache.velocity.tools.view.WebappResourceLoader");
        props.setProperty("webapp.resource.loader.path", "/WEB-INF/mailtemplates/");
        VelocityEngine engine = new VelocityEngine(props);
        VelocityContext context = new VelocityContext();
        engine.init();
        Map map = createDataModel();
        context.put("user", map);
        Template template = engine.getTemplate(htmlTemplate);
        StringWriter writer = new StringWriter();
        template.merge(context, writer);
        return writer;
    }
...
}
这些文件当然保存在/ …
我有一些麻烦使我的登录始终重定向到同一个地方.我做过这样的事情
<http auto-config="true" use-expressions="true" entry-point-ref="gaeEntryPoint" >
    <intercept-url pattern="/_ah/login" access="permitAll"/>
    <intercept-url pattern="/**" access="isAuthenticated()"/>
    <custom-filter position="PRE_AUTH_FILTER" ref="gaeFilter"/>
    <form-login authentication-success-handler-ref="authSuccessHandler"/>
</http>
<beans:bean id="authSuccessHandler"
            class="dk.lindhardt.arbejdsfordeling.server.security.AuthenticationSuccessHandlerImpl"/>
和
public class AuthenticationSuccessHandlerImpl implements AuthenticationSuccessHandler {
   public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 
   throws IOException, ServletException {
       if (authentication != null && authentication.isAuthenticated()) {
           response.sendRedirect(OrganizationListServlet.URL);
       }
   }
 }
它永远不会进入上述方法.我怎么做到这一点?
编辑:我按照本指南http://blog.springsource.com/2010/08/02/spring-security-in-google-app-engine/
我碰到了一些我不理解的东西.当第二个相同的时候,为什么不是每个循环都合法?
public interface SomeInterface<T> {
   List<SomeNamedObject> getObjects();
   void doSomething(P1 p1, T p2);
}
public class SomeNamedObject {
    private String text;
}
public class Clazz {
    private SomeInterface someInterface;
    ...
    public void someMethod() {
       // Error Type mismatch: cannot convert from element type Object to TestClass.SomeNamedObject
       for (SomeNamedObject someNamedObject :  someInterface.getObjects()) {
             // This loop won't compile as the someInterface.getObjects returns just a List and not a List<SomeNamedObject>
       }
       // Warning Type safety: The expression of type List needs unchecked 
       // …我有一个多模块Web应用程序.
结构是:
Parent
|
| - - Child 1
| - - Child 2
| - - Web
Web项目依赖于两个子模块
当我使用我的IDE来构建我的项目时,我习惯于在IDE中构建WEB-INF/classes文件夹中的类.这很好,因为Web服务器注意到新类并重新启动或热部署这些文件.对于maven,我似乎每次都要从头开始包装整件事.
我想在maven中找到一种方法,以便我可以避免运行mvn:clean mvn:install mvn:war:inplace.相反,我想要一个mvn:comile,然后就是那里的东西.
我希望你明白我的意思.当您需要构建所有项目jar并在更新内容之前运行som war命令时,测试Web应用程序的速度非常慢.
网络应用程序pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
       ...
   </parent>
   <artifactId>web</artifactId>
   <packaging>war</packaging>
   <dependencies>
      <dependency>
         <groupId>bla.bla.bla</groupId>
         <artifactId>bla_child1</artifactId>
         <version>1.0-SNAPSHOT</version>
      </dependency>
      <dependency>
         <groupId>bla.bla.bla</groupId>
         <artifactId>bla_child2</artifactId>
         <version>1.0-SNAPSHOT</version>
      </dependency>
   </dependencies>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
         </plugin>
         <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.0.4.v20130625</version>
            <configuration>
               <scanIntervalSeconds>30</scanIntervalSeconds>
               <webApp>
                  <contextPath>/blabla</contextPath>
               </webApp>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>
我已经尝试了很多与docker -f选项的组合,但我从来没有让它工作
我可以做这个:
docker build -t foo/bar .
但我不能这样做:
docker build -t foo/bar -f Dockerfile .
或这个:
docker build -t foo/bar -f ./Dockerfile .
这给了我以下错误:
unable to prepare context: The Dockerfile (c:\path\Dockerfile) must be within the build context (.)
我在Windows 7上通过默认的vm使用docker .Docker版本是1.8.1,build d12ea79
我看不出差异.在项目中为不同的任务设置不同的Dockerfiles可能会非常好,但是没有-f选项是不可能的.
我的服务器是glassfish v3,我的浏览器是firefox 3.6.3,我正在使用Netbeans 6.8我的问题是为什么textfield没有显示在我的浏览器中.我只看到标签.
<?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://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core">
            <h:head>
                <title>Lookup</title>
            </h:head>
            <h:body>
                <fieldset>
                <legend>Enter Your Customer ID</legend>
                <p>Legal ids are id001, id002, and id003.</p>
                <f:view>
                <h:form>
                    Customer ID:
                    <h:inputText value="#{bankForm.customerId}" />
                    <h:commandButton value="Show Current Balance"
                                     action="#{bankForm.findBalance}" />
                </h:form>
                </f:view>
                </fieldset>
            </h:body>
    </html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config> …我需要从孩子身上取下一个道具。
我有一个容器元素,它使用其子元素的属性来对子元素执行一些增强。在渲染之前应该从子级中删除该属性。
<AsyncContainer>
   <Button onClick={this.asyncStuff} asyncHandler="onClick"/>
</AsyncContainer>
应在渲染之前从按钮中删除 asyncHandler 属性。
AsyncContainer 使用React.cloneElement(child, properties).
我尝试将 asyncHandler 属性清空,将其设置为未定义并从 child.props 中删除该属性。看来这个财产想要再摆脱掉是不可能了。
是否可以在jsf页面上集成facebook?Facebook只显示了php的例子,但我已经有了一个用jsf编写的应用程序.我想要单点登录功能,并能够从Facebook获取我的用户图片.
也许你有一个小例子,你会怎么做:)
谢谢
也许我是傻瓜,但我不明白为什么StringTokenizer的行为在这里:
import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
String object = (String) value;
String escaped = escapeHtml(object);
StringTokenizer tokenizer = new StringTokenizer(escaped, escapeHtml("<br/>"));
如果是fx.价值是
Hej<br/>$user.get(0).name Har vundet<br/><table border='1'><tr><th>Name</th><th>Played</th><th>Brewed</th></tr>#foreach( $u in $user )<tr><td>$u.name</td> <td>$u.played</td> <td>$u.brewed</td></tr>#end</table><br/>
然后结果是
Hej
$use
.
e
(0).name Ha
 vunde
a
e 
o
de
='1'
h
Name
h
h
P
ayed
h
h
B
ewed
h
#fo
each( $u in $use
 )
d
$u.name
d
d
$u.p
ayed
d
d
$u.
ewed
d
#end
a
e
对我来说完全是无稽之谈.
我怎样才能让它像我期望的那样表现出来.
我再次遇到一个无法找到解决方案的问题.
托管bean
@Named(value="changeInfoBean")
@RequestScoped
public class ChangeInfoBean {
    private String email;
    private String firstName;
    private String lastName;
    /** Creates a new instance of ChangeInfoBean */
    public ChangeInfoBean() {
            FacesContext context = FacesContext.getCurrentInstance();
            // Gets the user which is currently logged in
            LoginBean bean = (LoginBean) context.getExternalContext().getSessionMap().get("loginBean");
            BasicUser user = bean.getUser();
            this.email = user.getEmail();
            this.firstName = user.getFirstName();
            this.lastName = user.getLastName();
    }
    public String changeName() {
        Session session = HibernateUtil.getSessionFactory().openSession();
        try {
            Transaction tx = session.beginTransaction();
            BasicUser updateUser = (BasicUser) session.load(BasicUser.class, this.email); …我正在使用glassfish v3,我通过管理控制台创建了一个JavaMail会话.我想像这样使用Mail会话:
....
import javax.annotation.Resource;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer {
    MailGenerator mailGenerator;
    @Resource(name = "mail/WMCMail")
    private Session mailSession;
    public Mailer(MailGenerator mailGenerator) {
        this.mailGenerator = mailGenerator;
    }
    public void sendMixedMail(String recipient, String subject) {
        try {
            Message message = new MimeMessage(mailSession);
            message.setRecipients(
                Message.RecipientType.TO,
                InternetAddress.parse(recipient, false));
            message.setSubject(subject);
            ......
            Transport.send(message);
            logger.log(Level.INFO, "Mail sent to {0}.", recipient);
        } catch (MessagingException ex) {
            logger.log(Level.SEVERE, "Error in sending email to " + recipient, ex);
        } 
    }
}
当我调用sendMixedMail方法时,我看到mailSession为null.是不是可以将资源注入普通类?当我说正常时,我指的是一个不是托管bean或ejb-something的类.
也许这是一个愚蠢的问题,但javascript是一个奇怪的事情.我使用spring security来保护我的gwt应用程序,并希望在客户端使用安全角色.这是安全的还是可以操纵它们以便普通用户突然可以访问管理器部件.