-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/yegor256/takes.git
Conflicts: src/main/java/org/takes/rs/RsWithHeaders.java
- Loading branch information
Showing
38 changed files
with
1,112 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 Yegor Bugayenko | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.takes.facets.auth.codecs; | ||
|
||
import java.io.IOException; | ||
import lombok.EqualsAndHashCode; | ||
import org.takes.facets.auth.Identity; | ||
|
||
/** | ||
* Base64 codec. | ||
* | ||
* <p>The class is immutable and thread-safe. | ||
* | ||
* @author Igor Khvostenkov ([email protected]) | ||
* @version $Id$ | ||
* @since 0.13 | ||
*/ | ||
@EqualsAndHashCode | ||
public final class CcBase64 implements Codec { | ||
/** | ||
* Original codec. | ||
*/ | ||
private final transient Codec origin; | ||
/** | ||
* Ctor. | ||
* @param codec Original codec | ||
*/ | ||
public CcBase64(final Codec codec) { | ||
this.origin = codec; | ||
} | ||
|
||
//@todo #19:30min to implement own simple Base64 encode algorithm | ||
// without using 3d-party Base64 encode libraries. Tests for this | ||
// method have been already created, do not forget to remove Ignore | ||
// annotation on it. | ||
@Override | ||
public byte[] encode(final Identity identity) throws IOException { | ||
assert this.origin != null; | ||
throw new UnsupportedOperationException("#encode()"); | ||
} | ||
|
||
//@todo #19:30min to implement own simple Base64 decode algorithm | ||
// without using 3d-party Base64 decode libraries. Tests for this | ||
// method have been already created, do not forget to remove Ignore | ||
// annotation on it. | ||
@Override | ||
public Identity decode(final byte[] bytes) throws IOException { | ||
assert this.origin != null; | ||
throw new UnsupportedOperationException("#decode()"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 Yegor Bugayenko | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.takes.facets.fork; | ||
|
||
import java.io.IOException; | ||
import lombok.EqualsAndHashCode; | ||
import org.takes.Request; | ||
import org.takes.Response; | ||
import org.takes.Take; | ||
import org.takes.tk.TkWrap; | ||
|
||
/** | ||
* Take that acts on request with specified "Accept" HTTP headers only. | ||
* | ||
* <p>The class is immutable and thread-safe. | ||
* | ||
* @author Eugene Kondrashev ([email protected]) | ||
* @version $Id$ | ||
* @since 0.14 | ||
*/ | ||
@EqualsAndHashCode(callSuper = true) | ||
public final class TkProduces extends TkWrap { | ||
|
||
/** | ||
* Ctor. | ||
* @param take Original take | ||
* @param types Accept types | ||
*/ | ||
public TkProduces(final Take take, final String types) { | ||
super( | ||
new Take() { | ||
@Override | ||
public Response act(final Request req) throws IOException { | ||
return new RsFork( | ||
req, | ||
new FkTypes(types, take.act(req)) | ||
); | ||
} | ||
} | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.